Skip to main content

Endpoint

Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/endpoint

In short

An endpoint is a specific URL, combined with an HTTP method, where an API receives requests and returns responses for one particular resource or action.

What is an API endpoint?

An endpoint is one specific address where an API can be reached. In a web API, it is a URL such as https://api.example.com/users, usually paired with an HTTP method, so GET /users and POST /users are often treated as two different endpoints that do different things.

An endpoint URL typically has a base URL with the API's domain and version, like https://api.example.com/v1, a path that names the resource, like /users/42, and optional query parameters that filter or sort the results, like ?sort=name. The API's documentation lists each endpoint, the data it expects, and the response it returns.

If an API is a restaurant menu, each endpoint is a single item on it: one specific thing you can order, with a clear description of what you get. A typical REST API has dozens of endpoints, while a GraphQL API usually exposes just one and lets the query decide what data comes back.

People sometimes use endpoint, route, and API interchangeably. The API is the whole interface, an endpoint is one entry point into it as seen by clients, and a route is the server-side rule that connects a URL and method to the function that handles it. In networking and security, endpoint can also mean a device such as a laptop or phone, which is a different meaning.

Key takeaways

  • An endpoint is a URL where an API accepts requests.
  • The same URL with different HTTP methods can act as different endpoints.
  • Endpoint URLs combine a base URL, a resource path, and optional query parameters.
  • REST APIs have many endpoints; GraphQL APIs usually have one.

Example

Defining and calling endpointsjavascript
// Each route below defines one endpoint of a users API (Express.js)
app.get("/v1/users", listUsers);         // GET    /v1/users
app.get("/v1/users/:id", getUser);       // GET    /v1/users/42
app.post("/v1/users", createUser);       // POST   /v1/users
app.patch("/v1/users/:id", updateUser);  // PATCH  /v1/users/42
app.delete("/v1/users/:id", deleteUser); // DELETE /v1/users/42

// A client calling one of those endpoints
const res = await fetch("https://api.example.com/v1/users/42");

Readers ask

What is the difference between an API and an endpoint?

An API is the complete interface a service offers, while an endpoint is one specific URL and method within that API. For example, a weather API might have separate endpoints for current conditions and for forecasts.

What is the difference between an endpoint and a route?

They describe the same thing from different sides. Clients call an endpoint, while a route is the server-side rule that maps that URL and HTTP method to the code that handles it.

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings