Failed to cancel order. Status code: 404, Response: {"errors":"Not Found"}

Topic summary

Issue: Users are encountering a 404 “Not Found” error when attempting to cancel orders through Shopify’s REST Admin API, despite the orders being visible in both the dashboard and retrievable via the orders API.

Technical Details:

  • The REST API endpoint /admin/api/2024-07/orders/{order_id}/cancel.json returns {"errors":"Not Found"}
  • Code includes proper authentication headers (X-Shopify-Access-Token) and parameters (restock=true)
  • The same 404 error occurs with GraphQL API’s orderCancel mutation

Troubleshooting Attempted:

  • One user suggested testing with GraphQL API via the GraphiQL app as an alternative approach
  • Original poster confirmed all permission scopes are enabled and the app works otherwise, but order cancellation specifically fails regardless of API method used

Status: Unresolved. Multiple users report the identical issue across both REST and GraphQL APIs, suggesting a potential broader platform issue or permissions configuration problem beyond standard API access.

Summarized with AI on November 7. AI used: claude-sonnet-4-5-20250929.

I am using the REST admin API to cancel orders but it continues to return the following error:

{"errors":"Not Found"}

The order does exist as I can find it using the orders API and even visible in my dashboard. Here’s my code:

import requests

store_url = ""
access_token = ""
order_id = "6009742098749"

url = f"{store_url}/admin/api/2024-07/orders/{order_id}/cancel.json?restock=true"

headers = {
    "X-Shopify-Access-Token": access_token,
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers, json={})

if response.status_code == 200:
    print("Order cancelled successfully.")
else:
    print(f"Failed to cancel order. Status code: {response.status_code}, Response: {response.text}")

If you try the same action with the GraphQL API orderCancel mutation , (you can use the graphiql app to test) do you also see an error, eg:

mutation CancelOrder {
  orderCancel(
    orderId: "gid://shopify/Order/6009742098749",
    reason: CUSTOMER,
    refund: true,
    restock: true,
    notifyCustomer: true,
    staffNote: "Customer requested cancellation"
  ) {
    job {
      done
      id
    }
    orderCancelUserErrors {
      code
      field
      message
    }
  }
}

The problem is I can’t use the GraphQL API at all. All permission scopes are allowed, works like a charm on the app but wouldn’t work using the API no matter what I try. Please figure it out for me

Hi, i am facing Same issue of 404, with GraphQL API and Rest admin API,
Status Code: 404
Response Text: {“errors”:“Not Found”}