Auth: X-Agent-Key: sq_agt_*. Scopes: read_metafields, write_metafields. A metafield is (owner_type, owner_id, namespace, key) → typed value. Owner types: product, variant, order, customer, collection, location, draft_order, shop. Types: single_line_text_field, multi_line_text_field, number_integer, number_decimal, boolean, json, date, date_time, url, color, money, rating.

Endpoints

  • POST /metafields — upsert { "owner_type":"product","owner_id":"prod_…","namespace":"specs","key":"material","type":"single_line_text_field","value":"cotton" }
  • GET /metafields?owner_type=&owner_id= · GET /metafields/{id} · DELETE /metafields/{id}
  • POST /metafield_definitions — typed schema + validations (min/max, length, choices) · GET /metafield_definitions?owner_type= · DELETE /metafield_definitions/{id}
Values are validated against their type and against any matching definition’s validations. Emits metafields/update.