What Is an API Endpoint?
An endpoint is a specific URL you call to do one thing. Here's what that means and how to read one.
An API endpoint is a single URL that an API exposes to do one specific job — fetch a user, create an order, search for a city. If an API is a building, the endpoints are its doors: each one leads somewhere specific, and each has rules about who may go through and what they must bring.
The anatomy of an endpoint
Take this endpoint from the OpenWeatherMap API:
GET https://api.openweathermap.org/data/2.5/weather?q=Lagos&appid=KEY
Every part of that line matters:
| Method | GET — the verb. GET reads, POST creates, PUT/PATCH update, DELETE removes. The same path with a different method is, in effect, a different endpoint. |
| Base URL | https://api.openweathermap.org — the host every endpoint on this API shares. |
| Path | /data/2.5/weather — the part that identifies this resource or action. /data/2.5 is a version prefix; /weather is the resource. |
| Query string | ?q=Lagos&appid=KEY — parameters that filter or configure the request. Here: which city, and which API key. |
| Path parameters | Not shown here, but common: /users/42 puts the id in the path instead of the query string. |
Endpoint vs. API vs. route
- An API is the whole interface — every endpoint a service offers, plus its auth rules and data formats.
- An endpoint is one method + path combination within that API.
- A route is the same idea seen from the server’s side — the pattern the server matches incoming requests against. Endpoint is the client’s word; route is the server’s.
- A resource is the thing an endpoint deals with (a user, an invoice). REST APIs name endpoints after resources:
/invoices,/invoices/42,/invoices/42/lines.
How to find an API’s endpoints
Good documentation lists them in a reference section, usually grouped by resource, each with its method, path, parameters, an example request and an example response. Many APIs also publish a machine-readable OpenAPI (Swagger) specification — a single JSON or YAML file describing every endpoint, which tools can turn into interactive docs or client libraries. If there’s a “Try it” console, use it: it shows the exact URL it builds.
Calling an endpoint
Every endpoint call is the same four steps, whatever the language:
# 1. build the URL (base + path + query)
# 2. add headers (auth, Accept, Content-Type)
# 3. send the request with the right method
# 4. check the status code, then parse the body
import requests
r = requests.get(
'https://api.openweathermap.org/data/2.5/weather',
params={'q': 'Lagos', 'appid': 'YOUR_KEY'},
headers={'Accept': 'application/json'},
timeout=10,
)
r.raise_for_status() # step 4a: did it work?
data = r.json() # step 4b: read the body
print(data['main']['temp'])Things that trip people up
- Trailing slashes.
/usersand/users/are sometimes different endpoints. Match the docs exactly. - Wrong method. Sending GET to a create endpoint usually returns
405 Method Not Allowed. - Query string vs. body. GET parameters go in the URL; POST/PUT data usually goes in the request body as JSON. Putting the body on a GET does nothing.
- Versioning.
/v1/vs/v2/in the path can change field names and response shapes entirely. - Base URL drift. Some APIs have a separate host for auth, uploads or sandbox mode.
FAQ
What is the difference between an API and an endpoint?
The API is the entire interface a service exposes. An endpoint is one specific URL within it — one method and path that performs one operation, like GET /users/42.
Is a URL the same as an endpoint?
An endpoint is identified by a URL and an HTTP method. GET /orders and POST /orders share a URL but are two different endpoints that do different things.
How do I know what endpoints an API has?
Read its API reference documentation, or its OpenAPI/Swagger spec if it publishes one. Both list every endpoint with its method, path, parameters and example responses.
What is a REST endpoint?
A REST endpoint is named after a resource and uses HTTP methods for actions: GET /articles lists, GET /articles/5 reads one, POST /articles creates, DELETE /articles/5 removes.
Keep going
Try it on a real API
๐ Explore free public APIs
Hundreds of free APIs, searchable by category, with auth & CORS at a glance.
Browse the directory โ