Create or Upsert Metafield
Metafields
Create or Upsert Metafield
Create a new metafield, or update if one already exists for the same owner+namespace+key
POST
Create or Upsert Metafield
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.
Create or Upsert Metafield
This endpoint upserts: if a metafield with the same(ownerType, namespace, key, ownerId) already exists for your app, the
value is updated; otherwise a new row is created. The unique constraint
guarantees one metafield per (resource, namespace, key) per app.
Request
Required scope
write_metafields
Body parameters
Namespace. Use your app handle (e.g.
subscriptions_pro) — custom is
the merchant-managed namespace.Field key. Unique per
(ownerType, namespace, ownerId).One of the 22 supported types.
Determines how
value is validated and decoded.The value. Scalars are sent as-is (string, number, boolean). Compound
types (
weight, dimension, volume, money, rating, lists, JSON)
are sent as JSON.One of
shop, product, variant, collection, customer, order,
page, blog, article. Lowercase only.The id of the owning resource. Required for every owner type except
shop.Examples by type
Scalar text
Number with validation
Boolean
Rich text (HTML, rendered unescaped in Aqua)
Measurement
Money
Reference
List
JSON (free-form structured data)
Response
201 if created, 200 if updated.
success or error.The created or updated metafield. See List Metafields for shape.
Example response
Validation errors
Cache invalidation
A successful upsert automatically expires:- Backend Redis caches:
g:{storeId}:{ownerType}:{handle} - LaunchMyStore frontend
PageHtmlCache
Error codes
| Code | Description |
|---|---|
UNAUTHORIZED | Invalid or missing access token |
FORBIDDEN | App doesn’t have write_metafields scope |
VALIDATION_ERROR | Type or validation rule failed (see errors[]) |
NOT_FOUND | Owning resource does not exist (when reference verification is enabled) |