Use your API
Custom endpoints and mock login
Tables cover the usual CRUD routes. Custom endpoints cover the rest: POST /checkout, GET /stats, a job that is "running" twice and then "done". Mock login gives your app real sign-up and sign-in.

Create an endpoint
- Open EndpointsThe braces icon in the left rail. Click New endpoint, or start from a starter: a record from a table, a paginated list, login success or failure, echo, a job status sequence, a sometimes-failing endpoint.
- Set the method and pathUse
{name}or:namefor path parameters, like/orders/{id}/cancel, and a final*for the rest of the path. A custom endpoint on a table's path takes over that route. - Write the responseStatus, body type, headers and an optional delay. The body is a template (below).
- Try itThe Try it panel previews unsaved changes as you type, or sends a real request. Save with Ctrl S.
Templates
Bodies and header values can use values from the request and your data:
{
"order_id": {{ body.order_id | json }},
"status": "paid",
"receipt": "RCPT-{{ random_int(10000, 99999) }}",
"customer": {{ record('users', body.user_id) | json }},
"paid_at": "{{ now() }}"
}
| In a template | Meaning |
|---|---|
params, query, headers, body | The path parameters, query string, headers and JSON body of the request. |
fake.email(), fake('price') | Any data type of the field editor. |
table('users'), record('users', id), count('users') | Your project's records, read only. |
user | The signed-in user, with mock login on. |
uuid(), now(), today(), random_int(a, b), choice(list) | Helpers. |
| json | Writes a value as JSON. |
Press Ctrl Space in the editor for suggestions; Reference lists every helper. A template error answers 500 with the reason.
Several responses
An endpoint can have several responses. Those with conditions are checked first, in order, and the first that matches answers: for example, answer 402 when body.card equals a test card number. Otherwise the endpoint's mode picks one:
- First match: always the first response without conditions.
- In turn: the next one on each call, useful for polling (running, running, done).
- Random: by weight, such as 9 successes to 1 failure.
Request validation can check the body against a JSON Schema and answer 422 with the errors.
Mock login
Turn on Settings › Mock login and pick your users table. Your API then has:
| Route | Answer |
|---|---|
POST /auth/register | Creates a user and answers 201 with an access_token. |
POST /auth/login | { "email", "password" } gives a token, or 401. |
GET /auth/me | The signed-in user. |
POST /auth/logout | 204; the token stops working. |
Send the token as Authorization: Bearer <token>. Generated users sign in with the project's shared password (password123 unless you change it). Passwords never appear in answers or logs.
Per-user tables: in the same section, pick a table's owner field, like user_id for orders. Then each user sees and changes only their own records, new records get their id, and calls without a token answer 401.