Skip to main content
POST
Create Metafield Definition

Create Metafield Definition

Admin API only — requires a merchant JWT. Not exposed to OAuth apps.
Creates the schema (type + validations + label) for a metafield. Once a definition exists, all writes to (ownerType, namespace, key) are validated against it.

Request

Auth

Merchant JWT (owner, or staff with admin/manager access).

Body parameters

string
required
Namespace (e.g. custom, your app handle, or anything else).
string
required
Machine name. Unique per (storeId, ownerType, namespace).
string
required
Human label shown in the admin UI.
string
required
One of the 22 supported types.
string
required
One of the 9 owner types.
string
Tooltip / helper text shown in admin.
object
Type-dependent validation rules. See validation rules per type.
boolean
default:"false"
If true, the field appears on the resource detail page in admin without the merchant having to click “Add custom data”.

Examples

Number with bounds

Single-line text with regex

List of references

URL with restricted schemes

Response

Error codes