# Metafield definitions

Discover available custom-data fields, their types, access rules, and value limits.

Discover the custom-data definitions available to your token before reading or writing values. Choose an `owner_type` and use its resource read scope. Values are addressed by `namespace` and `key` on the owning resource. Your token's scopes and each definition's access rules determine which entries are returned. App tokens can read their own definitions, merchant definitions within their granted resource scopes, and definitions shared by other apps. Apps can write values only for their own definitions.

The Store API never creates, changes or deletes definitions: app-owned definitions come from the app's metafield declaration, and merchants manage their own in Store Admin, the mobile app, or a connected AI tool (hosted Store MCP `create_metafield_definition`, `update_metafield_definition`, `delete_metafield_definition`). Use the returned type, validation rules, `max_value_length`, and `max_list_items` when preparing values. Numeric strings preserve precision across clients. Datetime values accept RFC 3339 offsets; values without an offset use the store timezone. A datetime value is stored in UTC and returned as RFC 3339 in the store's time zone with its offset, such as `2026-10-01T00:45:00-04:00`, by the Store API, MCP tools and webhooks alike; a date value stays a date (`2026-10-01`). Record timestamps such as `created_at` and `updated_at` are RFC 3339 in the store's time zone with its offset. Assigning a nonempty `file_reference` or `list.file_reference` additionally requires `read_files`.

Follow returned cursors unchanged, and restart pagination when the owner or token changes. App-owned definitions are declared through the app's metafield configuration; see **App metafields** in the apps documentation.

Select definitions (`single_select`, `list.single_select`) store choice keys and show each choice's label to shoppers. When the definition is translatable, translate each label once per locale with the choice translation endpoints on [Metafield definition translations](/store-api/translations/metafield-definitions); that translation covers every resource storing the choice. These endpoints also require the translations scope and the definition owner's read scope.

A definition's name is the label shoppers see next to its value, for example in the platform metafield block. Translate names per locale with the definition name endpoints on [Metafield definition translations](/store-api/translations/metafield-definitions), one definition at a time or up to 100 per call. Names of definitions the merchant can edit (`merchant_access` `read_write`, which includes every merchant-owned definition) are translatable; app tokens translate only their own. Translation CSV (`metafield_definition`) and Store Admin translate the same names. Name and choice label translations send no webhooks.

## Endpoints

## List metafield definitions

`GET /api/2025-01/metafield-definitions`

Read-only discovery uses the same access rules as metafield value reads. `tpat_` and `tast_` tokens see merchant-owned definitions, all definitions owned by their app, and definitions owned by another app only when `app_access` is `shared` (a definition hidden from merchants is always private to its app). A `tsat_` token sees merchant-owned definitions and app-owned definitions unless `merchant_access` is `hidden`. `owner_type` selects the owner surface and its matching read scope. The Store API does not create, change or delete definitions: app-owned definitions come only from the app's reviewed declaration, and merchants create, edit and delete their own definitions in Store Admin, the Tringify mobile app, or a connected AI tool (the hosted Store MCP tools `create_metafield_definition`, `update_metafield_definition` and `delete_metafield_definition`). Definition names and select choice labels are translatable here. When a definition sets `max_value_length` or `max_list_items`, those caps are enforced on every value write; tightening them in Store Admin is blocked while stored values still exceed the new limit.

### Value rules by type

Values are checked against their definition's type on every write. `null` or an empty string removes the stored value.

| Type | Accepted value |
| --- | --- |
| `string` | Any text up to the platform string limit. The definition may add `min_length` and an RE2 `pattern` (at most 500 characters). |
| `multi_line_text` | Text with line breaks, up to 10,000 characters. Line breaks are stored as `\n`; tabs are allowed, other control characters are not. |
| `rich_text` | HTML as the page and blog editor writes it: headings, paragraphs, bold, italic, links (http, https, mailto), lists, quotes, images and tables. Scripts, event handlers, frames and other link schemes are removed when it is stored. Its readable text is at most 10,000 characters, and the markup counts toward the platform value size limit. A value with no readable text removes the stored value. |
| `color` | `#` and six hex digits (`#1a2b3c`), stored lowercase. |
| `integer` | A whole number in the signed 64-bit range, up to the platform integer digit limit, within the definition's `min` and `max`. |
| `decimal` | A finite decimal number up to the platform decimal length limit (counted written out in full, so an exponent cannot exceed it), within the definition's `min` and `max`. |
| `boolean` | `true` or `false`. |
| `date` | `YYYY-MM-DD`. |
| `datetime` | `YYYY-MM-DDTHH:mm`, `YYYY-MM-DDTHH:mm:ss`, or an RFC 3339 timestamp. |
| `json` | Valid JSON up to the platform JSON size limit. Links inside it must use http, https, mailto or tel. |
| `url` | An absolute `http` or `https` URL with a host, up to the platform URL limit. |
| `single_select` | One of the definition's choice keys. |
| `file_reference` | The UUID of an uploaded file in this store. |
| `product_reference`, `variant_reference` | The positive integer ID of a product or variant in this store. |
| `page_reference`, `blog_post_reference`, `collection_reference` | The UUID of a page, blog post or collection in this store. Deleting the page, post or collection removes it from every value that references it. |
| `list.string` | A JSON array of non-blank strings, each up to the platform string limit. It may be empty. The definition may add `min_length` and an RE2 `pattern` (at most 500 characters), checked against every item; `max_value_length` caps each item. |
| `list.url` | A non-empty JSON array of `url` values, up to the platform list.url item limit, which is higher than the other lists' limit. |
| `list.single_select` | A non-empty JSON array of choice keys. |
| `list.file_reference` | A non-empty JSON array of `file_reference` values. |
| `list.color` | A non-empty JSON array of `color` values. |
| `list.product_reference`, `list.variant_reference` | A non-empty JSON array of positive integer IDs in this store. |
| `list.page_reference`, `list.blog_post_reference`, `list.collection_reference` | A non-empty JSON array of page, blog post or collection UUIDs in this store. |
| `metaobject_reference` | The UUID of a custom content entry of the type the definition's `validation_rules.metaobject_definition_id` names. Deleting the entry removes it from every value that references it. |
| `list.metaobject_reference` | A non-empty JSON array of at most 50 entry UUIDs of that type. |

