What Are API Endpoints? A Simple Explanation With Examples
An API endpoint is a specific URL where an API receives requests. Learn how endpoints, HTTP methods, parameters and status codes work, with real REST examples.
In this article
- What Is an API Endpoint?
- A Simple Analogy
- The Parts of an API Request
- HTTP Methods: The Verbs of an API
- A Real Example: Request and Response
- Path Parameters and Query Parameters
- Status Codes: How Endpoints Reply
- What Makes a Good Endpoint?
- Endpoints vs Webhooks
- How to Test an API Endpoint
- Common Mistakes to Avoid
- API Endpoint FAQ
- Key Takeaway
- Mini Cheat Sheet
If an API is a way for two apps to talk, then endpoints are the exact places where that conversation happens. Every time a mobile app loads your orders, a website shows the weather or a payment goes through, an endpoint is doing the work.
What Is an API Endpoint?
An API endpoint is a specific URL where an API accepts requests and sends back responses. Each endpoint handles one type of action or one type of data.
For example:
https://api.example.com/v1/products
https://api.example.com/v1/products/42
https://api.example.com/v1/orders
Each line is a different endpoint. The first lists products, the second returns product number 42, and the third works with orders.
In simple words: if the API is a building, endpoints are the individual doors, and each door leads to one service.
New to APIs in general? Start with What Is an API?
A Simple Analogy
Think of a bank branch with numbered counters:
- Counter 1 opens new accounts.
- Counter 2 handles deposits.
- Counter 3 handles loans.
You go to the right counter for what you need. API endpoints work the same way: you send your request to the endpoint built for that job.
The Parts of an API Request
A request to an endpoint usually includes:
- Method: what you want to do (read, create, update or delete).
- URL: the endpoint address.
- Headers: extra information, such as the data format or an API key for authentication.
- Body: the data you are sending, usually JSON (only for some methods).
HTTP Methods: The Verbs of an API
The same endpoint URL can do different things depending on the method:
- GET: read data.
GET /productslists products. - POST: create something new.
POST /productsadds a product. - PUT or PATCH: update something.
PATCH /products/42changes product 42. - DELETE: remove something.
DELETE /products/42deletes product 42.
This pattern is called REST, and it is the most common API style on the web.
A Real Example: Request and Response
Here is a request to create a new customer:
POST /v1/customers
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
{
"name": "Rohan Mehta",
"email": "rohan@example.com"
}
And a typical response:
HTTP/1.1 201 Created
{
"id": 1087,
"name": "Rohan Mehta",
"email": "rohan@example.com",
"created_at": "2026-12-03T10:15:00Z"
}
The server confirmed the customer was created and returned its new ID.
Path Parameters and Query Parameters
Endpoints often accept extra details in two ways:
- Path parameters are part of the URL path and identify one specific item:
/users/1087means "user 1087". - Query parameters come after a
?and filter or sort results:/products?category=shoes&sort=price.
Learn more about these URL parts in What Makes Up a URL?
Status Codes: How Endpoints Reply
Every response includes a status code that says what happened:
- 200 OK: success.
- 201 Created: a new item was created.
- 400 Bad Request: the data sent was invalid.
- 401 Unauthorized: missing or wrong credentials.
- 403 Forbidden: you are logged in but not allowed to do this.
- 404 Not Found: the endpoint or item does not exist.
- 429 Too Many Requests: you hit a rate limit.
- 500 Internal Server Error: something broke on the server.
What Makes a Good Endpoint?
- Use nouns, not verbs:
/ordersrather than/getOrders. The method already says what to do. - Use plural names consistently:
/users,/users/5. - Nest only when it is meaningful:
/users/5/ordersfor a user's orders. - Version your API:
/v1/lets you change things later without breaking existing apps. - Return clear errors with a helpful message, not just a status code.
Endpoints vs Webhooks
With a normal endpoint, your app calls the API when it wants data. With a webhook, the other service calls an endpoint on your server when something happens, such as a successful payment. Read What Are Webhooks? to see how they work together.
How to Test an API Endpoint
- Browser: for simple GET endpoints, just open the URL.
- curl: a command-line tool, for example
curl https://api.example.com/v1/products. - Postman, Insomnia or Bruno: apps for building and saving requests.
- API documentation: most providers list every endpoint, its parameters and example responses.
Common Mistakes to Avoid
- Exposing endpoints without authentication that return private data.
- No rate limiting, which lets one client overload your server.
- Putting API keys in front-end code, where anyone can see them.
- Inconsistent naming that makes the API hard to guess and use.
- Breaking changes without a new version, which crashes apps that depend on you.
API Endpoint FAQ
Is an endpoint the same as a URL?
An endpoint is a URL, but specifically one that an API uses to receive requests. Together with the HTTP method, it defines one action.
What is a base URL?
The common start shared by all endpoints of an API, such as https://api.example.com/v1. Each endpoint adds its own path to it.
What format do endpoints return?
Most modern APIs return JSON. Some older ones use XML. See JSON Explained in Under 2 Minutes.
What is the difference between REST and GraphQL endpoints?
A REST API has many endpoints, one per resource. A GraphQL API usually has a single endpoint, and the client describes exactly what data it wants in the request.
Key Takeaway
An API endpoint is a specific URL where an API listens for requests. Combined with an HTTP method like GET or POST, each endpoint performs one clear action and replies with data and a status code.
Mini Cheat Sheet
- Endpoint: URL that receives API requests
- Method: GET, POST, PUT/PATCH, DELETE
- Path parameter: identifies one item (
/users/5) - Query parameter: filters results (
?page=2) - Status code: what happened (200, 404, 500)
Try it: Need sample data while building or testing an API? Use our free fake data generator.
Join the conversation
What do you think?
Write a comment
No comments yet. Be the first to share a thought.