Browse the API docs

Metafields

Custom data on products, variants, collections, customers and orders.

Endpoints#

Paths are relative to https://store.weftgrid.com/api/admin/2026-10. The examples read the token from $STORELOOM_TOKEN and ids from variables like $ORDER_ID.

The metafield object#

What the endpoints below return for one metafield.

metafield
{
  "id": "cm2mf01",
  "owner_resource": "product",
  "owner_id": "cm2product01",
  "namespace": "custom",
  "key": "material",
  "type": "single_line_text_field",
  "value": "100% European linen",
  "created_at": "2026-10-02T10:00:00.000Z",
  "updated_at": "2026-10-02T10:00:00.000Z"
}

List a product's metafields#

GET/products/{owner_id}/metafields.jsonread_products

Requires read_products.

Query parameters
ParameterDescription
namespaceOnly this namespace.
keyOnly this key.
fieldsComma-separated fields to return.
Request
curl "https://store.weftgrid.com/api/admin/2026-10/products/$OWNER_ID/metafields.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"
Example responseShow
{ "metafields": [ … ] }

Set a product metafield#

POST/products/{owner_id}/metafields.jsonwrite_products

Creates the metafield, or replaces the value when the product already has one with this namespace and key (201 when created, 200 when replaced). Namespace and key: 2–64 lowercase letters, numbers, hyphens or underscores. Types: single_line_text_field, multi_line_text_field, rich_text_field (sanitized HTML), number_integer, number_decimal, money ({"amount":"5.99","currency_code":"USD"}), boolean, date (YYYY-MM-DD), date_time (ISO 8601, stored in UTC), url (http or https), json, color (#rrggbb), rating, dimension, weight, volume ({"value":30,"unit":"cm"}), and references to this store's records as gids: file_reference, product_reference, variant_reference, collection_reference, page_reference, customer_reference, metaobject_reference, mixed_reference (gid://storeloom/Product/<id>…). Most can be lists (list.product_reference…), sent as a JSON array. When the store has a definition for the namespace and key (Settings → Custom data), type can be left out and must match it if sent, and the definition's validations apply. Values are checked and stored in canonical form, e.g. "true", "4.5", "#1b2340". Requires write_products.

Request body
{ "metafield": { "namespace": "custom", "key": "material", "type": "single_line_text_field", "value": "100% European linen" } }
Request with curl
curl -X POST "https://store.weftgrid.com/api/admin/2026-10/products/$OWNER_ID/metafields.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "metafield": { "namespace": "custom", "key": "material", "type": "single_line_text_field", "value": "100% European linen" } }'
Example responseShow
{
  "metafield": {
    "id": "cm2mf01",
    "owner_resource": "product",
    "owner_id": "cm2product01",
    "namespace": "custom",
    "key": "material",
    "type": "single_line_text_field",
    "value": "100% European linen",
    "created_at": "2026-10-02T10:00:00.000Z",
    "updated_at": "2026-10-02T10:00:00.000Z"
  }
}

List a variant's metafields#

GET/variants/{owner_id}/metafields.jsonread_products

Requires read_products.

Query parameters
ParameterDescription
namespaceOnly this namespace.
keyOnly this key.
fieldsComma-separated fields to return.
Request
curl "https://store.weftgrid.com/api/admin/2026-10/variants/$OWNER_ID/metafields.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"
Example responseShow
{ "metafields": [ … ] }

Set a variant metafield#

POST/variants/{owner_id}/metafields.jsonwrite_products

Creates the metafield, or replaces the value when the variant already has one with this namespace and key (201 when created, 200 when replaced). Namespace and key: 2–64 lowercase letters, numbers, hyphens or underscores. Types: single_line_text_field, multi_line_text_field, rich_text_field (sanitized HTML), number_integer, number_decimal, money ({"amount":"5.99","currency_code":"USD"}), boolean, date (YYYY-MM-DD), date_time (ISO 8601, stored in UTC), url (http or https), json, color (#rrggbb), rating, dimension, weight, volume ({"value":30,"unit":"cm"}), and references to this store's records as gids: file_reference, product_reference, variant_reference, collection_reference, page_reference, customer_reference, metaobject_reference, mixed_reference (gid://storeloom/Product/<id>…). Most can be lists (list.product_reference…), sent as a JSON array. When the store has a definition for the namespace and key (Settings → Custom data), type can be left out and must match it if sent, and the definition's validations apply. Values are checked and stored in canonical form, e.g. "true", "4.5", "#1b2340". Requires write_products.

Request body
{ "metafield": { "namespace": "custom", "key": "fit", "type": "single_line_text_field", "value": "Relaxed" } }
Request with curl
curl -X POST "https://store.weftgrid.com/api/admin/2026-10/variants/$OWNER_ID/metafields.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "metafield": { "namespace": "custom", "key": "fit", "type": "single_line_text_field", "value": "Relaxed" } }'
Example responseShow
{
  "metafield": {
    "id": "cm2mf01",
    "owner_resource": "product",
    "owner_id": "cm2product01",
    "namespace": "custom",
    "key": "material",
    "type": "single_line_text_field",
    "value": "100% European linen",
    "created_at": "2026-10-02T10:00:00.000Z",
    "updated_at": "2026-10-02T10:00:00.000Z"
  }
}

List a collection's metafields#

GET/collections/{owner_id}/metafields.jsonread_products

Requires read_products.

Query parameters
ParameterDescription
namespaceOnly this namespace.
keyOnly this key.
fieldsComma-separated fields to return.
Request
curl "https://store.weftgrid.com/api/admin/2026-10/collections/$OWNER_ID/metafields.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"
Example responseShow
{ "metafields": [ … ] }

Set a collection metafield#

POST/collections/{owner_id}/metafields.jsonwrite_products

Creates the metafield, or replaces the value when the collection already has one with this namespace and key (201 when created, 200 when replaced). Namespace and key: 2–64 lowercase letters, numbers, hyphens or underscores. Types: single_line_text_field, multi_line_text_field, rich_text_field (sanitized HTML), number_integer, number_decimal, money ({"amount":"5.99","currency_code":"USD"}), boolean, date (YYYY-MM-DD), date_time (ISO 8601, stored in UTC), url (http or https), json, color (#rrggbb), rating, dimension, weight, volume ({"value":30,"unit":"cm"}), and references to this store's records as gids: file_reference, product_reference, variant_reference, collection_reference, page_reference, customer_reference, metaobject_reference, mixed_reference (gid://storeloom/Product/<id>…). Most can be lists (list.product_reference…), sent as a JSON array. When the store has a definition for the namespace and key (Settings → Custom data), type can be left out and must match it if sent, and the definition's validations apply. Values are checked and stored in canonical form, e.g. "true", "4.5", "#1b2340". Requires write_products.

Request body
{ "metafield": { "namespace": "custom", "key": "accent_color", "type": "color", "value": "#4f5a1f" } }
Request with curl
curl -X POST "https://store.weftgrid.com/api/admin/2026-10/collections/$OWNER_ID/metafields.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "metafield": { "namespace": "custom", "key": "accent_color", "type": "color", "value": "#4f5a1f" } }'
Example responseShow
{
  "metafield": {
    "id": "cm2mf01",
    "owner_resource": "product",
    "owner_id": "cm2product01",
    "namespace": "custom",
    "key": "material",
    "type": "single_line_text_field",
    "value": "100% European linen",
    "created_at": "2026-10-02T10:00:00.000Z",
    "updated_at": "2026-10-02T10:00:00.000Z"
  }
}

List a customer's metafields#

GET/customers/{owner_id}/metafields.jsonread_customers

Requires read_customers.

Query parameters
ParameterDescription
namespaceOnly this namespace.
keyOnly this key.
fieldsComma-separated fields to return.
Request
curl "https://store.weftgrid.com/api/admin/2026-10/customers/$OWNER_ID/metafields.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"
Example responseShow
{ "metafields": [ … ] }

Set a customer metafield#

POST/customers/{owner_id}/metafields.jsonwrite_customers

Creates the metafield, or replaces the value when the customer already has one with this namespace and key (201 when created, 200 when replaced). Namespace and key: 2–64 lowercase letters, numbers, hyphens or underscores. Types: single_line_text_field, multi_line_text_field, rich_text_field (sanitized HTML), number_integer, number_decimal, money ({"amount":"5.99","currency_code":"USD"}), boolean, date (YYYY-MM-DD), date_time (ISO 8601, stored in UTC), url (http or https), json, color (#rrggbb), rating, dimension, weight, volume ({"value":30,"unit":"cm"}), and references to this store's records as gids: file_reference, product_reference, variant_reference, collection_reference, page_reference, customer_reference, metaobject_reference, mixed_reference (gid://storeloom/Product/<id>…). Most can be lists (list.product_reference…), sent as a JSON array. When the store has a definition for the namespace and key (Settings → Custom data), type can be left out and must match it if sent, and the definition's validations apply. Values are checked and stored in canonical form, e.g. "true", "4.5", "#1b2340". Requires write_customers.

Request body
{ "metafield": { "namespace": "custom", "key": "birthday", "type": "date", "value": "1992-04-18" } }
Request with curl
curl -X POST "https://store.weftgrid.com/api/admin/2026-10/customers/$OWNER_ID/metafields.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "metafield": { "namespace": "custom", "key": "birthday", "type": "date", "value": "1992-04-18" } }'
Example responseShow
{
  "metafield": {
    "id": "cm2mf01",
    "owner_resource": "product",
    "owner_id": "cm2product01",
    "namespace": "custom",
    "key": "material",
    "type": "single_line_text_field",
    "value": "100% European linen",
    "created_at": "2026-10-02T10:00:00.000Z",
    "updated_at": "2026-10-02T10:00:00.000Z"
  }
}

List a order's metafields#

GET/orders/{owner_id}/metafields.jsonread_orders

Requires read_orders.

Query parameters
ParameterDescription
namespaceOnly this namespace.
keyOnly this key.
fieldsComma-separated fields to return.
Request
curl "https://store.weftgrid.com/api/admin/2026-10/orders/$OWNER_ID/metafields.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"
Example responseShow
{ "metafields": [ … ] }

Set a order metafield#

POST/orders/{owner_id}/metafields.jsonwrite_orders

Creates the metafield, or replaces the value when the order already has one with this namespace and key (201 when created, 200 when replaced). Namespace and key: 2–64 lowercase letters, numbers, hyphens or underscores. Types: single_line_text_field, multi_line_text_field, rich_text_field (sanitized HTML), number_integer, number_decimal, money ({"amount":"5.99","currency_code":"USD"}), boolean, date (YYYY-MM-DD), date_time (ISO 8601, stored in UTC), url (http or https), json, color (#rrggbb), rating, dimension, weight, volume ({"value":30,"unit":"cm"}), and references to this store's records as gids: file_reference, product_reference, variant_reference, collection_reference, page_reference, customer_reference, metaobject_reference, mixed_reference (gid://storeloom/Product/<id>…). Most can be lists (list.product_reference…), sent as a JSON array. When the store has a definition for the namespace and key (Settings → Custom data), type can be left out and must match it if sent, and the definition's validations apply. Values are checked and stored in canonical form, e.g. "true", "4.5", "#1b2340". Requires write_orders.

Request body
{ "metafield": { "namespace": "custom", "key": "gift_message", "type": "multi_line_text_field", "value": "Happy birthday!" } }
Request with curl
curl -X POST "https://store.weftgrid.com/api/admin/2026-10/orders/$OWNER_ID/metafields.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "metafield": { "namespace": "custom", "key": "gift_message", "type": "multi_line_text_field", "value": "Happy birthday!" } }'
Example responseShow
{
  "metafield": {
    "id": "cm2mf01",
    "owner_resource": "product",
    "owner_id": "cm2product01",
    "namespace": "custom",
    "key": "material",
    "type": "single_line_text_field",
    "value": "100% European linen",
    "created_at": "2026-10-02T10:00:00.000Z",
    "updated_at": "2026-10-02T10:00:00.000Z"
  }
}

Get a metafield#

GET/metafields/{id}.jsonAny token

Requires the read scope of the metafield's owner (read_products, read_customers or read_orders).

Request
curl "https://store.weftgrid.com/api/admin/2026-10/metafields/$METAFIELD_ID.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"
Example responseShow
{
  "metafield": {
    "id": "cm2mf01",
    "owner_resource": "product",
    "owner_id": "cm2product01",
    "namespace": "custom",
    "key": "material",
    "type": "single_line_text_field",
    "value": "100% European linen",
    "created_at": "2026-10-02T10:00:00.000Z",
    "updated_at": "2026-10-02T10:00:00.000Z"
  }
}

Update a metafield#

PUT/metafields/{id}.jsonAny token

Change the value (and the type, when there's no definition for it). Namespace, key and owner can't change. Types: single_line_text_field, multi_line_text_field, rich_text_field (sanitized HTML), number_integer, number_decimal, money ({"amount":"5.99","currency_code":"USD"}), boolean, date (YYYY-MM-DD), date_time (ISO 8601, stored in UTC), url (http or https), json, color (#rrggbb), rating, dimension, weight, volume ({"value":30,"unit":"cm"}), and references to this store's records as gids: file_reference, product_reference, variant_reference, collection_reference, page_reference, customer_reference, metaobject_reference, mixed_reference (gid://storeloom/Product/<id>…). Most can be lists (list.product_reference…), sent as a JSON array. When the store has a definition for the namespace and key (Settings → Custom data), type can be left out and must match it if sent, and the definition's validations apply. Values are checked and stored in canonical form, e.g. "true", "4.5", "#1b2340". Requires the write scope of the metafield's owner.

Request body
{ "metafield": { "value": "Washed linen, garment dyed" } }
Request with curl
curl -X PUT "https://store.weftgrid.com/api/admin/2026-10/metafields/$METAFIELD_ID.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "metafield": { "value": "Washed linen, garment dyed" } }'
Example responseShow
{
  "metafield": {
    "id": "cm2mf01",
    "owner_resource": "product",
    "owner_id": "cm2product01",
    "namespace": "custom",
    "key": "material",
    "type": "single_line_text_field",
    "value": "100% European linen",
    "created_at": "2026-10-02T10:00:00.000Z",
    "updated_at": "2026-10-02T10:00:00.000Z"
  }
}

Delete a metafield#

DELETE/metafields/{id}.jsonAny token

Requires the write scope of the metafield's owner.

Request
curl -X DELETE "https://store.weftgrid.com/api/admin/2026-10/metafields/$METAFIELD_ID.json" \
  -H "X-Storeloom-Access-Token: $STORELOOM_TOKEN"
Example responseShow
{}