Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt

Use this file to discover all available pages before exploring further.

Metafield Definitions

A definition is the schema for a metafield: it sets the type, validation rules, human label, and whether the field is pinned to the resource detail page in admin. Values that conflict with the definition’s type or validations are rejected at write time.
Definition CRUD lives on the Admin API (merchant JWT) only. It is not exposed to OAuth-scoped apps. Apps can write metafield values without ever creating a definition — the type+validation contract is optional. Definitions exist primarily to power the merchant Settings → Custom data admin UI.

Why definitions exist

Without a definitionWith a definition
Apps can write any type to any namespace/keyType is enforced at write time
No human label — admin shows the raw keyHuman-friendly name, description
Doesn’t appear in the admin “Custom data” pickerListed in Settings → Custom data
Doesn’t auto-show on the resource edit pageIf pinned: true, appears on the resource form
Validation rules can’t be enforced centrallymin, max, regex, choices, etc. all enforced

Schema

FieldTypeNotes
idUUIDserver-generated
storeIdUUIDscoped per store
namespacestringe.g. custom, my_app, specs
keystringmachine name
namestringhuman label shown in admin
typeenumone of the 22 supported types
owner_typeenumone of the 9 owner types
validationsobjecttype-dependent — min, max, regex, choices, list_min, list_max, allowed_schemes, etc.
descriptionstringoptional admin tooltip
pinnedboolif true, appears on the resource detail edit page
created_at, updated_atISO timestamp
The unique constraint is (storeId, ownerType, namespace, key) — one definition per (owner kind, namespace, key) per store.

Validation rules per type

The validations object’s allowed keys depend on type:
TypeAllowed validations
single_line_text_fieldmin, max, regex, choices
multi_line_text_fieldmin, max, regex
rich_text_field
number_integermin, max
number_decimalmin, max, max_precision
boolean
color
date, date_timemin, max (ISO strings)
weight, dimension, volume
money
rating– (constrained by scale_min / scale_max in the value itself)
urlallowed_schemes (defaults to ["https","http","mailto","tel"])
json
*_reference
list.<innerType>list_min, list_max + inner-type validations applied per item

Endpoints

MethodRouteDescription
GET/metafield-definitionsList with filters
POST/metafield-definitionsCreate
GET/metafield-definitions/:idGet one
PUT/metafield-definitions/:idUpdate
DELETE/metafield-definitions/:idDelete

Auth

Merchant JWT with one of: MERCHANT, STAFF_ADMIN, SUPER_ADMIN, MANAGER. The storeId is resolved from the token (or parentId for staff/manager).

Notes for app developers

  • You can still write metafield values under your own namespace without creating a definition first. The platform won’t enforce types unless you’ve defined them.
  • If you want merchants to see and edit your fields in the admin, ask the merchant (or your install flow) to create matching definitions. The definition + value combination is what populates the admin UI.
  • Deleting a definition does not delete the values. Values persist; they just lose the schema. Cleaning up values requires explicit DELETE /metafields/:id calls.