# API Error: Cannot GET /api/... / No route matches / The route could not be found

**Code:** `Cannot GET` · **Category:** API · **Seen on:** REST API

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

1. Compare the full URL and method with the API docs character by character
2. List the server’s registered routes
3. Check the base URL / environment variable the client uses

## Detailed fix by platform

### Express

1. 

```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

1. `php artisan route:list --path=api`

### Rails

1. `bin/rails routes | grep users`

## How to diagnose

1. **Method** — Same method the route is defined for?
2. **Prefix** — /api, /v1, trailing slash?
3. **Environment** — Which base URL is the client using?
4. **Deploy** — Is the route in the running build?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/api/route-not-found)
