post
https://{subdomain}.myshoplaza.com/openapi/2025-06/metafields//
Create a new metafield
The Create Metafield API allows create a new custom metafield attached to a specific resource in the store. Metafields are custom data fields that can store additional information about the resources.
This API is especially useful for:
- Extending the functionality of data management by adding custom metadata.
Request Parameters
Public Request Parameters
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
owner_resource | string | Yes | Resource type to attach metafield Valid values: shop, product, product_image, product_variant, order, page, customer, collection, blog, article |
owner_id | string | Yes | Unique identifier of the target resource |
Body Parameters
| Parameter | Type | Required | Description | Example Value |
|---|---|---|---|---|
definition_id | string | No | System identifier for metafield configuration | "global" |
namespace | string | Yes | Logical container for grouping related metafields | "color" |
key | string | Yes | Unique identifier within the namespace | "string" |
value | string | Yes | Content value matching the specified type | "#FF0000" (for color) |
type | string | Yes | Data format specification Valid values: date, date_time, weight, volume, dimension, integer, number_decimal, file_reference, single_line_text_field, json, multi_line_text_field, color, rating, url, boolean | "The main color of the product" |
description | string | No | Human-readable explanation of purpose | "df_12345" |
Response Explanation
Public Response Parameters
Successful Response
| Field | Type | Example | Description |
|---|---|---|---|
code | string | "Success" | Response status (e.g., "Success"). |
message | string | "Metafield created successfully" | Response message. |
data | object | Contains the created metafield data. | |
data.metafield.id | string | "mf_001" | Unique ID of the created metafield. |
data.metafield.store_id | integer | 12345 | ID of the store that owns the metafield. |
data.metafield.owner_resource | string | "product" | Resource type that owns the metafield (e.g., "product"). |
data.metafield.owner_id | string | "prod_001" | ID of the owner resource. |
data.metafield.namespace | string | "global" | Namespace of the metafield. |
data.metafield.key | string | "color" | Key of the metafield. |
data.metafield.type | string | "string" | Type of the metafield ("json" or "string"). |
data.metafield.description | string | "Product primary color" | Description of the metafield. |
data.metafield.definition_id | string | "df_12345" | ID of the metafield definition (if applicable). |
data.metafield.created_at | string | "2023-10-25T14:30:00Z" | Timestamp when the metafield was created (ISO 8601 format). |
data.metafield.updated_at | string | "2023-10-25T14:30:00Z" | Timestamp when the metafield was last updated (ISO 8601 format). |
Error Response
| Field | Type | Example | Description |
|---|---|---|---|
code | string | InvalidParameter | Error http message |
message | string | `` | Error message |
