Skip to content

Add order's metafields

POST
/orders/{id}/metafields
curl --request POST \
--url https://acme.mykreezalid.com/api/v1/orders/1/metafields \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/json' \
--data '{ "namespace": "erp", "title": "invoice_number", "value": "INV-2026-0042" }'

Adds one metafield, or several when you send an array of them. A metafield with the same namespace and title as an existing one of this order replaces its value. The metafield may also be wrapped in a metafield key.

id
required
integer

ID of your order

Media typeapplication/json
One of:

A custom value you attach to a resource, identified by its namespace and title.

object
namespace
required

Group the metafield belongs to

string
title
required

Name of the metafield, unique within its namespace

string
value
required

Value of the metafield. Usually a string; it can be returned as a number or a JSON value depending on how the metafield was defined.

string

Example

{
"namespace": "erp",
"title": "invoice_number",
"value": "INV-2026-0042"
}

The saved metafields: under metafield (a list of one) when you sent one metafield, under metafields when you sent an array

Media typeapplication/json
object
metafield
Array<object>

A custom value you attach to a resource, identified by its namespace and title.

object
namespace
required

Group the metafield belongs to

string
title
required

Name of the metafield, unique within its namespace

string
value
required

Value of the metafield. Usually a string; it can be returned as a number or a JSON value depending on how the metafield was defined.

string
metafields
Array<object>

A custom value you attach to a resource, identified by its namespace and title.

object
namespace
required

Group the metafield belongs to

string
title
required

Name of the metafield, unique within its namespace

string
value
required

Value of the metafield. Usually a string; it can be returned as a number or a JSON value depending on how the metafield was defined.

string

Example

{
"metafield": [
{
"namespace": "erp",
"title": "warehouse_code",
"value": "WH-42"
}
],
"metafields": [
{
"namespace": "erp",
"title": "warehouse_code",
"value": "WH-42"
}
]
}

No order has this identifier.

The body is not a metafield or a list of metafields, or namespace, title or value is missing or empty.