Create definition
/ admin/ v1/ stores/ {store_id}/ metafield-definitions- settings:write
- Idempotency-Key supported
Add a definition.
Path parameters
store_idstringrequiredThe store's ID, like
store_01k8qs5s…. Apps get it with the install, in the OAuth redirect and the token response.
Headers
Idempotency-KeystringSend the same key to retry safely: the first answer is replayed for 24 hours.
shop-api-versionYYYY-MMThe version to answer in. Without it, your app’s pinned version, else the newest.
Body
owner_typeenumrequiredWhat a metafield belongs to.
- product
- variant
- collection
- customer
- order
- store
keystringrequiredtypestringrequiredsingle_line_text,multi_line_text,integer,decimal,boolean,date,date_time,url,color,json,product_reference,variant_reference,collection_reference,file_reference; most also aslist.…. Fixed once created.namestringrequirednamespacestring · or nullDefault
custom.descriptionstring · or nullvalidationsobjectOptional rules a definition puts on its values (on each item of a list).
storefrontbooleanshopper_editablebooleanThe signed-in shopper sets it from their account: customers' fields that storefronts read, of a type a shopper can type or pick.
Returns
201 Created.
Errors
- 403
forbiddenMissingsettings:write. - 409The identifier is taken (
identifier_taken), or the owner type has 200 definitions (limit_reached). - 422
validation_failedValidation failed.