Skip to content

Catalog Attribute — Update

Updates an existing attribute. Mirrors Catalog → Attributes → Edit in the Bagisto admin panel.

Endpoint

EndpointMethod
/api/admin/catalog/attributes/{id}PUT

{id} must be a positive integer (requirements: ['id' => '\\d+']).

Request body

Same fields as Create, with these rules:

  • code is immutable. Sending a different code returns 422.
  • type cannot be changed if any product attribute value references this attribute. Returns 422.
  • options is a full-set replacement. Entries with an id are updated, entries without id are inserted, and any existing option ids omitted from the payload are deleted.
  • System attributes (is_user_defined = 0) silently ignore immutable fields by convention — only mutable fields (e.g. admin_name, translations) are applied.
  • translations merges per-locale — only the supplied locales are updated; others are untouched.

Response

200 OK returning the full attribute detail — identical shape to GET /api/admin/catalog/attributes/{id}.

Errors

HTTPCause
401 UnauthorizedMissing or invalid Bearer token
404 Not FoundThe attribute does not exist
422 Unprocessable EntityCode change attempted, type change refused, or other validation failure

Released under the MIT License.