Trying to update product metafield gives (406) Not acceptable

Topic summary

Issue: Attempts to add a product metafield via the Shopify Admin API return HTTP 406, while a GET on the same product succeeds. Endpoint used: /admin/api/2019-07/products/{product_id}/metafields.json.

Context: 406 Not Acceptable typically indicates the server can’t return a response in the requested format. The requester shared full headers and body showing a PUT with Basic Auth and a Storefront access token header present. The body structure varies between attempts (a single metafields object vs. a product object containing a metafields array).

Key details from request:

  • Method: PUT
  • Headers include X-Shopify-Storefront-Access-Token and Basic Auth.
  • Body example nests metafields under product, e.g., key/value/value_type/namespace.

Latest guidance: A responder suggested using POST instead of PUT for creating metafields on a product. Another asked for full headers to diagnose format issues.

Status: No confirmed resolution from the original poster. Open questions include whether switching to POST resolves the 406 and whether header/content-type/accept expectations or payload structure are causing the error.

Notes: The exact request payload and headers are central to understanding the issue.

Summarized with AI on January 11. AI used: gpt-5.

I am trying to add a metafield as a test to one of our products but am met with a 406 error code when running the request through Postman. I am able to run a GET request successfully for the same product. The request I am trying is a PUT to: https://closettedevelopment.myshopify.com/admin/api/2019-07/products/4190148296797/metafields.json

the body is:

{
  "metafields": {
    "namespace": "inventory",
    "key": "warehouse",
    "value": 25,
    "value_type": "integer"
  }
}

I am using Basic Auth with our API key and password

Any help would be greatly appreciated. Thank you!

Hi @samiam0906 ,

Can you share the full request with headers you are sending? 406 often means we can’t return the results in the format you are requesting. Chances are it’s an easy fix, but I’ll need some more info. Thanks!

Hi @Busfox . Thank you for the reply. Below is the full request

PUT /admin/api/2019-07/products/4190148296797/metafields.json HTTP/1.1
Host: closettedevelopment.myshopify.com
X-Shopify-Storefront-Access-Token: <STOREFRONT-ACCESS-TOKEN>
Authorization: Basic <APIKEY + PW>
cache-control: no-cache
Postman-Token: <TOKEN>

{
  "product": {
    "id": 4190148296797,
    "metafields": [
      {
        "key": "new",
        "value": "newvalue",
        "value_type": "string",
        "namespace": "global"
      }
    ]
  }
}

Did you get solution?

Try to run this with a POST request instead of a PUT request.