Metafield
Private Metafield API endpoints
Retrieves a paginated list of shop's metadata.
Query parameters
pageoptionalintegerPage number for pagination
per_pageoptionalintegerEntities per page
idsoptionalinteger[]Filter by metadata by IDs. Values must be unique.
slugsoptionalstring[]Filter by metadata by slugs. Values must be unique.
presetoptionalbooleanFilter by metadata preset
variantoptionalbooleanFilter by metadata variant type
sort[field]optionalstringField to sort by. Required whenever any sort key is sent.
Possible values: id, name.
sort[direction]optionalstringSort direction; defaults to asc.
Possible values: asc, desc.
Defaults to "asc".
Returnsobject
Successful response
Error responses
422objectA query parameter failed validation: ids or slugs is not an array, an ID is not an integer, a slug is longer than 255 characters, page is below 1, per_page is outside 1 to 100, preset or variant is not a boolean, sort[direction] comes without sort[field], or the sort field or direction is unknown.
Request body
nameRequiredstringMetadata name. Must not slugify to a value ending in subbly-variant; that suffix is reserved.
descriptionoptionalstring | nullFreeโform description
multipleoptionalbooleanAllow multiple values. May only be true when data_type is one of single_line_string, integer, decimal, datetime, date, time, volume, weight, color, url. Otherwise the request is rejected.
data_typeRequiredstringData type for the metadata
Possible values: single_line_string, multi_line_text, rich_text, integer, decimal, datetime, date, time, volume, weight, boolean, color, rating, url, money, json.
access_levelRequiredstringWho can see/use this metadata
Possible values: storefront, private.
presetoptionalbooleanValues come from a preset list. May only be true when data_type is one of single_line_string, color, time, integer, rating, decimal, money, volume, weight, date, datetime. Otherwise the request is rejected.
unitoptionalstringUnit label. Required when data_type is volume or weight; prohibited (422) for every other data_type.
save_behavioroptionalstringSave behavior for the metadata. Defaults to subscription.
Possible values: customer, subscription.
editableoptionalbooleanWhether the metadata value is editable by the customer. Defaults to true.
valuesoptionalobject[] | nullList of allowed values (when preset is true)
ReturnsMetadata
Metadata created successfully
Error responses
422objectname is missing, not a string, or slugifies to a value that ends in subbly-variant (The name should not end with "subbly-variant".); data_type or access_level is missing or unknown; save_behavior is unknown; multiple or preset is true for a data type that does not support it (The multiple is invalid., The preset is invalid.); unit is missing for volume or weight, or sent for any other data type; values is sent without preset, holds duplicates, or holds a value that does not fit the data type; or a values[].value is missing.
Partially updates the metadata and its values by metadata slug. Variant metafields cannot be updated; the request is rejected with 403.
Path parameters
metafield_slugRequiredstringThe unique slug of the metadata to update
Request body
Fields to update on the metadata
nameoptionalstringNew name of the metadata. Must not slugify to a value ending in subbly-variant; that suffix is reserved.
descriptionoptionalstring | nullDetailed description
access_leveloptionalstringAccess scope for the metadata
Possible values: storefront, private.
unitoptionalstringUnit of measurement. Required on every update request when the metafield's data_type is volume or weight (resend the current value if unchanged); prohibited for all other data types.
save_behavioroptionalstringSave behavior for the metadata.
Possible values: customer, subscription.
editableoptionalbooleanWhether the metadata value is editable by the customer.
valuesoptionalobject | nullOperations on preset values
ReturnsMetadata
Metadata updated successfully
Error responses
400objectThe metafield belongs to another shop, or is a variant metafield and therefore not updatable.