# Declare metafields

Choose owner types, keys, types, and access flags in the Developer Portal before review.

Open **Metafields** for the app in the Developer Portal. The owner types shown match the Store API permissions your app currently requests — add a scope on **Permissions** first, then the resource appears here.

## Namespace and keys

Each declaration becomes a live definition under `app:{slug}.{key}` on install. Keys must be unique per `owner_type` within your app. Choose human-readable **Name** and optional **Description** text; merchants see these in Store Admin metafield settings.

## Custom content references

A `metaobject_reference` or `list.metaobject_reference` declaration points at one of your app's own custom content types: name its handle in `metaobject_type`, for example `"metaobject_type": "author"` for the type declared with handle `author` in `declared_metaobjects`. Leave `metaobject_definition_id` out of `validation_rules`; installing the app pins the definition to that type in the store. A reference to a type the store did not take (see [Custom content types](https://dev-docs.tringify.com/apps/metafields/custom-content)) is not added. Merchants' and other apps' types cannot be referenced.

## Scopes and materialization

Declaration validates against your app's requested permissions. **Materialization** on a store additionally requires the merchant to have granted those scopes at install. A declaration for `read_products` does not appear on a store where the merchant denied product access.

## Access and capabilities

Set **App access** (`private` or `shared`) and optional storefront, search, filter, and translation capabilities according to the type's capability matrix. These flags are part of the reviewed contract — they govern which other apps can read values and which merchant or buyer surfaces can read or edit them. Shared app access permits reads; it does not permit another app to write your definitions.

| App access (`app_access`) | What it means |
| --- | --- |
| `private` (Private) | Only your app can read the values through the Store API. Other installed apps cannot read them. |
| `shared` (Shared) | Other installed apps can read the values only when they hold the read permission required for this owner type. Only your app can write them. |

| Merchant access (`merchant_access`) | What it means |
| --- | --- |
| `hidden` (Hidden) | The definition and its values are hidden from merchant metafield pages and resource forms. A hidden metafield is private to your app and never shown on the storefront, so it cannot be shared, storefront visible, searchable, or filterable. |
| `read` (Read) | Merchants can view the app-owned definition and its values, but only your app can change the values. |
| `read_write` (Read & write) | Merchants can view and edit values. The app-owned definition identity remains merchant-immutable. |

Your app's metafield definitions do not count toward the store's plan allowance (at most 50 per app). They are never handed over: uninstalling the app removes them and their values 48 hours later, and reinstalling within those 48 hours keeps them. The uninstall confirmation tells the merchant how many there are, by owner type.

> A metafield the merchant cannot see is never shown to other apps or to shoppers. With `merchant_access` set to `hidden`, `app_access` must be `private` and `is_storefront_visible` must be `false` (so `is_searchable` and `is_filterable` are `false` too). Any other combination is refused when you save the declaration, push the configuration or create a release: `METAFIELD_DEFINITION_HIDDEN_SHARED` names the metafield whose `app_access` must change, `METAFIELD_DEFINITION_HIDDEN_STOREFRONT_VISIBLE` the one whose storefront visibility must change. In the Developer Portal, choosing **Hidden** sets and locks both.

## Limits

| Scope | Limit |
| --- | --- |
| App-owned definitions per app | 50, across every owner type and value type |
| Key, name and description length | Enforced when you declare; the Metafields page shows the live caps |
| Properties on one cart or wishlist line | 20, shared with every other app on that line |
| Property value | Validated against the definition's type, choices and validation rules, and against the platform's per-value size caps |
| Line owner value types | Single line text, True / false, Date, Single select. The wider registry belongs to catalog, order and order-item owners. |
| Artifact lease (`line_artifact`) | 1 hour minimum, 90 days maximum, 30 days by default — see [Line artifacts](https://dev-docs.tringify.com/apps/metafields/line-artifacts) |

> A cart or wishlist line carries at most 20 properties in total: yours, another app's, and any merchant-owned ones. Declare the smallest set of buyer-visible fields a line really needs, and keep everything else in your own records behind one reference property. Over-limit, undeclared, hidden, read-only and invalid values are rejected with coded cart errors.

> Published key, owner type and value type are locked. Keep the existing definition and add a new key when you need a different schema. Display names and descriptions can be improved in a new release.

