Metaobject
Private Metaobject API endpoints (metaobjects and entries)
- GET/metaobjects
- POST/metaobjects
- GET/metaobjects/{metaobject_key}
- PATCH/metaobjects/{metaobject_key}
- DELETE/metaobjects/{metaobject_key}
- GET/metaobjects/{metaobject_key}/entries
- POST/metaobjects/{metaobject_key}/entries
- GET/metaobjects/{metaobject_key}/entries/{handle}
- PATCH/metaobjects/{metaobject_key}/entries/{handle}
- DELETE/metaobjects/{metaobject_key}/entries/{handle}
Retrieves a paginated list of the shop's metaobjects, each with its live fields in order.
Query parameters
pageoptionalintegerPage number for pagination
per_pageoptionalintegerEntities per page
Defaults to 10.
Returnsobject
Successful response
Error responses
422MetaobjectValidationErrorpage is below 1, or per_page is outside 1 to 100.
Creates a metaobject.
Request body
keyRequiredstringUnique within the shop. Can not change.
nameRequiredstringaccess_levelRequiredstringPossible values: storefront, private.
fieldsRequiredMetaobjectFieldBody[]ReturnsMetaobject
Metaobject created
Error responses
422MetaobjectValidationErrorThe body fails validation: key is missing, taken, longer than 64 characters, or not lower-case letters, digits, - and _ that start with a letter; name, access_level or fields is missing or invalid; or a field is invalid (under fields.N.<key>), for example a repeated key, multiple or options on a data type that does not allow them, or an invalid option or rule.
Path parameters
metaobject_keyRequiredstringThe key of the metaobject, unique within the shop.
ReturnsMetaobject
Successful response
Error responses
404objectThe shop has no metaobject with this key.
Updates a metaobject. Send every field in order; list the fields to remove in delete_fields.
Path parameters
metaobject_keyRequiredstringThe key of the metaobject, unique within the shop.
Request body
nameoptionalstringaccess_leveloptionalstringprivate returns 422 while a storefront metafield uses the metaobject. Make those metafields private first.
Possible values: storefront, private.
fieldsoptionalMetaobjectFieldBody[]Every live field, in the new order. A live field left out must be named in delete_fields.
delete_fieldsoptionalstring[]Keys of live fields to delete. Each must be left out of fields. The key is never used again.
ReturnsMetaobject
Metaobject updated
Error responses
404objectThe shop has no metaobject with this key.
422MetaobjectValidationErrorThe body fails validation for the same reasons as on create, or key is sent, fields is empty, a field changes its data type or uses the key of a deleted field, fields leaves out a field that delete_fields does not name, or a delete_fields key is unknown.
Deletes a metaobject that has no entries and no metafields.
Path parameters
metaobject_keyRequiredstringThe key of the metaobject, unique within the shop.
ReturnsMetaobject
Metaobject deleted. The body is the metaobject as it was.
Error responses
404objectThe shop has no metaobject with this key.
422MetaobjectValidationErrorThe metaobject has entries or a metafield uses it. The error sits under errors.metaobject.
Path parameters
metaobject_keyRequiredstringThe key of the metaobject, unique within the shop.
Query parameters
pageoptionalintegerPage number for pagination
per_pageoptionalintegerEntities per page
Defaults to 10.
Returnsobject
Successful response
Error responses
404objectThe shop has no metaobject with this key.
422MetaobjectValidationErrorpage is below 1, or per_page is outside 1 to 100.
Creates an entry.
Path parameters
metaobject_keyRequiredstringThe key of the metaobject, unique within the shop.
Request body
nameRequiredstringThe name of the entry, for lists and pickers.
handleoptionalstring | nullUnique within the metaobject, and never only digits. Made from name when left out, null or "".
fieldsoptionalobjectValues keyed by field key. Each must fit its field's data type, rules and options; a list field takes a list.
ReturnsMetaobjectEntry
Entry created
Error responses
404objectThe shop has no metaobject with this key.
422objectThe body fails validation: name is missing on create or longer than 255 characters, handle is invalid, only digits or taken, fields is not an object, or a value is invalid (under fields.<key>), for example an unknown field, a missing required field or a value that does not fit the field.
Path parameters
metaobject_keyRequiredstringThe key of the metaobject, unique within the shop.
handleRequiredstringThe handle of the entry, unique within its metaobject. It is never only digits.
ReturnsMetaobjectEntry
Successful response
Error responses
404objectThe shop has no metaobject with this key, or the metaobject has no entry with this handle.
Updates an entry. fields is merged into the stored values; null removes a value.
Path parameters
metaobject_keyRequiredstringThe key of the metaobject, unique within the shop.
handleRequiredstringThe handle of the entry, unique within its metaobject. It is never only digits.
Request body
nameoptionalstringThe name of the entry. A new name does not change the handle.
handleoptionalstring | nullNever only digits. null or "" keeps the handle.
fieldsoptionalobjectMerged into the stored values. null, or [] for a list field, removes a value.
ReturnsMetaobjectEntry
Entry updated
Error responses
404objectThe shop has no metaobject with this key, or the metaobject has no entry with this handle.
422objectThe body fails validation: name is missing on create or longer than 255 characters, handle is invalid, only digits or taken, fields is not an object, or a value is invalid (under fields.<key>), for example an unknown field, a missing required field or a value that does not fit the field.
Deletes an entry that nothing uses.
Path parameters
metaobject_keyRequiredstringThe key of the metaobject, unique within the shop.
handleRequiredstringThe handle of the entry, unique within its metaobject. It is never only digits.
ReturnsMetaobjectEntry
Entry deleted. The body is the entry as it was.
Error responses
404objectThe shop has no metaobject with this key, or the metaobject has no entry with this handle.
422objectA value points at the entry. used_by lists the first places found of each kind, not every place.