I built an automated fulfillment system that processes orders through Shopify’s API based on warehouse data. Now I want to create a rollback feature to reverse fulfillments when issues occur, but I keep getting errors and the docs aren’t clear about the required parameters.
I think the first parameter should be the order number and the second should be the fulfillment record, but I’ve tested various IDs from the order data (product IDs, variant IDs, fulfillment IDs) and still receive {"errors":"Not Found"}
responses from my POST request.
Could I be using incorrect identifiers? Is there something else I’m missing?
This is the endpoint I’m calling:
https://{API_TOKEN}:{API_SECRET}@{store_name}.myshopify.com/admin/orders/{order_number}/fulfillments/{fulfillment_id?}/cancel.json
Been dealing with Shopify fulfillment cancellations for months - timing’s the biggest gotcha. When you’re running automated systems, there’s usually a delay between Shopify creating the fulfillment record and when you can actually cancel it. I’ve seen fulfillments show up in API responses, but trying to cancel them right away fails with ‘Not Found’ because Shopify’s still processing the original request. Try adding a 30-60 second delay between creating fulfillments and canceling them in your rollback logic. Also, if your fulfillment has tracking info that’s already been sent to carriers, Shopify sometimes blocks cancellation even when the status looks fine. Check the tracking_urls
field - if it’s populated, that’s probably why it’s getting blocked.
Double-check your API credentials in the URL - authentication issues often throw the same ‘Not Found’ error. I remember when our system used an expired private app token, which caused similar confusion. Test with a simple GET request to /admin/orders/{order_id}/fulfillments.json
first to verify access works. Also, ensure the fulfillment you’re trying to cancel has status: "success"
- while partial and pending fulfillments behave differently. The cancellation endpoint can be particular about the fulfillment state. If you are still getting errors, try calling the endpoint without the fulfillment ID to see what fulfillments actually exist for that order.
also double-check ur fulfillment status - u can’t cancel orders that are already cancelled or delivered. make sure u’re using POST instead of PUT (i’v seen people mess this up). if there’s a tracking_company set, shopify sometimes blocks cancellation based on carrier integrations.
Your endpoint looks right, but you’re probably mixing up order numbers with order IDs. Shopify’s REST API needs the actual order ID (long number like 450789469), not the order number customers see (#1001). When you pull order data, use the id
field from the order object - not order_number
or name
. Same thing for fulfillments - grab the id
from the fulfillment object in that order’s fulfillments array. I hit this exact problem building our order system last year. Shopify’s error messages suck because they just say ‘Not Found’ instead of telling you which ID is wrong. Make sure both IDs are Shopify’s internal ones and that the fulfillment actually belongs to that order.