Shopify fulfillment endpoint returns 404 error with API version 2023-01

I keep getting a 404 not found error when trying to create fulfillments through the Shopify REST API. The error message just says {"errors":"Not Found"} and I can’t figure out what’s wrong.

Here’s the code I’m using:

curl --location --request POST 'https://mystore-demo.myshopify.com/admin/api/2023-01/fulfillments.json' \
--header 'X-Shopify-Access-Token: shpca_a4b7c9d2e1f8g5h3i6j0k2l9m8n7o4p1' \
--header 'Content-Type: application/json' \
--data-raw '{
    "fulfillment": {
        "message": "Your order has been dispatched today.",
        "notify_customer": true,
        "tracking_info": {
            "number": 9876543,
            "url": "https://www.courier-service.com",
            "company": "FastTrack Delivery"
        },
        "line_items_by_fulfillment_order": [
            {
                "fulfillment_order_id": 4891037562847,
                "fulfillment_order_line_items": [
                    {
                        "id": 2074829163,
                        "quantity": 2
                    }
                ]
            }
        ]
    }
}'

I’ve double checked my access token and the store URL. The fulfillment order ID and line item IDs are valid. Has anyone else run into this issue? What could be causing the 404 response?

The 404 error you’re encountering is likely due to API version compatibility issues with the fulfillment endpoint structure. In API version 2023-01, Shopify deprecated the old fulfillment creation method and requires using fulfillment orders instead. You cannot directly create fulfillments using the /admin/api/2023-01/fulfillments.json endpoint with the payload structure you’re using. Instead, you need to use the fulfillment orders endpoint: /admin/api/2023-01/fulfillment_orders/{fulfillment_order_id}/fulfillments.json and POST to each fulfillment order individually. The payload structure also changes significantly - you’ll need to remove the line_items_by_fulfillment_order wrapper and use line_items directly with the fulfillment order line item IDs. This caught me off guard when I upgraded my integration last year, but switching to the new endpoint resolved the 404 errors immediately.