# Update attribute metadata `PATCH /catalog/v1/{catalog_id}/types/{object_type}/attribute-metadata` Merge metadata into one or more of an object type's attributes, and read back what they now hold. Every level merges: an attribute, a value or a key the request leaves out is unchanged, and `null` clears the one it names, so `"metadata": null, "values": null` removes all of an attribute's metadata. An attribute the request sets a key on must be one the object type has — a registered `@` slot, or a name the catalog's last ingest inferred on that type — so metadata can only be set once an ingest has delivered the object type. An object type the catalog does not have is refused with `catalog_type_unknown`. Each item names the `version` its change is based on, or `null` for an attribute that carries no metadata yet. Every item applies or none does: if any version is no longer current, nothing changes and the `412` names each stale item by its index. The response carries every attribute the request named that holds metadata afterwards, as `list_catalog_attribute_metadata` returns it; one the request emptied is omitted. ## Request example ```bash curl --request PATCH \ --url 'https://api.eu1.luigisbox.ai/catalog/v1//types//attribute-metadata' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "items": [] }' ``` ## Path Parameters | Name | Type | Required | Description | Constraints | |---|---|---|---|---| | `catalog_id` | `string` | Yes | Catalog Id | — | | `object_type` | `string` | Yes | The object type, such as `product`. | >= 1 characters; <= 64 characters; /^[^/:\s\x00]+$/ | ## Request Body **Required.** ### application/json Schema: `AttributeMetadataBatchUpdate` #### Attributes | Attribute | Type | Required | Description | Constraints | |---|---|---|---|---| | `items` | `Array` | No | The attributes to change, each naming the version it is based on. At most 100 attributes and 500 value entries across them per request. | <= 100 items | | `items[].attribute_name` | `string` | Yes | The catalog attribute to change. | >= 1 characters; <= 256 characters; /^[^\x00]*$/ | | `items[].metadata` | `anyOf(AttributeMetadataMapUpdate, null)` | No | Changes to the attribute's own metadata. `null` clears the whole map; omit it to leave the map unchanged. | — | | `items[].metadata.color` | `anyOf(string, null)` | No | Hex color, `#RGB` or `#RRGGBB`, stored as sent. `null` clears it. | — | | `items[].metadata.currency` | `anyOf(string, null)` | No | Uppercase ISO 4217 currency code, e.g. `EUR`. `null` clears it. | — | | `items[].metadata.image_url` | `anyOf(string, null)` | No | Absolute `https` URL of an image, at most 2048 characters, in standard form — lowercase host, no default port, a path of at least `/`, any character a URL cannot hold percent-encoded — and stored as sent. `null` clears it. | — | | `items[].metadata.label` | `anyOf(string, null)` | No | Display name. `null` clears it. | — | | `items[].metadata.unit` | `anyOf(string, null)` | No | Unit of measure, e.g. `cm`. `null` clears it. | — | | `items[].metadata.*` | `anyOf(string, integer, number, null)` | No | Additional property. | — | | `items[].values` | `anyOf(object, null)` | No | Changes to the metadata of the attribute's raw values, keyed by the value exactly as the catalog holds it. A `null` entry removes that value's metadata; `null` for the whole map removes every value's metadata. Values left out are unchanged. | — | | `items[].values.*` | `anyOf(AttributeValueMetadataUpdate, null)` | No | Additional property. | — | | `items[].values.*.metadata` | `anyOf(AttributeMetadataMapUpdate, null)` | No | Changes to the value's metadata. `null` clears the whole map, removing the value; omit it to leave the value unchanged. | — | | `items[].values.*.metadata.color` | `anyOf(string, null)` | No | Hex color, `#RGB` or `#RRGGBB`, stored as sent. `null` clears it. | — | | `items[].values.*.metadata.currency` | `anyOf(string, null)` | No | Uppercase ISO 4217 currency code, e.g. `EUR`. `null` clears it. | — | | `items[].values.*.metadata.image_url` | `anyOf(string, null)` | No | Absolute `https` URL of an image, at most 2048 characters, in standard form — lowercase host, no default port, a path of at least `/`, any character a URL cannot hold percent-encoded — and stored as sent. `null` clears it. | — | | `items[].values.*.metadata.label` | `anyOf(string, null)` | No | Display name. `null` clears it. | — | | `items[].values.*.metadata.unit` | `anyOf(string, null)` | No | Unit of measure, e.g. `cm`. `null` clears it. | — | | `items[].values.*.metadata.*` | `anyOf(string, integer, number, null)` | No | Additional property. | — | | `items[].version` | `anyOf(integer, null)` | Yes | The attribute's `version` this change is based on, or `null` for an attribute read as carrying no metadata. Either one no longer current answers `412` with the current version. | format: int64 | #### Request body example ```json { "items": [] } ``` ## Responses | Status | Description | Content | |---|---|---| | `200` | Successful Response | application/json: AttributeMetadataList | | `401` | Missing or invalid credentials | application/json: ErrorResponse | | `403` | Authenticated but not permitted | application/json: ErrorResponse | | `404` | Resource not found | application/json: ErrorResponse | | `412` | Version not current | application/json: BatchPreconditionFailedResponse | | `422` | Request validation failed | application/json: AttributeMetadataValidationError | | `503` | Service temporarily unavailable | application/json: ErrorResponse | ### 200 Successful Response #### application/json Schema: `AttributeMetadataList` ##### Attributes | Attribute | Type | Required | Description | Constraints | |---|---|---|---|---| | `items` | `Array` | Yes | Every attribute the request named that carries metadata afterwards, in the order the request named them. An attribute left with no metadata is omitted. | — | | `items[].attribute_name` | `string` | Yes | The catalog attribute. | — | | `items[].metadata` | `object` | Yes | The attribute's own metadata; empty when only its values carry metadata. | — | | `items[].metadata.*` | `anyOf(string, integer, number)` | No | Additional property. | — | | `items[].value_count` | `integer` | Yes | How many of the attribute's raw values carry metadata. | — | | `items[].values` | `object` | Yes | Every one of the attribute's raw values that carries metadata, keyed by the value exactly as the catalog holds it, in the shape a write sends it; empty when none does. | — | | `items[].values.*` | `RawValueMetadata` | No | Additional property. | — | | `items[].values.*.metadata` | `object` | Yes | The value's metadata. | — | | `items[].values.*.metadata.*` | `anyOf(string, integer, number)` | No | Additional property. | — | | `items[].version` | `integer` | Yes | Changes on every change to the attribute's metadata, at either level. Send it back in an item's `version` to change the attribute. | format: int64; >= 1; read-only | ##### Response example ```json { "items": [ { "attribute_name": "material", "metadata": { "label": "Material" }, "value_count": 1, "values": { "Stainless steel": { "metadata": { "color": "#C0C0C0", "label": "Steel" } } }, "version": 41 } ] } ``` ### 401 Missing or invalid credentials #### application/json Schema: `ErrorResponse` ##### Attributes | Attribute | Type | Required | Description | Constraints | |---|---|---|---|---| | `exception_details` | `ExceptionDetails` | No | Machine-readable error context; empty object when there is nothing to add. | — | | `exception_details.error_code` | `string` | No | Stable machine code naming why a well-formed request was refused: snake_case, prefixed by its domain — e.g. `filter_unknown_field` or `cursor_mismatch`. Safe to branch on; `reason` is not. Absent when the status code says all there is to say. | — | | `exception_details.validation_errors` | `Array` | No | Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value. | — | | `exception_details.validation_errors[].loc` | `Array` | Yes | Path to the offending value from the request root, e.g. `["body", "filters", 0, "operator"]`. | — | | `exception_details.validation_errors[].msg` | `string` | Yes | What is wrong with the value at `loc`. | — | | `exception_details.validation_errors[].type` | `string` | Yes | Stable machine code for the problem, e.g. `missing` or `string_too_short`. | — | | `exception_details.*` | `any` | No | Additional property. | — | | `reason` | `string` | Yes | Human-readable, actionable error message. | — | | `request_id` | `anyOf(string, null)` | No | Request correlation ID (matches the X-Request-Id response header). | — | ##### Response example ```json { "exception_details": { "error_code": "example", "validation_errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ] }, "reason": "example", "request_id": "example" } ``` ### 403 Authenticated but not permitted #### application/json Schema: `ErrorResponse` ##### Attributes | Attribute | Type | Required | Description | Constraints | |---|---|---|---|---| | `exception_details` | `ExceptionDetails` | No | Machine-readable error context; empty object when there is nothing to add. | — | | `exception_details.error_code` | `string` | No | Stable machine code naming why a well-formed request was refused: snake_case, prefixed by its domain — e.g. `filter_unknown_field` or `cursor_mismatch`. Safe to branch on; `reason` is not. Absent when the status code says all there is to say. | — | | `exception_details.validation_errors` | `Array` | No | Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value. | — | | `exception_details.validation_errors[].loc` | `Array` | Yes | Path to the offending value from the request root, e.g. `["body", "filters", 0, "operator"]`. | — | | `exception_details.validation_errors[].msg` | `string` | Yes | What is wrong with the value at `loc`. | — | | `exception_details.validation_errors[].type` | `string` | Yes | Stable machine code for the problem, e.g. `missing` or `string_too_short`. | — | | `exception_details.*` | `any` | No | Additional property. | — | | `reason` | `string` | Yes | Human-readable, actionable error message. | — | | `request_id` | `anyOf(string, null)` | No | Request correlation ID (matches the X-Request-Id response header). | — | ##### Response example ```json { "exception_details": { "error_code": "example", "validation_errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ] }, "reason": "example", "request_id": "example" } ``` ### 404 Resource not found #### application/json Schema: `ErrorResponse` ##### Attributes | Attribute | Type | Required | Description | Constraints | |---|---|---|---|---| | `exception_details` | `ExceptionDetails` | No | Machine-readable error context; empty object when there is nothing to add. | — | | `exception_details.error_code` | `string` | No | Stable machine code naming why a well-formed request was refused: snake_case, prefixed by its domain — e.g. `filter_unknown_field` or `cursor_mismatch`. Safe to branch on; `reason` is not. Absent when the status code says all there is to say. | — | | `exception_details.validation_errors` | `Array` | No | Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value. | — | | `exception_details.validation_errors[].loc` | `Array` | Yes | Path to the offending value from the request root, e.g. `["body", "filters", 0, "operator"]`. | — | | `exception_details.validation_errors[].msg` | `string` | Yes | What is wrong with the value at `loc`. | — | | `exception_details.validation_errors[].type` | `string` | Yes | Stable machine code for the problem, e.g. `missing` or `string_too_short`. | — | | `exception_details.*` | `any` | No | Additional property. | — | | `reason` | `string` | Yes | Human-readable, actionable error message. | — | | `request_id` | `anyOf(string, null)` | No | Request correlation ID (matches the X-Request-Id response header). | — | ##### Response example ```json { "exception_details": { "error_code": "example", "validation_errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ] }, "reason": "example", "request_id": "example" } ``` ### 412 Version not current #### application/json Schema: `BatchPreconditionFailedResponse` ##### Attributes | Attribute | Type | Required | Description | Constraints | |---|---|---|---|---| | `exception_details` | `BatchPreconditionFailedDetails` | Yes | Why the write was refused, and the current version of every stale item. | — | | `exception_details.error_code` | `string` | Yes | At least one item named a version its resource no longer has. | allowed value: entity_version_stale | | `exception_details.stale_items` | `Array` | Yes | Every item whose version is not current. Read those resources again, reapply the changes and resend the whole request. | — | | `exception_details.stale_items[].current_version` | `anyOf(integer, null)` | Yes | The resource's current version, or `null` where it no longer exists. | format: int64 | | `exception_details.stale_items[].index` | `integer` | Yes | The item's position in `items`. | >= 0 | | `reason` | `string` | Yes | Human-readable, actionable error message. | — | | `request_id` | `anyOf(string, null)` | No | Request correlation ID (matches the X-Request-Id response header). | — | ##### Response example ```json { "exception_details": { "error_code": "entity_version_stale", "stale_items": [ { "current_version": 1, "index": 1 } ] }, "reason": "example", "request_id": "example" } ``` ### 422 Request validation failed #### application/json Schema: `AttributeMetadataValidationError` ##### Attributes | Attribute | Type | Required | Description | Constraints | |---|---|---|---|---| | `exception_details` | `AttributeMetadataValidationDetails` | No | The problems found, or why a request with none was refused. | — | | `exception_details.error_code` | `string` | No | `entity_change_empty` when the request names no field to change and has no field-level problems. Absent when `validation_errors` says what failed. | allowed value: entity_change_empty | | `exception_details.validation_errors` | `Array` | No | Every problem found, each naming where in the body it sits. Absent when `error_code` says why the request was refused. | — | | `exception_details.validation_errors[].loc` | `Array` | Yes | Path to the offending value from the request root, e.g. `["body", "filters", 0, "operator"]`. | — | | `exception_details.validation_errors[].msg` | `string` | Yes | What is wrong with the value at `loc`. | — | | `exception_details.validation_errors[].type` | `anyOf(AttributeMetadataProblem, string)` | Yes | Stable machine code for the problem: one of the attribute metadata codes listed here, or a generic one such as `missing` or `string_too_long`. | — | | `exception_details.*` | `any` | No | Additional property. | — | | `reason` | `string` | Yes | Human-readable, actionable error message. | — | | `request_id` | `anyOf(string, null)` | No | Request correlation ID (matches the X-Request-Id response header). | — | ##### Response example ```json { "exception_details": { "error_code": "entity_change_empty", "validation_errors": [ { "loc": [ "example" ], "msg": "example", "type": "catalog_types_unavailable" } ] }, "reason": "example", "request_id": "example" } ``` ### 503 Service temporarily unavailable #### application/json Schema: `ErrorResponse` ##### Attributes | Attribute | Type | Required | Description | Constraints | |---|---|---|---|---| | `exception_details` | `ExceptionDetails` | No | Machine-readable error context; empty object when there is nothing to add. | — | | `exception_details.error_code` | `string` | No | Stable machine code naming why a well-formed request was refused: snake_case, prefixed by its domain — e.g. `filter_unknown_field` or `cursor_mismatch`. Safe to branch on; `reason` is not. Absent when the status code says all there is to say. | — | | `exception_details.validation_errors` | `Array` | No | Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value. | — | | `exception_details.validation_errors[].loc` | `Array` | Yes | Path to the offending value from the request root, e.g. `["body", "filters", 0, "operator"]`. | — | | `exception_details.validation_errors[].msg` | `string` | Yes | What is wrong with the value at `loc`. | — | | `exception_details.validation_errors[].type` | `string` | Yes | Stable machine code for the problem, e.g. `missing` or `string_too_short`. | — | | `exception_details.*` | `any` | No | Additional property. | — | | `reason` | `string` | Yes | Human-readable, actionable error message. | — | | `request_id` | `anyOf(string, null)` | No | Request correlation ID (matches the X-Request-Id response header). | — | ##### Response example ```json { "exception_details": { "error_code": "example", "validation_errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ] }, "reason": "example", "request_id": "example" } ```