Lists other than `list.url` hold at most the platform list item limit, and every value stays within the platform value size limit for its type. Duplicate list items are stored once. A definition's `max_value_length` and `max_list_items` can only lower these limits.

`cart_line` and `wishlist_line` values are written only by the storefront and App Bridge; the Store API has no endpoint that sets them. Staff-created merchant tokens listing store definitions additionally require settings.metafield_definitions:read.

Scope: `The read scope required by owner_type`

```curl
curl 'https://api-store.tringify.com/api/2025-01/metafield-definitions' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN"
```

Response:

```json
{
  "data": {
    "definitions": [
      {
        "app_access": "shared",
        "capabilities": {
          "allowed": true,
          "buyer_access": false,
          "filterable": false,
          "searchable": true,
          "storefront_visible": true,
          "translation": "value"
        },
        "description": "Primary material of the product.",
        "is_filterable": false,
        "is_searchable": true,
        "is_storefront_visible": true,
        "is_translatable": true,
        "key": "material",
        "max_list_items": null,
        "max_value_length": 128,
        "merchant_access": "read_write",
        "name": "Material",
        "namespace": "specs",
        "owned_by": "merchant",
        "owner_type": "product",
        "type": "string",
        "validation_rules": null
      }
    ],
    "has_next": false,
    "has_previous": false,
    "limit": 50,
    "total": 1
  },
  "success": true
}
```

## Webhook events

## Metafield definition created

Event: `metafield_definitions/create` · Staff permission: `settings.metafield_definitions:write`

Fired when a metafield definition is created, including by a theme install. Store webhook endpoints receive every definition; an app receives only the definitions it owns.

```json
{
  "metafield_definition": {
    "app_access": "shared",
    "app_id": null,
    "buyer_access": "hidden",
    "created_at": "2026-06-01T10:00:00-04:00",
    "description": "How to wash and store the product.",
    "id": "91ac33ac-1e56-43f9-9280-a541ff762f74",
    "is_filterable": false,
    "is_searchable": false,
    "is_storefront_visible": true,
    "is_translatable": true,
    "key": "care",
    "max_list_items": null,
    "max_value_length": 500,
    "merchant_access": "read_write",
    "name": "Care instructions",
    "namespace": "details",
    "owner_type": "product",
    "sort_order": 0,
    "type": "string",
    "updated_at": "2026-06-10T09:30:00-04:00",
    "validation_rules": null
  }
}
```

## Metafield definition deleted

Event: `metafield_definitions/delete` · Staff permission: `settings.metafield_definitions:write`

Fired when a metafield definition is deleted, including when its app is uninstalled. Store webhook endpoints receive every definition; an app receives only the definitions it owns.

```json
{
  "metafield_definition": {
    "app_access": "shared",
    "app_id": null,
    "buyer_access": "hidden",
    "created_at": "2026-06-01T10:00:00-04:00",
    "description": "How to wash and store the product.",
    "id": "91ac33ac-1e56-43f9-9280-a541ff762f74",
    "is_filterable": false,
    "is_searchable": false,
    "is_storefront_visible": true,
    "is_translatable": true,
    "key": "care",
    "max_list_items": null,
    "max_value_length": 500,
    "merchant_access": "read_write",
    "name": "Care instructions",
    "namespace": "details",
    "owner_type": "product",
    "sort_order": 0,
    "type": "string",
    "updated_at": "2026-06-10T09:30:00-04:00",
    "validation_rules": null
  }
}
```

## Metafield definition updated

Event: `metafield_definitions/update` · Staff permission: `settings.metafield_definitions:write`

Fired when a metafield definition changes. `changed_fields` names what changed. When turning off translation deletes the definition's translations, `translations_deleted` is how many were deleted; no per-translation events are sent. Store webhook endpoints receive every definition; an app receives only the definitions it owns.

```json
{
  "changed_fields": [
    "is_translatable"
  ],
  "metafield_definition": {
    "app_access": "shared",
    "app_id": null,
    "buyer_access": "hidden",
    "created_at": "2026-06-01T10:00:00-04:00",
    "description": "How to wash and store the product.",
    "id": "91ac33ac-1e56-43f9-9280-a541ff762f74",
    "is_filterable": false,
    "is_searchable": false,
    "is_storefront_visible": true,
    "is_translatable": false,
    "key": "care",
    "max_list_items": null,
    "max_value_length": 500,
    "merchant_access": "read_write",
    "name": "Care instructions",
    "namespace": "details",
    "owner_type": "product",
    "sort_order": 0,
    "type": "string",
    "updated_at": "2026-06-10T09:30:00-04:00",
    "validation_rules": null
  },
  "translations_deleted": 12
}
```

