Skip to main content

Get Metafield

Retrieves the details of a single metafield.

HTTP Request​

  • URL: /metafields/{id}
  • Method: GET
  • Headers:
    • accessToken: Required. Your API access token.
  • Required scope: None. Any valid access token can call this endpoint.

Path Parameters​

ParameterTypeDescription
idStringRequired. The ID of the metafield.

cURL Example​

curl --location '<BASE_URL>/metafields/6650c2a1f1d2e83a1b9c0d11' \
--header 'accessToken: <ACCESS_TOKEN>'

Response​

  • 200 OK: The metafield was returned successfully.
  • 400 Bad Request: The metafield ID is not valid.

Sample JSON Response​

{
"success": true,
"data": {
"_id": "6650c2a1f1d2e83a1b9c0d11",
"fieldType": "product",
"label": "Country of Origin",
"description": "Country where the product is manufactured.",
"code": "country_of_origin",
"allowAdminUpdate": true,
"displayStorefront": true,
"displayAdmin": true,
"displayFilter": true,
"hasPredefinedValues": false,
"predefinedValues": [],
"valueType": "text",
"createdAt": "2024-05-24T08:12:17.402Z",
"updatedAt": "2024-05-24T08:12:17.402Z"
}
}

Response Details​

Metafield Data​

FieldTypeDescription
_idStringUnique identifier of the metafield.
fieldTypeStringType of record the metafield belongs to.
labelStringDisplay label.
descriptionStringDescription of the metafield.
codeStringCode used to set and filter values.
allowAdminUpdateBooleanWhether admins can edit the value.
displayStorefrontBooleanWhether the value is shown on the storefront.
displayAdminBooleanWhether the value is shown in the admin panel.
displayFilterBooleanWhether the metafield is offered as a storefront filter.
hasPredefinedValuesBooleanWhether values are chosen from a fixed list.
predefinedValuesArrayList of allowed values.
valueTypeStringType of value.
createdAtStringDate and time the metafield was created (ISO 8601).
updatedAtStringDate and time the metafield was last updated (ISO 8601).

Notes​

  • If no metafield matches the ID, data is null.