API Error: Cannot GET /api/... / No route matches / The route could not be found
The server has no route for this URL and HTTP method combination — the endpoint path, API version prefix or method is wrong.
Meaning
Unlike a “resource not found” (the endpoint exists, the record doesn’t), here the framework never matched a handler. Express answers “Cannot GET /path”, Rails “No route matches [GET]”, Laravel “The route api/x could not be found”, Django “Page not found (404)”, and API gateways “no Route matched with those values”.
Usually the path is slightly off — missing /api or /v1 prefix, trailing slash, wrong base URL for the environment — or the route exists only for another method.
Common causes
- Typo or missing prefix in the path (/api, /v1)
- Base URL points at the wrong service or environment
- Route defined for POST but called with GET (or vice versa)
- Router mounted at a different path, or the route file isn’t loaded
- Deployed build doesn’t include the new route yet
⚡ Quick fix
- Compare the full URL and method with the API docs character by character
- List the server’s registered routes
- Check the base URL / environment variable the client uses
Detailed fix by platform
Express
- bash
// print every registered route app._router.stack.filter(l => l.route).forEach(l => console.log(Object.keys(l.route.methods), l.route.path));
Laravel
php artisan route:list --path=api
Rails
bin/rails routes | grep users
How to diagnose
- Method — Same method the route is defined for?
- Prefix — /api, /v1, trailing slash?
- Environment — Which base URL is the client using?
- Deploy — Is the route in the running build?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Report a correction or suggest an improvement
Last updated 7 Oct 2026