Create-or-update by a customer-named merge key: merge_key names any defined text-family attribute (usually sku) and attributes[merge_key] supplies the value to match — trimmed, case-insensitive. No match → create (201); one match → update (200); more than one match → 409 listing the matching ids. Idempotent for ERP-style pushes: address entities by your key, no UUID mapping table needed.
Workspace-scoped API key (mk_live_...). Each operation lists the scope it requires in x-required-scopes. See the Authentication guide for the full scope table and key management.
Body
application/json
merge_key
string
required
A defined text-family attribute key to match on (e.g. sku).
attributes
object
required
Map of attribute key → new value (sparse — only keys being written). Scalars set the value; null OR "" clears it (the key then disappears from reads). A single-reference key accepts a bare UUID string or an {id} object; a list-reference key accepts an array of either — list writes REPLACE the current set. Read stubs re-sent verbatim are valid writes (extra stub fields like type/label are ignored). Unknown keys are a 400; select values must be one of the attribute's acceptable_values.
Show child attributes
parent_id
string<uuid> | null
Response
An existing category matched and was updated (full resource).
data
object
The one shape for every entity read and mutation response. System fields live at the top level; every customer-defined key lives in attributes, so customer keys can never collide with system ones.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Merchkit","description":"Merchkit is an AI-native PIM: import your catalog, enrich it with AI, and publish channel-ready content. Product guides plus the developer reference for the Merchkit API and MCP server.","colors":{"primary":"#3E703F","light":"#6EA570","dark":"#2E5530"},"logo":{"light":"https://mintcdn.com/merchkit/5CX85y_hfwgKe2-R/logo/light.svg?fit=max\u0026auto=format\u0026n=5CX85y_hfwgKe2-R\u0026q=85\u0026s=44793f2cb04c37defc7d3810d29cca0e","dark":"https://mintcdn.com/merchkit/5CX85y_hfwgKe2-R/logo/dark.svg?fit=max\u0026auto=format\u0026n=5CX85y_hfwgKe2-R\u0026q=85\u0026s=bac43fbcffb653a7a2c577fd38a8de4e"},"favicon":"https://mintcdn.com/merchkit/kbLpgBCpSYwwHFZe/favicon.png?fit=max\u0026auto=format\u0026n=kbLpgBCpSYwwHFZe\u0026q=85\u0026s=ae9b1c0fcf22f192729dc47aa4377419","api":{"examples":{"defaults":"required"}},"navbar":{"links":[{"href":"mailto:support@merchkit.com","label":"Support"}],"primary":{"type":"button","label":"Go to App","href":"https://www.merchkit.com/home"}},"footer":{"socials":{"x":"https://x.com/merchkit_","linkedin":"https://www.linkedin.com/company/merchkithq"}},"contextual":{"options":["copy","view","chatgpt","claude","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"merchkit.com","icon":"house","href":"https://www.merchkit.com"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"merchkit","hasAudioNarration":false,"actualSubdomain":"merchkit","customDomains":["docs.merchkit.com"],"gitSource":{"type":"github","owner":"merchkit","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"feedback":{"agentFeedback":true,"thumbs":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6af77686fcbcc7142a349e17","clientVersion":"0.0.4142","searchFilterCounts":[{"language":"default","tag":"Product","count":67},{"language":"default","tag":"API \u0026 MCP","count":46},{"language":"default","tag":"API Reference","count":41},{"language":"default","tag":"Catalog","count":30},{"language":"default","tag":"Attributes \u0026 Enrichment","count":17},{"language":"default","tag":"Channels \u0026 Content Generation","count":12},{"language":"default","tag":"Sources \u0026 Importing","count":11},{"language":"default","tag":"Integrations \u0026 Field Mapping","count":10},{"language":"default","tag":"Products","count":8},{"language":"default","tag":"Getting Started","count":7}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":true,"enableContextualStarterQuestions":true,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"email":"support@merchkit.com","showHelpButton":true}},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api-reference/upsert-a-category-by-your-own-key","slug":"/api-reference/upsert-a-category-by-your-own-key","pageMetadata":{"title":"Upsert a category by your own key","description":"Create-or-update by a customer-named merge key: `merge_key` names any defined text-family attribute (usually `sku`) and `attributes[merge_key]` supplies the value to match — trimmed, case-insensitive. No match → create (201); one match → update (200); more than one match → 409 listing the matching ids. Idempotent for ERP-style pushes: address entities by your key, no UUID mapping table needed.\n\nScope: `write:categories`.","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /categories/upsert","href":"/api-reference/upsert-a-category-by-your-own-key","autogeneratedByOpenApi":true},"description":{"compiledSource":"\"use strict\";\nconst {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n code: \"code\",\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_Fragment, {\n children: [_jsxs(_components.p, {\n children: [\"Create-or-update by a customer-named merge key: \", _jsx(_components.code, {\n children: \"merge_key\"\n }), \" names any defined text-family attribute (usually \", _jsx(_components.code, {\n children: \"sku\"\n }), \") and \", _jsx(_components.code, {\n children: \"attributes[merge_key]\"\n }), \" supplies the value to match — trimmed, case-insensitive. No match → create (201); one match → update (200); more than one match → 409 listing the matching ids. Idempotent for ERP-style pushes: address entities by your key, no UUID mapping table needed.\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"Scope: \", _jsx(_components.code, {\n children: \"write:categories\"\n }), \".\"]\n })]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Upsert a category by your own key","description":"Create-or-update by a customer-named merge key: `merge_key` names any defined text-family attribute (usually `sku`) and `attributes[merge_key]` supplies the value to match — trimmed, case-insensitive. No match → create (201); one match → update (200); more than one match → 409 listing the matching ids. Idempotent for ERP-style pushes: address entities by your key, no UUID mapping table needed.\n\nScope: `write:categories`.","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /categories/upsert","href":"/api-reference/upsert-a-category-by-your-own-key","autogeneratedByOpenApi":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"operationId":"upsertCategory","summary":"Upsert a category by your own key","description":"Create-or-update by a customer-named merge key: `merge_key` names any defined text-family attribute (usually `sku`) and `attributes[merge_key]` supplies the value to match — trimmed, case-insensitive. No match → create (201); one match → update (200); more than one match → 409 listing the matching ids. Idempotent for ERP-style pushes: address entities by your key, no UUID mapping table needed.\n\nScope: `write:categories`.","security":["a7d26b9e-3e3f-42d0-9fbf-2cc663b85d18"],"x-required-scopes":["write:categories"],"requestBody":"d1109694-4862-4d9e-982f-de692073b4f6","responses":{"200":"23318d49-822d-427f-ab83-f6266af31d91","201":"6ea6b324-ecde-414d-b407-5410e63e8cdc","400":"b329e295-cd44-4079-a0f0-f3d21f20b354","409":"1a264435-7665-44b5-93fe-170b13e01f6f"},"method":"post","type":"path","servers":["ae4f6803-6cfa-4dad-ab41-8bd0d862f7b7"],"path":"/categories/upsert","baseUrlOptions":["https://www.merchkit.com/api/v1"],"title":"Upsert a category by your own key","codeSamples":[],"requiredOnlyExamples":true,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["merge_key","attributes"],"additionalProperties":false,"properties":{"merge_key":{"type":"string","description":"A defined text-family attribute key to match on (e.g. `sku`).","isRequired":true,"uniqueKey":"merge_key","typeLabel":"string"},"attributes":{"type":"object","description":"Map of attribute key → new value (sparse — only keys being written). Scalars set the value; `null` OR `\"\"` clears it (the key then disappears from reads). A single-reference key accepts a bare UUID string or an `{id}` object; a list-reference key accepts an array of either — list writes REPLACE the current set. Read stubs re-sent verbatim are valid writes (extra stub fields like `type`/`label` are ignored). Unknown keys are a 400; select values must be one of the attribute's `acceptable_values`.","additionalProperties":{"oneOf":[{"type":"string","description":"A write value: scalar, null/\"\" to clear, a UUID or `{id}` object for a single reference, or an array of UUIDs/`{id}` objects for a list reference (replace semantics).","uniqueKey":"attributes.additionalProperties.oneOf.0","typeLabel":"string"},{"type":"number","description":"A write value: scalar, null/\"\" to clear, a UUID or `{id}` object for a single reference, or an array of UUIDs/`{id}` objects for a list reference (replace semantics).","uniqueKey":"attributes.additionalProperties.oneOf.1","typeLabel":"number"},{"type":"boolean","description":"A write value: scalar, null/\"\" to clear, a UUID or `{id}` object for a single reference, or an array of UUIDs/`{id}` objects for a list reference (replace semantics).","uniqueKey":"attributes.additionalProperties.oneOf.2","typeLabel":"boolean"},{"type":"null","description":"A write value: scalar, null/\"\" to clear, a UUID or `{id}` object for a single reference, or an array of UUIDs/`{id}` objects for a list reference (replace semantics).","uniqueKey":"attributes.additionalProperties.oneOf.3","typeLabel":"null"},{"type":"object","description":"A write value: scalar, null/\"\" to clear, a UUID or `{id}` object for a single reference, or an array of UUIDs/`{id}` objects for a list reference (replace semantics).","required":["id"],"properties":{"id":{"type":"string","format":"uuid","isRequired":true,"uniqueKey":"attributes.additionalProperties.oneOf.4.id","typeLabel":"string\u003cuuid>"}},"additionalProperties":true,"uniqueKey":"attributes.additionalProperties.oneOf.4","typeLabel":"object"},{"type":"array","items":{"oneOf":[{"type":"string","format":"uuid","uniqueKey":"attributes.additionalProperties.oneOf.5.items.[INDEX].oneOf.0","typeLabel":"string\u003cuuid>"},{"type":"object","required":["id"],"properties":{"id":{"type":"string","format":"uuid","isRequired":true,"uniqueKey":"attributes.additionalProperties.oneOf.5.items.[INDEX].oneOf.1.id","typeLabel":"string\u003cuuid>"}},"additionalProperties":true,"uniqueKey":"attributes.additionalProperties.oneOf.5.items.[INDEX].oneOf.1","typeLabel":"object"}],"uniqueKey":"attributes.additionalProperties.oneOf.5.items.[INDEX]","typeLabel":"string\u003cuuid> | object"},"description":"A write value: scalar, null/\"\" to clear, a UUID or `{id}` object for a single reference, or an array of UUIDs/`{id}` objects for a list reference (replace semantics).","uniqueKey":"attributes.additionalProperties.oneOf.5","typeLabel":"(string\u003cuuid> | object)[]"}],"uniqueKey":"attributes.additionalProperties","typeLabel":"string | number | boolean | null | object | (string\u003cuuid> | object)[]"},"isRequired":true,"uniqueKey":"attributes","typeLabel":"object"},"parent_id":{"oneOf":[{"type":"string","format":"uuid","uniqueKey":"parent_id.oneOf.0","typeLabel":"string\u003cuuid>"},{"type":"null","format":"uuid","uniqueKey":"parent_id.oneOf.1","typeLabel":"null"}],"uniqueKey":"parent_id","typeLabel":"string\u003cuuid> | null"}},"uniqueKey":"","typeLabel":"object"},"example":{"merge_key":"category_name","attributes":{"category_name":"Dining Tables","department":"Furniture"}},"examples":{"Example":{"title":"Example","value":{"merge_key":"category_name","attributes":{"category_name":"Dining Tables","department":"Furniture"}}}},"exampleType":"examples"}},"exampleType":"examples"},"responses":{"23318d49-822d-427f-ab83-f6266af31d91":{"description":"An existing category matched and was updated (full resource).","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","description":"The one shape for every entity read and mutation response. System fields live at the top level; every customer-defined key lives in `attributes`, so customer keys can never collide with system ones.","required":["id","type","label","parent_id","created_at","updated_at","attributes"],"properties":{"id":{"type":"string","format":"uuid","isRequired":true,"uniqueKey":"data.id","typeLabel":"string\u003cuuid>"},"type":{"type":"string","enum":["product","image","vendor","category","source"],"description":"The entity type discriminator.","isRequired":true,"uniqueKey":"data.type","typeLabel":"enum\u003cstring>"},"label":{"oneOf":[{"type":"string","description":"The workspace's primary-attribute value for this entity; null when no primary attribute is configured or it is unset (never a UUID posing as a name). Render `label ?? id`.","isRequired":true,"uniqueKey":"data.label.oneOf.0","typeLabel":"string"},{"type":"null","description":"The workspace's primary-attribute value for this entity; null when no primary attribute is configured or it is unset (never a UUID posing as a name). Render `label ?? id`.","isRequired":true,"uniqueKey":"data.label.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"data.label","typeLabel":"string | null"},"parent_id":{"oneOf":[{"type":"string","format":"uuid","description":"Parent entity id (products: the variant parent).","isRequired":true,"uniqueKey":"data.parent_id.oneOf.0","typeLabel":"string\u003cuuid>"},{"type":"null","format":"uuid","description":"Parent entity id (products: the variant parent).","isRequired":true,"uniqueKey":"data.parent_id.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"data.parent_id","typeLabel":"string\u003cuuid> | null"},"created_at":{"oneOf":[{"type":"string","format":"date-time","isRequired":true,"uniqueKey":"data.created_at.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","isRequired":true,"uniqueKey":"data.created_at.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"data.created_at","typeLabel":"string\u003cdate-time> | null"},"updated_at":{"oneOf":[{"type":"string","format":"date-time","isRequired":true,"uniqueKey":"data.updated_at.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","isRequired":true,"uniqueKey":"data.updated_at.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"data.updated_at","typeLabel":"string\u003cdate-time> | null"},"attributes":{"type":"object","description":"SPARSE map of customer-defined keys — only keys with values appear; a missing key means unset or not-applicable (read `attributes[key] ?? null`; never contains null or \"\"). Scalars are bare values; a single reference is a labeled stub; a list reference is a COMPLETE ordered stub array (no cap, array order = position order). Inverse-reference keys never appear — traverse them via filters or `/products/{id}/references`. The full key list comes from `GET /attributes`.","additionalProperties":{"oneOf":[{"type":"string","description":"A read value: a bare scalar (string/number/boolean), a single reference stub, or a complete ordered array of reference stubs.","uniqueKey":"data.attributes.additionalProperties.oneOf.0","typeLabel":"string"},{"type":"number","description":"A read value: a bare scalar (string/number/boolean), a single reference stub, or a complete ordered array of reference stubs.","uniqueKey":"data.attributes.additionalProperties.oneOf.1","typeLabel":"number"},{"type":"boolean","description":"A read value: a bare scalar (string/number/boolean), a single reference stub, or a complete ordered array of reference stubs.","uniqueKey":"data.attributes.additionalProperties.oneOf.2","typeLabel":"boolean"},{"type":"object","description":"A read value: a bare scalar (string/number/boolean), a single reference stub, or a complete ordered array of reference stubs.","required":["id","type","label"],"example":{"id":"77e1b2aa-6b3d-4f19-9d10-8c2a5e7f4b21","type":"vendor","label":"Nordic Timber Co."},"properties":{"id":{"type":"string","format":"uuid","isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.3.id","typeLabel":"string\u003cuuid>"},"type":{"type":"string","enum":["product","image","vendor","category","source"],"isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.3.type","typeLabel":"enum\u003cstring>"},"label":{"oneOf":[{"type":"string","description":"The referenced entity's label (same null rule).","isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.3.label.oneOf.0","typeLabel":"string"},{"type":"null","description":"The referenced entity's label (same null rule).","isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.3.label.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.3.label","typeLabel":"string | null"}},"uniqueKey":"data.attributes.additionalProperties.oneOf.3","typeLabel":"object"},{"type":"array","items":{"type":"object","description":"A labeled pointer to another entity. Fetch the full record via `GET /{type plural}/{id}` when needed — the label is inline so list rendering needs no extra lookups.","required":["id","type","label"],"properties":{"id":{"type":"string","format":"uuid","isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.4.items.[INDEX].id","typeLabel":"string\u003cuuid>"},"type":{"type":"string","enum":["product","image","vendor","category","source"],"isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.4.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"label":{"oneOf":[{"type":"string","description":"The referenced entity's label (same null rule).","isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.4.items.[INDEX].label.oneOf.0","typeLabel":"string"},{"type":"null","description":"The referenced entity's label (same null rule).","isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.4.items.[INDEX].label.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.4.items.[INDEX].label","typeLabel":"string | null"}},"example":{"id":"77e1b2aa-6b3d-4f19-9d10-8c2a5e7f4b21","type":"vendor","label":"Nordic Timber Co."},"uniqueKey":"data.attributes.additionalProperties.oneOf.4.items.[INDEX]","typeLabel":"object"},"description":"A read value: a bare scalar (string/number/boolean), a single reference stub, or a complete ordered array of reference stubs.","uniqueKey":"data.attributes.additionalProperties.oneOf.4","typeLabel":"object[]"}],"uniqueKey":"data.attributes.additionalProperties","typeLabel":"string | number | boolean | object | object[]"},"isRequired":true,"uniqueKey":"data.attributes","typeLabel":"object"}},"example":{"id":"9b2f6c1e-8a04-4c6e-b0d3-5f2f6f7a9e21","type":"product","label":"Aria Oak Dining Table","parent_id":null,"created_at":"2026-06-02T14:11:09Z","updated_at":"2026-07-18T09:30:22Z","attributes":{"sku":"ARIA-DT-72","product_name":"Aria Oak Dining Table","price":1299,"material":"White Oak","vendor":{"id":"77e1b2aa-6b3d-4f19-9d10-8c2a5e7f4b21","type":"vendor","label":"Nordic Timber Co."},"category":{"id":"c41d09f3-2e85-47a6-b93c-d5f8e1a20c67","type":"category","label":"Dining Tables"},"gallery_images":[{"id":"f0a1b2c3-d4e5-4f60-8a7b-9c0d1e2f3a4b","type":"image","label":"aria-hero.jpg"},{"id":"f0a2c3d4-e5f6-4a70-9b8c-0d1e2f3a4b5c","type":"image","label":"aria-detail.jpg"},{"id":"f0a3d4e5-f6a7-4b80-8c9d-1e2f3a4b5c6d","type":"image","label":"aria-side.jpg"},{"id":"f0a4e5f6-a7b8-4c90-9dae-2f3a4b5c6d7e","type":"image","label":"aria-lifestyle.jpg"},{"id":"f0a5f6a7-b8c9-4da0-8ebf-3a4b5c6d7e8f","type":"image","label":"aria-packshot.jpg"}]}},"uniqueKey":"data","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"example":{"data":{"id":"c41d09f3-2e85-47a6-b93c-d5f8e1a20c67","type":"category","label":"Dining Tables","parent_id":null,"created_at":"2026-06-02T14:11:09Z","updated_at":"2026-07-18T09:30:22Z","attributes":{"category_name":"Dining Tables","department":"Furniture"}}},"examples":{"Example":{"title":"Example","value":{"data":{"id":"c41d09f3-2e85-47a6-b93c-d5f8e1a20c67","type":"category","label":"Dining Tables","parent_id":null,"created_at":"2026-06-02T14:11:09Z","updated_at":"2026-07-18T09:30:22Z","attributes":{"category_name":"Dining Tables","department":"Furniture"}}}}},"exampleType":"examples"}},"exampleType":"examples"},"6ea6b324-ecde-414d-b407-5410e63e8cdc":{"description":"No match — a category was created (full resource).","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","description":"The one shape for every entity read and mutation response. System fields live at the top level; every customer-defined key lives in `attributes`, so customer keys can never collide with system ones.","required":["id","type","label","parent_id","created_at","updated_at","attributes"],"properties":{"id":{"type":"string","format":"uuid","isRequired":true,"uniqueKey":"data.id","typeLabel":"string\u003cuuid>"},"type":{"type":"string","enum":["product","image","vendor","category","source"],"description":"The entity type discriminator.","isRequired":true,"uniqueKey":"data.type","typeLabel":"enum\u003cstring>"},"label":{"oneOf":[{"type":"string","description":"The workspace's primary-attribute value for this entity; null when no primary attribute is configured or it is unset (never a UUID posing as a name). Render `label ?? id`.","isRequired":true,"uniqueKey":"data.label.oneOf.0","typeLabel":"string"},{"type":"null","description":"The workspace's primary-attribute value for this entity; null when no primary attribute is configured or it is unset (never a UUID posing as a name). Render `label ?? id`.","isRequired":true,"uniqueKey":"data.label.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"data.label","typeLabel":"string | null"},"parent_id":{"oneOf":[{"type":"string","format":"uuid","description":"Parent entity id (products: the variant parent).","isRequired":true,"uniqueKey":"data.parent_id.oneOf.0","typeLabel":"string\u003cuuid>"},{"type":"null","format":"uuid","description":"Parent entity id (products: the variant parent).","isRequired":true,"uniqueKey":"data.parent_id.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"data.parent_id","typeLabel":"string\u003cuuid> | null"},"created_at":{"oneOf":[{"type":"string","format":"date-time","isRequired":true,"uniqueKey":"data.created_at.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","isRequired":true,"uniqueKey":"data.created_at.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"data.created_at","typeLabel":"string\u003cdate-time> | null"},"updated_at":{"oneOf":[{"type":"string","format":"date-time","isRequired":true,"uniqueKey":"data.updated_at.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","isRequired":true,"uniqueKey":"data.updated_at.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"data.updated_at","typeLabel":"string\u003cdate-time> | null"},"attributes":{"type":"object","description":"SPARSE map of customer-defined keys — only keys with values appear; a missing key means unset or not-applicable (read `attributes[key] ?? null`; never contains null or \"\"). Scalars are bare values; a single reference is a labeled stub; a list reference is a COMPLETE ordered stub array (no cap, array order = position order). Inverse-reference keys never appear — traverse them via filters or `/products/{id}/references`. The full key list comes from `GET /attributes`.","additionalProperties":{"oneOf":[{"type":"string","description":"A read value: a bare scalar (string/number/boolean), a single reference stub, or a complete ordered array of reference stubs.","uniqueKey":"data.attributes.additionalProperties.oneOf.0","typeLabel":"string"},{"type":"number","description":"A read value: a bare scalar (string/number/boolean), a single reference stub, or a complete ordered array of reference stubs.","uniqueKey":"data.attributes.additionalProperties.oneOf.1","typeLabel":"number"},{"type":"boolean","description":"A read value: a bare scalar (string/number/boolean), a single reference stub, or a complete ordered array of reference stubs.","uniqueKey":"data.attributes.additionalProperties.oneOf.2","typeLabel":"boolean"},{"type":"object","description":"A read value: a bare scalar (string/number/boolean), a single reference stub, or a complete ordered array of reference stubs.","required":["id","type","label"],"example":{"id":"77e1b2aa-6b3d-4f19-9d10-8c2a5e7f4b21","type":"vendor","label":"Nordic Timber Co."},"properties":{"id":{"type":"string","format":"uuid","isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.3.id","typeLabel":"string\u003cuuid>"},"type":{"type":"string","enum":["product","image","vendor","category","source"],"isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.3.type","typeLabel":"enum\u003cstring>"},"label":{"oneOf":[{"type":"string","description":"The referenced entity's label (same null rule).","isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.3.label.oneOf.0","typeLabel":"string"},{"type":"null","description":"The referenced entity's label (same null rule).","isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.3.label.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.3.label","typeLabel":"string | null"}},"uniqueKey":"data.attributes.additionalProperties.oneOf.3","typeLabel":"object"},{"type":"array","items":{"type":"object","description":"A labeled pointer to another entity. Fetch the full record via `GET /{type plural}/{id}` when needed — the label is inline so list rendering needs no extra lookups.","required":["id","type","label"],"properties":{"id":{"type":"string","format":"uuid","isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.4.items.[INDEX].id","typeLabel":"string\u003cuuid>"},"type":{"type":"string","enum":["product","image","vendor","category","source"],"isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.4.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"label":{"oneOf":[{"type":"string","description":"The referenced entity's label (same null rule).","isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.4.items.[INDEX].label.oneOf.0","typeLabel":"string"},{"type":"null","description":"The referenced entity's label (same null rule).","isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.4.items.[INDEX].label.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"data.attributes.additionalProperties.oneOf.4.items.[INDEX].label","typeLabel":"string | null"}},"example":{"id":"77e1b2aa-6b3d-4f19-9d10-8c2a5e7f4b21","type":"vendor","label":"Nordic Timber Co."},"uniqueKey":"data.attributes.additionalProperties.oneOf.4.items.[INDEX]","typeLabel":"object"},"description":"A read value: a bare scalar (string/number/boolean), a single reference stub, or a complete ordered array of reference stubs.","uniqueKey":"data.attributes.additionalProperties.oneOf.4","typeLabel":"object[]"}],"uniqueKey":"data.attributes.additionalProperties","typeLabel":"string | number | boolean | object | object[]"},"isRequired":true,"uniqueKey":"data.attributes","typeLabel":"object"}},"example":{"id":"9b2f6c1e-8a04-4c6e-b0d3-5f2f6f7a9e21","type":"product","label":"Aria Oak Dining Table","parent_id":null,"created_at":"2026-06-02T14:11:09Z","updated_at":"2026-07-18T09:30:22Z","attributes":{"sku":"ARIA-DT-72","product_name":"Aria Oak Dining Table","price":1299,"material":"White Oak","vendor":{"id":"77e1b2aa-6b3d-4f19-9d10-8c2a5e7f4b21","type":"vendor","label":"Nordic Timber Co."},"category":{"id":"c41d09f3-2e85-47a6-b93c-d5f8e1a20c67","type":"category","label":"Dining Tables"},"gallery_images":[{"id":"f0a1b2c3-d4e5-4f60-8a7b-9c0d1e2f3a4b","type":"image","label":"aria-hero.jpg"},{"id":"f0a2c3d4-e5f6-4a70-9b8c-0d1e2f3a4b5c","type":"image","label":"aria-detail.jpg"},{"id":"f0a3d4e5-f6a7-4b80-8c9d-1e2f3a4b5c6d","type":"image","label":"aria-side.jpg"},{"id":"f0a4e5f6-a7b8-4c90-9dae-2f3a4b5c6d7e","type":"image","label":"aria-lifestyle.jpg"},{"id":"f0a5f6a7-b8c9-4da0-8ebf-3a4b5c6d7e8f","type":"image","label":"aria-packshot.jpg"}]}},"uniqueKey":"data","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"example":{"data":{"id":"c41d09f3-2e85-47a6-b93c-d5f8e1a20c67","type":"category","label":"Dining Tables","parent_id":null,"created_at":"2026-06-02T14:11:09Z","updated_at":"2026-07-18T09:30:22Z","attributes":{"category_name":"Dining Tables","department":"Furniture"}}},"examples":{"Example":{"title":"Example","value":{"data":{"id":"c41d09f3-2e85-47a6-b93c-d5f8e1a20c67","type":"category","label":"Dining Tables","parent_id":null,"created_at":"2026-06-02T14:11:09Z","updated_at":"2026-07-18T09:30:22Z","attributes":{"category_name":"Dining Tables","department":"Furniture"}}}}},"exampleType":"examples"}},"exampleType":"examples"},"b329e295-cd44-4079-a0f0-f3d21f20b354":{"description":"Validation failed (unknown merge_key/attribute, missing merge value).","content":{"application/json":{"schema":{"type":"object","description":"The one error envelope every non-2xx response uses. `documentation_url` links to the code's section of the error docs.","required":["error"],"properties":{"error":{"type":"object","required":["code","message","is_retriable"],"properties":{"code":{"type":"string","enum":["unauthorized","insufficient_scope","forbidden","not_found","validation_failed","rate_limited","conflict","internal_error"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"enum\u003cstring>"},"message":{"type":"string","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"is_retriable":{"type":"boolean","description":"Only `rate_limited` and `internal_error` are retriable. Deterministic client errors (validation, not-found, conflict) return a 4xx and are never retriable.","isRequired":true,"uniqueKey":"error.is_retriable","typeLabel":"boolean"},"documentation_url":{"type":"string","format":"uri","description":"https://docs.merchkit.com/developers/errors#\u003ccode>","uniqueKey":"error.documentation_url","typeLabel":"string\u003curi>"},"retry_after_seconds":{"oneOf":[{"type":"integer","uniqueKey":"error.retry_after_seconds.oneOf.0","typeLabel":"integer"},{"type":"null","uniqueKey":"error.retry_after_seconds.oneOf.1","typeLabel":"null"}],"uniqueKey":"error.retry_after_seconds","typeLabel":"integer | null"},"alternative_action":{"type":"string","description":"What to do instead, when there is a better call.","uniqueKey":"error.alternative_action","typeLabel":"string"},"request_id":{"type":"string","uniqueKey":"error.request_id","typeLabel":"string"},"field_errors":{"type":"array","items":{"type":"object","required":["field","issue"],"properties":{"field":{"type":"string","isRequired":true,"uniqueKey":"error.field_errors.items.[INDEX].field","typeLabel":"string"},"issue":{"type":"string","description":"Machine-readable issue code, e.g. `not_a_defined_attribute`.","isRequired":true,"uniqueKey":"error.field_errors.items.[INDEX].issue","typeLabel":"string"},"acceptable_values":{"type":"array","items":{"type":"string","uniqueKey":"error.field_errors.items.[INDEX].acceptable_values.items.[INDEX]","typeLabel":"string"},"description":"For select-value violations: the allowed values.","uniqueKey":"error.field_errors.items.[INDEX].acceptable_values","typeLabel":"string[]"}},"uniqueKey":"error.field_errors.items.[INDEX]","typeLabel":"object"},"uniqueKey":"error.field_errors","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"example":{"error":{"code":"validation_failed","message":"Unknown attribute key(s): colour.","documentation_url":"https://docs.merchkit.com/developers/errors#validation_failed","is_retriable":false,"retry_after_seconds":null,"alternative_action":"List valid attribute keys via GET /v1/attributes?type=product.","request_id":"req_01j9x2k8","field_errors":[{"field":"colour","issue":"not_a_defined_attribute"}]}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"code":"validation_failed","message":"Unknown attribute key(s): colour.","documentation_url":"https://docs.merchkit.com/developers/errors#validation_failed","is_retriable":false,"retry_after_seconds":null,"alternative_action":"List valid attribute keys via GET /v1/attributes?type=product.","request_id":"req_01j9x2k8","field_errors":[{"field":"colour","issue":"not_a_defined_attribute"}]}}}},"exampleType":"generated"}},"exampleType":"generated"},"1a264435-7665-44b5-93fe-170b13e01f6f":{"description":"More than one existing match — deduplicate or update by id.","content":{"application/json":{"schema":{"type":"object","description":"The one error envelope every non-2xx response uses. `documentation_url` links to the code's section of the error docs.","required":["error"],"properties":{"error":{"type":"object","required":["code","message","is_retriable"],"properties":{"code":{"type":"string","enum":["unauthorized","insufficient_scope","forbidden","not_found","validation_failed","rate_limited","conflict","internal_error"],"isRequired":true,"uniqueKey":"error.code","typeLabel":"enum\u003cstring>"},"message":{"type":"string","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"is_retriable":{"type":"boolean","description":"Only `rate_limited` and `internal_error` are retriable. Deterministic client errors (validation, not-found, conflict) return a 4xx and are never retriable.","isRequired":true,"uniqueKey":"error.is_retriable","typeLabel":"boolean"},"documentation_url":{"type":"string","format":"uri","description":"https://docs.merchkit.com/developers/errors#\u003ccode>","uniqueKey":"error.documentation_url","typeLabel":"string\u003curi>"},"retry_after_seconds":{"oneOf":[{"type":"integer","uniqueKey":"error.retry_after_seconds.oneOf.0","typeLabel":"integer"},{"type":"null","uniqueKey":"error.retry_after_seconds.oneOf.1","typeLabel":"null"}],"uniqueKey":"error.retry_after_seconds","typeLabel":"integer | null"},"alternative_action":{"type":"string","description":"What to do instead, when there is a better call.","uniqueKey":"error.alternative_action","typeLabel":"string"},"request_id":{"type":"string","uniqueKey":"error.request_id","typeLabel":"string"},"field_errors":{"type":"array","items":{"type":"object","required":["field","issue"],"properties":{"field":{"type":"string","isRequired":true,"uniqueKey":"error.field_errors.items.[INDEX].field","typeLabel":"string"},"issue":{"type":"string","description":"Machine-readable issue code, e.g. `not_a_defined_attribute`.","isRequired":true,"uniqueKey":"error.field_errors.items.[INDEX].issue","typeLabel":"string"},"acceptable_values":{"type":"array","items":{"type":"string","uniqueKey":"error.field_errors.items.[INDEX].acceptable_values.items.[INDEX]","typeLabel":"string"},"description":"For select-value violations: the allowed values.","uniqueKey":"error.field_errors.items.[INDEX].acceptable_values","typeLabel":"string[]"}},"uniqueKey":"error.field_errors.items.[INDEX]","typeLabel":"object"},"uniqueKey":"error.field_errors","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"example":{"error":{"code":"validation_failed","message":"Unknown attribute key(s): colour.","documentation_url":"https://docs.merchkit.com/developers/errors#validation_failed","is_retriable":false,"retry_after_seconds":null,"alternative_action":"List valid attribute keys via GET /v1/attributes?type=product.","request_id":"req_01j9x2k8","field_errors":[{"field":"colour","issue":"not_a_defined_attribute"}]}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"code":"validation_failed","message":"Unknown attribute key(s): colour.","documentation_url":"https://docs.merchkit.com/developers/errors#validation_failed","is_retriable":false,"retry_after_seconds":null,"alternative_action":"List valid attribute keys via GET /v1/attributes?type=product.","request_id":"req_01j9x2k8","field_errors":[{"field":"colour","issue":"not_a_defined_attribute"}]}}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"a7d26b9e-3e3f-42d0-9fbf-2cc663b85d18":{"ApiKeyAuth":{"type":"http","scheme":"bearer","description":"Workspace-scoped API key (`mk_live_...`). Each operation lists the scope it requires in `x-required-scopes`. See the Authentication guide for the full scope table and key management.","scopes":[],"schemeName":"ApiKeyAuth"}}},"servers":{"ae4f6803-6cfa-4dad-ab41-8bd0d862f7b7":{"url":"https://www.merchkit.com/api/v1","description":"Merchkit API v1"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","description":"Workspace-scoped API key (`mk_live_...`). Each operation lists the scope it requires in `x-required-scopes`. See the Authentication guide for the full scope table and key management.","scopes":[],"schemeName":"ApiKeyAuth"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Workspace-scoped API key (`mk_live_...`). Each operation lists the scope it requires in `x-required-scopes`. See the Authentication guide for the full scope table and key management.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"ApiKeyAuth","name":"Authorization"}],"title":"ApiKeyAuth"}]},"originalFileLocation":"https://www.merchkit.com/api/v1/openapi"},"subdomain":"merchkit","siteName":"Merchkit","title":"Upsert a category by your own key - Merchkit","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-13T20:43:26.961Z","originalFileLocation":"api-reference/upsert-a-category-by-your-own-key.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Create-or-update by a customer-named merge key: merge_key names any defined text-family attribute (usually sku) and attributes[merge_key] supplies the value to match — trimmed, case-insensitive. No match → create (201); one match → update (200); more than one match → 409 listing the matching ids. Idempotent for ERP-style pushes: address entities by your key, no UUID mapping table needed. Scope: write:categories.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Merchkit\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/merchkit/u9Xu7zNeRpkrmNZE/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/merchkit/u9Xu7zNeRpkrmNZE/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/merchkit/u9Xu7zNeRpkrmNZE/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/merchkit/u9Xu7zNeRpkrmNZE/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/merchkit/u9Xu7zNeRpkrmNZE/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/merchkit/u9Xu7zNeRpkrmNZE/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/merchkit/u9Xu7zNeRpkrmNZE/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/merchkit/u9Xu7zNeRpkrmNZE/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/merchkit/u9Xu7zNeRpkrmNZE/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Upsert a category by your own key - Merchkit\">\u003cmeta data-mint-head property=\"og:description\" content=\"Create-or-update by a customer-named merge key: merge_key names any defined text-family attribute (usually sku) and attributes[merge_key] supplies the value to match — trimmed, case-insensitive. No match → create (201); one match → update (200); more than one match → 409 listing the matching ids. Idempotent for ERP-style pushes: address entities by your key, no UUID mapping table needed. Scope: write:categories.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Merchkit\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.merchkit.com/api-reference/upsert-a-category-by-your-own-key\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://merchkit.mintlify.site/_mintlify/api/og/v2?division=Categories\u0026amp;title=Upsert+a+category+by+your+own+key\u0026amp;description=Create-or-update+by+a+customer-named+merge+key%3A+%60merge_key%60+names+any+defined+text-family+attribute+%28usually+%60sku%60%29+and+%60attributes%5Bmerge_key%5D%60+supplies+the+val\u0026amp;theme=06fd1fad2bb810fd43730d53\u0026amp;signature=d5ac0c66bfd1d748717326fa973cee1e1ef27e14bf6317627d167b030c326fcc\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Upsert a category by your own key - Merchkit\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Create-or-update by a customer-named merge key: merge_key names any defined text-family attribute (usually sku) and attributes[merge_key] supplies the value to match — trimmed, case-insensitive. No match → create (201); one match → update (200); more than one match → 409 listing the matching ids. Idempotent for ERP-style pushes: address entities by your key, no UUID mapping table needed. Scope: write:categories.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://merchkit.mintlify.site/_mintlify/api/og/v2?division=Categories\u0026amp;title=Upsert+a+category+by+your+own+key\u0026amp;description=Create-or-update+by+a+customer-named+merge+key%3A+%60merge_key%60+names+any+defined+text-family+attribute+%28usually+%60sku%60%29+and+%60attributes%5Bmerge_key%5D%60+supplies+the+val\u0026amp;theme=06fd1fad2bb810fd43730d53\u0026amp;signature=d5ac0c66bfd1d748717326fa973cee1e1ef27e14bf6317627d167b030c326fcc\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/merchkit/u9Xu7zNeRpkrmNZE/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Merchkit\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#3E703F\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.merchkit.com/api-reference/upsert-a-category-by-your-own-key\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/upsert-a-category-by-your-own-key.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.merchkit.com/#organization\",\"name\":\"Merchkit\",\"url\":\"https://docs.merchkit.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/merchkit/5CX85y_hfwgKe2-R/logo/light.svg?fit=max\u0026auto=format\u0026n=5CX85y_hfwgKe2-R\u0026q=85\u0026s=44793f2cb04c37defc7d3810d29cca0e\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.merchkit.com#website\",\"name\":\"Merchkit\",\"url\":\"https://docs.merchkit.com\",\"publisher\":{\"@id\":\"https://docs.merchkit.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.merchkit.com/api-reference/upsert-a-category-by-your-own-key#webpage\",\"url\":\"https://docs.merchkit.com/api-reference/upsert-a-category-by-your-own-key\",\"name\":\"Upsert a category by your own key\",\"description\":\"Create-or-update by a customer-named merge key: merge_key names any defined text-family attribute (usually sku) and attributes[merge_key] supplies the value to match — trimmed, case-insensitive. No match → create (201); one match → update (200); more than one match → 409 listing the matching ids. Idempotent for ERP-style pushes: address entities by your key, no UUID mapping table needed. Scope: write:categories.\",\"dateModified\":\"2026-11-13T20:43:26.961Z\",\"isPartOf\":{\"@id\":\"https://docs.merchkit.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.merchkit.com/api-reference/upsert-a-category-by-your-own-key#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.merchkit.com/api-reference/upsert-a-category-by-your-own-key#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API Reference\",\"item\":\"https://docs.merchkit.com/api-reference/list-products\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Catalog\",\"item\":\"https://docs.merchkit.com/api-reference/list-products\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Categories\",\"item\":\"https://docs.merchkit.com/api-reference/list-categories\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Upsert a category by your own key\",\"item\":\"https://docs.merchkit.com/api-reference/upsert-a-category-by-your-own-key\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.merchkit.com/api-reference/upsert-a-category-by-your-own-key#apireference\",\"headline\":\"Upsert a category by your own key\",\"name\":\"Upsert a category by your own key\",\"description\":\"Create-or-update by a customer-named merge key: merge_key names any defined text-family attribute (usually sku) and attributes[merge_key] supplies the value to match — trimmed, case-insensitive. No match → create (201); one match → update (200); more than one match → 409 listing the matching ids. Idempotent for ERP-style pushes: address entities by your key, no UUID mapping table needed. Scope: write:categories.\",\"url\":\"https://docs.merchkit.com/api-reference/upsert-a-category-by-your-own-key\",\"mainEntityOfPage\":{\"@id\":\"https://docs.merchkit.com/api-reference/upsert-a-category-by-your-own-key#webpage\"},\"dateModified\":\"2026-11-13T20:43:26.961Z\",\"publisher\":{\"@id\":\"https://docs.merchkit.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.merchkit.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Merchkit\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Merchkit\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/upsert-a-category-by-your-own-key.md","siteName":"Merchkit","nav":{"global":{"anchors":[{"anchor":"merchkit.com","icon":"house","href":"https://www.merchkit.com"}]},"tabs":[{"tab":"Product","pages":[{"title":"Product","href":""}]},{"tab":"API \u0026 MCP","groups":[{"group":"Guides","pages":[{"title":"API Overview","href":"/developers/overview"},{"title":"Authentication","href":"/developers/authentication"},{"title":"Conventions","href":"/developers/conventions"},{"title":"Errors","href":"/developers/errors"},{"title":"MCP Server","href":"/developers/mcp"}]},{"group":"API Reference","pages":[{"group":"Catalog","pages":[{"group":"Products","pages":[{"title":"List products","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /products","href":"/api-reference/list-products"},{"title":"Create a product","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /products","href":"/api-reference/create-a-product"},{"title":"Get a product","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /products/{id}","href":"/api-reference/get-a-product"},{"title":"Update a product","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi patch /products/{id}","href":"/api-reference/update-a-product"},{"title":"Upsert a product by your own key","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /products/upsert","href":"/api-reference/upsert-a-product-by-your-own-key"},{"title":"Batch create/upsert products","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /products/batch","href":"/api-reference/batch-createupsert-products"},{"title":"List a product's variants","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /products/{id}/variants","href":"/api-reference/list-a-products-variants"},{"title":"List a product's references, with positions","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /products/{id}/references","href":"/api-reference/list-a-products-references-with-positions"}]},{"group":"Images","pages":[{"title":"List images","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /images","href":"/api-reference/list-images"},{"title":"Create an image","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /images","href":"/api-reference/create-an-image"},{"title":"Get an image","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /images/{id}","href":"/api-reference/get-an-image"},{"title":"Update an image","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi patch /images/{id}","href":"/api-reference/update-an-image"},{"title":"Upsert an image by your own key","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /images/upsert","href":"/api-reference/upsert-an-image-by-your-own-key"},{"title":"Batch create/upsert images","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /images/batch","href":"/api-reference/batch-createupsert-images"}]},{"group":"Vendors","pages":[{"title":"List vendors","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /vendors","href":"/api-reference/list-vendors"},{"title":"Create a vendor","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /vendors","href":"/api-reference/create-a-vendor"},{"title":"Get a vendor","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /vendors/{id}","href":"/api-reference/get-a-vendor"},{"title":"Update a vendor","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi patch /vendors/{id}","href":"/api-reference/update-a-vendor"},{"title":"Upsert a vendor by your own key","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /vendors/upsert","href":"/api-reference/upsert-a-vendor-by-your-own-key"},{"title":"Batch create/upsert vendors","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /vendors/batch","href":"/api-reference/batch-createupsert-vendors"}]},{"group":"Categories","pages":[{"title":"List categories","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /categories","href":"/api-reference/list-categories"},{"title":"Create a category","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /categories","href":"/api-reference/create-a-category"},{"title":"Get a category","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /categories/{id}","href":"/api-reference/get-a-category"},{"title":"Update a category","description":"THE one write path: set attribute values and/or move the parent in a single call (provide `parent_id`, `attributes`, or both). Writes are symmetric with reads — a GET response's `attributes` re-sent verbatim is valid (`{id, type, label}` stubs are accepted; extra stub fields ignored). `null` or `\"\"` clears a value (the key then disappears from reads); list-reference writes REPLACE the current set. Returns the full updated resource.\n\nScope: `write:categories`.","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi patch /categories/{id}","href":"/api-reference/update-a-category"},{"title":"Upsert a category by your own key","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /categories/upsert","href":"/api-reference/upsert-a-category-by-your-own-key"},{"title":"Batch create/upsert categories","description":"Up to 100 items in one call. With `merge_key`, every item gets upsert semantics (create-or-update by that key); without it, pure creates. Items are processed independently and the response is PER-ITEM: **HTTP 200 does NOT mean every item succeeded** — check each `status` (`created` | `updated` | `error`) and surface `error.message`/`error.field_errors` for failures. A 5,000-SKU ERP delta push is 50 calls with `merge_key: \"sku\"`.\n\nScope: `write:categories`.","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /categories/batch","href":"/api-reference/batch-createupsert-categories"}]},{"group":"Sources","pages":[{"title":"List sources","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /sources","href":"/api-reference/list-sources"},{"title":"Create a source (async)","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /sources","href":"/api-reference/create-a-source-async"},{"title":"Get a source","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /sources/{id}","href":"/api-reference/get-a-source"},{"title":"Update a source","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi patch /sources/{id}","href":"/api-reference/update-a-source"}]}]},{"group":"Schema \u0026 configuration","pages":[{"title":"List attribute definitions (schema discovery)","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /attributes","href":"/api-reference/list-attribute-definitions-schema-discovery"},{"title":"Create an attribute definition","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi post /attributes","href":"/api-reference/create-an-attribute-definition"},{"title":"Get one attribute definition","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /attributes/{key}","href":"/api-reference/get-one-attribute-definition"},{"title":"Update an attribute definition","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi patch /attributes/{key}","href":"/api-reference/update-an-attribute-definition"},{"title":"List enabled channels","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /channels","href":"/api-reference/list-enabled-channels"}]},{"group":"Channel readiness","pages":[{"title":"Check completeness for a channel","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /products/{id}/completeness","href":"/api-reference/check-completeness-for-a-channel"}]},{"group":"Sync \u0026 monitoring","pages":[{"title":"Workspace change feed","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /events","href":"/api-reference/workspace-change-feed"},{"title":"List a product's change events","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /products/{id}/events","href":"/api-reference/list-a-products-change-events"},{"title":"List recent jobs","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /jobs","href":"/api-reference/list-recent-jobs"},{"title":"Poll an async job","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /jobs/{id}","href":"/api-reference/poll-an-async-job"}]},{"group":"Spec","pages":[{"title":"This OpenAPI document","deprecated":null,"version":null,"openapi":"https://www.merchkit.com/api/v1/openapi get /openapi","href":"/api-reference/this-openapi-document"}]}]}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog"}]}]},"basePath":"","title":"Upsert a category by your own key - Merchkit","buildId":"dpl_G2Qd45vZZ7MkBiGF9yYx8ZsbbKXX","deploymentId":"dpl_G2Qd45vZZ7MkBiGF9yYx8ZsbbKXX","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-NXj-Rqjv.js","utils-m0thOP-_.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-D13EKcfm.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema--XTdfsEb.js","snippetPresets-D3s4lmAH.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-ChURybxL.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-DL8CiXq2.js","shallow-DI2-YB2E.js","getApiPlaygroundDisplay-DxbW7b_y.js","CodeSnippet-CiNYS0pP.js","CodeSnippets-BT87bThu.js","Page-DSpdRuhM.js","getPastedJson-F_g_IrFQ.js","icon-CCIG5BAs.js","MethodPill-DY3E0jwx.js","DuplicateIcon-BN88xnEg.js","createIcon-VCCc5HO5.js","DynamicMarkdown-CaSwclgK.js","SectionHeading-DXV8nWhc.js","axios-vUo_bRtp.js","Markdown-CV32Re6G.js","clsx-5ydLOnhV.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-pFDdfjRe.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-BUGO5bPJ.js"]}