API Guide: Working with RUAL APIs
Every cluster serves REST APIs under /api/v1. Sign in at /auth/login for an access_token, send it as a bearer header, and read errors from the error field of the JSON answer. This page covers the rules that hold for all of them.
This guide covers how to call the APIs correctly. The API reference lists every endpoint with its parameters and example responses.
A scope decides whether an API is public
Public (*public) |
Private (*loggedin / custom scopes) |
|
|---|---|---|
| Authentication | None: anyone with the URL can call it | A valid access_token is required |
| Default for | Built-in cluster APIs marked public | Everything else. Your own API has to name a scope to open at all. |
| Typical use | Status pages, webhooks, public content | Anything reading or writing cluster data |
You set the audience per API block with its lock icon: *public, *loggedin (any valid token), or a custom scope you invent (for example billing_read) and then grant to selected users. A route without any scope answers 403 with ENDPOINT_NOT_PUBLIC. See Remote Access Control.
Authenticate with an access token
API calls authenticate with an access_token, obtained through the sign-in APIs. Tokens are valid for 14 days and automatically extend while actively used, so you do not need to log in again during normal operation.
The token is accepted in five equivalent locations. Pick one:
| Location | Example |
|---|---|
Authorization header (recommended) | Authorization: Bearer YOUR_TOKEN |
x-authtoken header | x-authtoken: YOUR_TOKEN |
x-token header | x-token: YOUR_TOKEN |
| Cookie | Cookie: access_token=YOUR_TOKEN |
| Query parameter | ?access_token=YOUR_TOKEN (handy for browser downloads) |
What a token may do is decided by the user's scopes: their custom_scopes plus those of their user groups. See User Roles & Permissions Explained. On clusters that enforce two-factor authentication, the login answer has verified: false and lists the available methods in 2fa; complete it through the verification endpoints such as /auth/totp/verify.
Requests follow four conventions
- Base URL:
https://<your-cluster>/api/v1. All endpoints live under it. - Content type: send and receive
application/jsonunless an endpoint documents otherwise (file upload usesmultipart/form-data). - Search endpoints accept Elasticsearch-style queries:
term(exact match),terms(one of many),match(full-text),range(dates/numbers), pluslimitandoffsetfor pagination. - Documents: every stored object carries a
_metaobject withguid,created,updatedand removal state.
Errors name a code and a status
An error returns JSON with a machine-readable code and the HTTP status. Some add a message or the fields that failed.
{
"code": 404,
"error": "DOCUMENT_NOT_FOUND"
}| Status | Meaning | First thing to check |
|---|---|---|
400 | Bad request: invalid body, params or file | Validate your JSON against the endpoint's parameter table. |
401 | Unauthenticated: INVALID_ACCESS_TOKEN, or 2FA required | Is the token present in an accepted location and not expired? |
403 | Forbidden: token valid, scope insufficient, or ENDPOINT_NOT_PUBLIC | The user's scopes against the endpoint's required scope (scoping). |
404 | Not found: endpoint or document does not exist | A typo in the path; for custom APIs: is the blueprint saved and activated? |
409 | Conflict: for example an update-hash mismatch | Re-read the document and retry with the current update_hash. |
422 | Unprocessable: validation failed | The response body names the failing rule. |
429 | Rate limited | Back off and retry with jitter; see rate limits below. |
500 | Server error | Retry once; if persistent, check the cluster logs in RUAL Studio. |
Your endpoints fall under a baseline rate limit
An endpoint without a rate limit of its own is counted against the cluster baseline. Cluster settings named http_default_rate_limit_* can raise these, or set one to 0 to turn that tier off.
| Caller | Default budget | Counted per |
|---|---|---|
| Anonymous | 1200 requests a minute | Client address, so everyone behind one NAT shares it |
| Signed in | 600 requests a minute | Session |
| Signed in, all sessions | Five times the session budget | Account |
A custom API can carry its own rate limit and a throttle (lock and wait), documented per block in Remote Access Control. When you receive a 429, retry with exponential backoff and jitter; do not retry in a tight loop.
Three calls you will use daily
Sign in to get a token
curl -X POST "https://your-cluster.rual.dev/api/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{"username": "you@example.com", "password": "..."}'The response contains your access_token: reuse it for subsequent calls.
Search the storages of a cluster
curl -X POST "https://your-cluster.rual.dev/api/v1/_system/storages/search" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"limit": 10}'Call a custom blueprint API
curl "https://your-cluster.rual.dev/api/v1/tasks?access_token=YOUR_TOKEN"Your own endpoints registered with an on api get block behave like any other API on the cluster: same auth, same error shapes. See Build Your First API.
The endpoints you reach for most
| Endpoint | Method | Purpose |
|---|---|---|
/api/v1/auth/login | POST | Sign in, receive an access token |
/api/v1/auth/logout | POST | Log out the current user |
/api/v1/users/me | GET | The current user's profile |
/api/v1/users/search | POST | List and search cluster users |
/api/v1/blueprints/search | POST | List blueprints on the cluster |
/api/v1/blueprints/update/set/active/{guid} | PUT | Activate a blueprint |
/api/v1/blueprintactions/search | POST | Read the blocks inside a blueprint |
/api/v1/_system/storages/search | POST | List storage collections |
/api/v1/_system/assets/search | POST | Search uploaded assets |
/api/v1/_system/systemlogs/search | POST | Read cluster system logs |
/api/v1/info | GET | Cluster version, flags and host info (public) |
The full list with per-endpoint parameters, example responses and required scopes lives in the Cluster API reference.
Next steps
Build Your First API Register an endpoint, reply in JSON, validate input, test with curl. Cluster API Reference Every endpoint with parameters, examples and required scopes. Remote Access Control Scopes, rate limits and throttling for your own APIs.Frequently asked
How do I authenticate against the RUAL API?
Sign in through POST /api/v1/auth/signin to receive an access_token, then send it on every call, preferably as an Authorization: Bearer header. Tokens are valid for 14 days and extend automatically while actively used.
What is the difference between public and private RUAL APIs?
Public APIs (*public) need no authentication and default to 100 requests per second per endpoint. Private APIs require a valid access token, are rate limited per user, and have configurable limits per API. Your own APIs are private unless you open them.
What do RUAL API error responses look like?
A JSON object with the HTTP status, a machine-readable code and a message, for example {"error": "DOCUMENT_NOT_FOUND", "message": "The requested document does not exist."}. A 429 means rate limited: retry with exponential backoff and jitter, never in a tight loop.
How do RUAL search endpoints work?
They accept Elasticsearch-style queries: term for exact match, terms for one of many, match for full-text and range for dates and numbers, plus limit and offset for pagination.
