---
title: "Set collection metafields"
method: PUT
path: "/v1/commerce/collections/{collectionId}/metafields"
tags: ["Commerce"]
---

# Set collection metafields

`PUT /v1/commerce/collections/{collectionId}/metafields`

Creates or updates custom fields by namespace and key. Needs collections.metafields: WooCommerce keeps custom fields on products only and answers 400 platform_not_supported.

## Path parameters

- `collectionId` string, required

## Request body

- object
  - `accountId` string, required
  - `metafields` CommerceMetafield[], required
    - `namespace` string, required
    - `key` string, required
    - `type` string, required — Platform value type, e.g. single_line_text_field, number_integer, json.
    - `value` string, required — The value serialized as a string, JSON for structured types.

## Response `200`

Metafields set

- object
  - `metafields` CommerceMetafield[]
    - `namespace` string, required
    - `key` string, required
    - `type` string, required — Platform value type, e.g. single_line_text_field, number_integer, json.
    - `value` string, required — The value serialized as a string, JSON for structured types.

## Other responses

- `400` — Invalid request
- `401` — Unauthorized
- `403` — The store has not granted this permission, or the token was revoked (code insufficient_permissions). Reconnect the store to grant the latest permissions; GET /v1/commerce/store lists what the current grant allows.
- `404` — Account not found (code account_not_found) or the resource was not found (code product_not_found or resource_not_found).
- `429` — Rate limited, either by Zernio or by the platform. Retry later.

## Changes

- **2026-09-30** `16a7b9d5373e` — 1 info
  - removed the `platform` enum value from the `details/budgetScope` response property for the response status `400`
- **2026-09-29** `69bbe3da3a18` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/zernio/apis/zernio-api/changes/v1/commerce/collections/:collectionId/metafields/put.md)

---

[API](https://skmtc.dev/zernio/apis/zernio-api.md) · [All operations](https://skmtc.dev/zernio/apis/zernio-api/llms.txt) · [OpenAPI document](https://skmtc.dev/zernio/apis/zernio-api/revisions/16a7b9d5373e?raw)
