Skip to content

Endpoints Overview

In Restura, an endpoint is a group of related routes sharing the same base URL (e.g., /api/v1/users). Each endpoint contains one or more routes—individual API paths that handle requests for specific operations.

Routes come in two flavors:

  • Standard routes automatically generate SQL queries based on your schema configuration
  • Custom routes delegate to your own TypeScript handler code for complex business logic

Routes are categorized by the shape of data they return:

TypeDescriptionSQL Generated
ONEReturns a single object from the databaseYes
ARRAYReturns a list of objects from the databaseYes
PAGEDReturns paginated results with a total countYes
CUSTOM_ONEReturns a single object via your handler codeNo
CUSTOM_ARRAYReturns a list via your handler codeNo
CUSTOM_PAGEDReturns paginated data via your handler codeNo

Standard routes generate SQL automatically based on:

  • Base table selection
  • Joins to related tables
  • Where clauses for filtering
  • Response property mappings
  • Order by and group by specifications

Learn more about SQL query building.

Custom Routes (CUSTOM_ONE, CUSTOM_ARRAY, CUSTOM_PAGED)

Section titled “Custom Routes (CUSTOM_ONE, CUSTOM_ARRAY, CUSTOM_PAGED)”

Custom routes delegate to your TypeScript handler code. Use these when you need:

  • External API calls
  • Complex business logic
  • File processing
  • Authentication flows

Learn more about custom routes.


PropertyDescriptionRequired
TypeRoute type (ONE, ARRAY, PAGED, CUSTOM_*)Yes
NameDescriptive name for the routeYes
DescriptionDocumentation of what the route doesYes
MethodHTTP method (GET, POST, PUT, PATCH, DELETE)Yes
PathURL path pattern (e.g., /user/by-name)Yes
MethodPurposeHas Request BodyTypical Route Types
GETRead dataNoONE, ARRAY, PAGED
POSTCreate dataYesONE, CUSTOM_ONE
PUTReplace dataYesONE, CUSTOM_ONE
PATCHPartial updateYesONE, CUSTOM_ONE
DELETERemove dataNoONE, CUSTOM_ONE

The path is the URL pattern for a route. Paths can include dynamic segments called path parameters that capture values from the URL:

PatternExample URLCaptured Value
/users/:id/users/42id = 42
/orders/:orderId/items/:itemId/orders/5/items/10orderId = 5, itemId = 10

Need custom logic?
├── Yes → CUSTOM_ONE, CUSTOM_ARRAY, or CUSTOM_PAGED
└── No → Standard route
├── Single record? → ONE
├── List of records? → ARRAY
└── Paginated list? → PAGED
TermDescription
EndpointA group of related routes sharing the same base URL
RouteA single API path that handles requests for a specific operation
Standard routeA route that automatically generates SQL queries based on schema configuration
Custom routeA route that delegates to your own handler code instead of auto-generating SQL
Path parameterA dynamic segment in a route path (e.g., :id) that captures values from the URL