POST /orders/{id}/pay is a route. It reads like the rest of a REST API and works from anything that can make an HTTP request, including your app.

Logic → Routes: custom endpoints under /rest/v1, handled by a flow.
pawabase.routes.
Call a route
/rest/v1/. A leading slash is ignored. Use the path exactly as the route was defined, with the real values in place of the {parameters}.
Query strings and bodies
post, put and patch, and the query string for get and delete. To send both a body and a query string, pass params={…} for the query:
Any method with call
call(method, path, options) is the general form. The shortcuts are built on it.
Type results (TypeScript)
Options
GET is retried safely by the client after rate limits and temporary server errors. Other methods follow the idempotent flag.
Access and errors
A route has its own access rule, evaluated against the caller before anything runs. Errors are the standard ones:Designing route paths
- Use nouns and ids in the path, verbs in the method:
POST /orders/42/refund, notPOST /doRefund. - Keep ids in the path, optional filters in the query, and the details in the body.
- Return
404for an id that does not exist or that the caller may not see, so you do not leak which exist. - Return
409for “already done”, and make repeating a call harmless.
Routes versus the database API
You already havefrom("orders") for plain create/read/update/delete on a table. Use a route when:
- The action is not a simple row change (pay, refund, publish, invite).
- You need to change several tables together, or validate across them.
- You want a stable external API that does not expose your table shape.
Flows
The automation behind a route.
Patterns
Designs that combine them.