Error 406 when making a POST fulfillment request

Topic summary

Error 406 occurs when sending a POST to the Shopify REST endpoint for creating a fulfillment via Flow; the same request succeeds in Postman and on manually created orders, but fails on real orders with an empty response body.

Key context:

  • Endpoint used: /admin/api/2021-10/orders/{{order.legacyResourceId}}/fulfillments.json.
  • Payload includes location_id, tracking_number, tracking_urls derived from order.note, and notify_customer.
  • 406 (Not Acceptable) typically indicates the server rejects the request based on content negotiation (e.g., headers like Accept) or unacceptable content.

Troubleshooting steps discussed:

  • Escape dynamic JSON with the Liquid filter | json; this was tried and did not resolve the error.
  • Compare headers and payload between Postman and Flow using a request bin (hookbin/ngrok) to identify differences, especially Accept/Content-Type and dynamic values (e.g., whitespace/newlines in tracking_urls).
  • Validate the endpoint: a participant notes this URL format appears to support GET, not POST, in current Shopify REST docs, suggesting a method/endpoint mismatch.

Status: Unresolved. Action items are to verify headers, inspect dynamic data, and confirm/use the correct supported fulfillment creation endpoint.

Summarized with AI on February 12. AI used: gpt-5.

I’m making a request to the endpoint:

https://###.myshopify.com/admin/api/2021-10/orders/{{order.legacyResourceId}}/fulfillments.json

with the body:

{
 "fulfillment":{
     "location_id":65503887518,
     "tracking_number":"CLICKHERE",
     "tracking_urls":[
       "{{order.note | replace: 'Cód. de Rastreamento:',''}}"
      ],
      "notify_customer":true
  }
}

In Postman everything works perfectly, but in the flow I get the following error:

{"status":406,"response_body":"","verb":"POST","url":"https://###.myshopify.com/admin/api/2021-10/orders/4530109270171/fulfillments.json","request_body":"{\"fulfillment\":{\"location_id\":65503887518,\"tracking_number\":\"CLICKHERE\",\"tracking_urls\":[\" http://tracking.totalexpress.com.br/poupup_track.php?reid=###&pedido=#####&nfiscal=0\n\"],\"notify_customer\":true}}"}

The request is exactly the same. Same headers, same body. The only difference is the dynamic values.

Important note. When I create a manual order and run the flow. Everything works, but when I run the flow in a real product this error happens.

Does your note include characters that might cause issues with json? I’d recommend adding the tag “| json” any time you are trying to output json to make sure it’s escaped.

I checked, it doesn’t include, even so I added the “| json”, I keep getting the same error. As I mentioned, when I create a manual order and run the flow everything works. When it’s a real order, the flow follows the same flow and I get a 406 on the request.

Assuming it’s not that field, the server is not liking something.

I would review this:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/406

It suggests that you may not be setting the same headers that are sent via postman. Try sending your request to a URL where you can inspect the output (ngrok or something like https://hookbin.com/) and then compare the headers and inspect the body of the request with the dynamic data.

A second thing to check:

https://###.myshopify.com/admin/api/2021-10/orders/{{order.legacyResourceId}}/fulfillments.json

Are you sure this URL is valid? I’m not sure what action you are trying to do, but I couldn’t find any POST in the Shopify REST API that has this URL format…there is a GET request here but that would not work with Flow and your body doesn’t match.