HTTP API
Call Sovaria from any language: base URL, authentication, the routes an app uses, response shapes, errors and rate limits.
The SDKs are thin wrappers over this HTTP API, so anything they do you can do with curl, fetch or any HTTP client. All bodies are JSON unless a route says otherwise.
#Base URL and project
Send requests to your project URL, https://<project-ref>.sovarias.in (shown in the console under Connect). The project URL already identifies the project, so you never send project ids.
Tools that manage several projects can call https://api.sovaria.in instead, adding X-Sovaria-Org-ID and X-Sovaria-Project-ID headers. A key only works for the project it belongs to, whichever host you use.
#Authentication
| Caller | Send | Acts as |
|---|---|---|
| Anonymous visitor | apikey: <anon key> (or Authorization: Bearer <anon key>) | anon — only what your policies allow visitors. |
| Signed-in app user | Authorization: Bearer <access token> | authenticated, with auth.uid() set to the user. |
| Your server or CI | apikey: <service role or custom key> | The key's role. The service role key bypasses policies and row-level security. |
Access tokens last 15 minutes. Exchange the refresh token for a new pair before they expire (POST /api/v1/auth/refresh); the SDKs do this automatically.
#Sign up, sign in and sessions
| Route | Body | Returns |
|---|---|---|
POST /api/v1/auth/register | {email, password, name?, data?} | The new user. name defaults to the part of the email before the @; data becomes the user's user_metadata (an object, at most 16 KB) and is echoed back. 403 SIGNUP_DISABLED when sign-up is off; 422 for a weak password. |
POST /api/v1/auth/project/login | {email, password} | {access_token, refresh_token, user_id, …} |
POST /api/v1/auth/refresh | {refresh_token} | A new token pair. The old refresh token stops working (rotation). |
POST /api/v1/auth/logout | {refresh_token} | Ends the session. |
GET /api/v1/auth/me | — | The signed-in user, with user_metadata, app_metadata and is_anonymous. |
GET /api/v1/auth/public-config | — | The project's public auth settings (enabled providers, sign-up on/off) and project{id, ref}. |
GET /auth/v1/.well-known/jwks.json | — | Public keys for verifying access tokens yourself (ES256). |
URL=https://<project-ref>.sovarias.in
ANON=<anon-key>
curl -s -X POST $URL/api/v1/auth/register -H "apikey: $ANON" \
-H 'Content-Type: application/json' \
-d '{"email":"ada@example.com","password":"a-long-passphrase","name":"Ada"}'
TOKEN=$(curl -s -X POST $URL/api/v1/auth/project/login -H "apikey: $ANON" \
-H 'Content-Type: application/json' \
-d '{"email":"ada@example.com","password":"a-long-passphrase"}' | jq -r .access_token)Magic links, email codes, password reset and social sign-in are covered in Authentication overview.
#OpenAPI description
The whole public API is described at `https://api.sovaria.in/openapi.json` (OpenAPI 3.1) and https://api.sovaria.in/openapi-3.2.json (OpenAPI 3.2, with HTTP QUERY as a query operation); common multi-step flows are at https://api.sovaria.in/arazzo.json (Arazzo 1.0). They are generated from the same source as this reference, so they always match it. Every operation has a stable operationId, a When to use note, who may call it, request and response schemas with examples, typed errors, and x-sovaria-risk (read, write or destructive) — what AI agents and code generators need. No key is needed to read them; sov openapi -o sovaria.json downloads one.
#Long table reads: HTTP QUERY
A read of /rest/v1/<table> can send its parameters in the body instead of the URL with the `QUERY` method (RFC 10008): the same read as GET — same policies, row-level security and results — without URL length limits, for long in.(…) lists or many filters. The body is JSON (parameter → value; a list repeats a parameter) or the query string itself (application/x-www-form-urlencoded), at most 64 KB and 500 parameters. Answers carry Accept-Query. Networks that block unknown methods can use POST /rest/v1/_query/<table> with a JSON body instead. rpc calls are never QUERY targets.
curl -s -X QUERY "$URL/rest/v1/orders" -H "apikey: $ANON" \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"select":"id,total","id":"in.(101,102,103)","created_at":["gte.2026-01-01","lt.2026-02-01"],"limit":100}'#Database (SQL)
POST /api/v1/sql/query runs one SELECT, INSERT, UPDATE, DELETE or EXPLAIN. Pass values as params for $1, $2, …; they are bound by the database and never become part of the SQL. Schema changes (CREATE, ALTER, DROP) belong in the SQL editor or Migrations, not in app code.
curl -s -X POST $URL/api/v1/sql/query \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"sql":"select id, body from notes where id = $1","params":[42]}'Rows are arrays in the order of columns. For UPDATE and DELETE, row_count is the number of rows changed — 0 when row-level security hid every row from the caller.
#Tables over REST (PostgREST and supabase-js compatible)
/rest/v1/<table> speaks the PostgREST protocol, so supabase-js (supabase.from(…), .rpc(…)) and postgrest-py work against Sovaria by changing only the URL and key. Each request becomes one parameterised statement and runs exactly like /api/v1/sql/query: your access policies, row-level security and plan limits all apply.
import { createClient } from '@supabase/supabase-js'
const db = createClient('https://<project-ref>.sovarias.in', '<anon-key>')
const { data } = await db.from('posts').select('id,title').eq('author', userId).order('id', { ascending: false }).range(0, 9)
await db.from('posts').insert([{ title: 'Hello' }]).select()
await db.from('posts').update({ title: 'Edited' }).eq('id', 1)
const { data: total } = await db.rpc('post_count', { u: userId })| Feature | Supported |
|---|---|
select | Columns, *, alias:column, column::type (one type: ::int, ::text[], ::timestamp with time zone), JSON paths meta->>tag |
| Embedding | Related tables in select, resolved from your foreign keys: select=*,orders(*) nests an array of a table that references this one, select=*,customer:customers(id,name) nests the referenced row. One level; row-level security applies to the embedded table too. An ambiguous or missing relationship is a clear PGRST200/PGRST201 error. |
| Filters | eq neq gt gte lt lte like ilike match imatch is in cs cd ov fts plfts phfts wfts, not., or=(…)/and=(…) with nesting. match/imatch patterns are at most 256 characters, without back-references (\1), repeats over 100 or a repeated group that itself repeats ((a+)+) |
| Paging and counts | order, limit, offset, Range, Prefer: count=exact → Content-Range (count=planned / count=estimated use the planner's estimate, no table scan), HEAD. A page returns at most your plan's sql.max_rows rows. |
| Values | Rows come back as Postgres writes them in JSON (as PostgREST): numeric keeps its scale (1.500), json/jsonb columns as stored ({"k": "v"}), interval as text ("1 day 02:00:00", "3 mons"), bytea as hex ("\\x00ff10"), float NaN/Infinity as the strings "NaN"/"Infinity", timestamps as ISO 8601 with offset, bigint as a number (it can pass 2^53: parse with a big-number aware JSON reader if you need every digit). Parse the body as JSON rather than comparing text: spacing between rows can vary. |
| Writes | Insert one or many rows, upsert (Prefer: resolution=merge-duplicates / ignore-duplicates, on_conflict), update, delete, Prefer: return=representation|minimal. An upsert also needs a policy allowing UPDATE, and return=representation needs one allowing SELECT |
| Functions | POST /rest/v1/rpc/<name> with named arguments (or GET with query parameters); a function returning one value answers with that value. App users need an access policy on fn:<name> (see Row-level security and access, "Calling your functions") |
| One row | Accept: application/vnd.pgrst.object+json (.single()); any other count is 406 PGRST116 |
| Schemas | public, your project's own tables (supabase-js sends it by default). Accept-Profile / Content-Profile naming any other schema, such as auth, storage or pg_catalog, is 406 PGRST106 |
| Not yet | Nested embedding (a relation inside a relation) and filtering/ordering on an embedded table: refused with a clear error. Use a view or rpc() |
Differences that protect your data: UPDATE and DELETE need at least one filter (21000 otherwise), and a read returns at most 1,000 rows per request. Errors use PostgREST's shape, {code, message, details, hint}; a request your policies refuse is 403 with code 42501.
#Documents
| Route | Body | Notes |
|---|---|---|
POST /api/v1/data/doc/{collection}/{id} | {data: {...}} | Create or replace. Nested collections: orders/123/notes/{id}. |
GET /api/v1/data/doc/{collection}/{id} | — | Returns {key, data, found}; 404 when it doesn't exist or the caller may not see it. |
DELETE /api/v1/data/doc/{collection}/{id} | — | |
POST /api/v1/data/query/scan | {prefix, start_key?, end_key?, limit?} | Returns {documents, count, truncated}. |
#Storage
| Route | Body | Notes |
|---|---|---|
POST /api/v1/store/objects/{bucket}/{path} | multipart, field file | Upload. Bucket rules decide where a user may write. |
GET /api/v1/store/objects/{bucket}/{path} | — | Download. |
DELETE /api/v1/store/objects/{bucket}/{path} | — | |
GET /api/v1/store/objects/{bucket}?prefix= | — | List objects. |
POST /api/v1/store/objects/{bucket}/{path}/sign-download | {expires_in} (seconds) | Returns {url, expires_at, method}; the URL works without auth until it expires. |
POST /api/v1/store/objects/{bucket}/{path}/sign-upload | {expires_in, size_bytes?} | A URL a browser can PUT the file to. With size_bytes it goes straight to storage and only accepts that size; without, the upload goes through Sovaria. |
GET /api/v1/store/public/{project-id}/{bucket}/{path} | — | Public buckets only. |
GET/POST /api/v1/store/buckets, DELETE /api/v1/store/buckets/{name} | {name, public, file_size_limit?, allowed_mime_types?} | Manage buckets (console members or the service role key). |
curl -s -X POST $URL/api/v1/store/objects/avatars/$USER_ID/me.png \
-H "Authorization: Bearer $TOKEN" -F file=@me.png
curl -s -X POST $URL/api/v1/store/objects/avatars/$USER_ID/me.png/sign-download \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"expires_in":600}'#Realtime
| Route | Body | Notes |
|---|---|---|
POST /api/v1/auth/ws-ticket | {channel} | A one-time ticket for the WebSocket, for your own project only. Checked against your channel rules. |
wss://<project-ref>.sovarias.in/api/v1/rt/ws/{channel}?ticket=… | — | The connection. Tickets work once and expire within seconds. |
POST /api/v1/rt/stream/publish/{channel} | {payload: {...}} | Send to everyone on the channel. |
GET /api/v1/rt/stream/presence/{channel} | — | Who is connected. |
GET /api/v1/rt/stream/replay/{channel}?after=&limit= | — | Messages a client missed. |
#Functions
POST /functions/v1/{name} calls a deployed function. The JSON body becomes event; the caller (user, anon or key) becomes context.caller. The response is whatever the function returns.
curl -s -X POST $URL/functions/v1/order-total \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"items":[{"sku":"BK-1","qty":2}]}'#Errors
Errors use standard status codes. The body always has detail: a sentence, or an object with a code for errors you may want to handle in code. Some gateway errors also carry code and trace_id at the top level — include the trace_id (or the X-Request-ID response header) when you contact support.
| Status | Meaning | Typical cause |
|---|---|---|
400 | Bad request | Malformed JSON, a statement type that isn't allowed (SQL_ROUTE_VIOLATION), a database error such as a constraint violation. |
401 | Not authenticated | Missing, expired or revoked token or key. |
403 | Not allowed | A policy or row-level security refused it, a key used against another project, or a plan limit (see below). |
404 | Not found | Unknown bucket, object, document or function. |
409 | Conflict | The resource already exists or is not ready (for example a function that was saved but not deployed). |
413 | Too large | The body or file is over the bucket or plan limit. |
422 | Invalid input | A field failed validation (for example a weak password). |
429 | Rate limited | Too many requests — wait for Retry-After seconds. |
code | Status | What to do |
|---|---|---|
PLAN_LIMIT_REACHED, PLAN_QUOTA_EXHAUSTED, PLAN_FEATURE_REQUIRED | 403 | A plan limit — see Plans, usage and limits for the body. |
SIGNUP_DISABLED | 403 | Turn on Allow new users to sign up under Authentication → Settings, or create the user yourself. |
SQL_ROUTE_VIOLATION | 400 | Use only SELECT/INSERT/UPDATE/DELETE/EXPLAIN from app code. |
RATE_LIMIT_EXCEEDED, PROJECT_RATE_LIMIT_EXCEEDED | 429 | Back off and retry after Retry-After seconds. |
ORIGIN_NOT_ALLOWED | 403 | The browser origin isn't on the project's list. Add it — see Allowed origins (CORS) for browser apps. |
IDEMPOTENCY_IN_PROGRESS | 409 | A request with the same Idempotency-Key is still running. Wait and retry with the same key; the SDKs do this for you. |
TRANSCRIPTION_UNAVAILABLE | 501 | Voice typing (POST /api/v1/sovariq/transcribe) needs the project's own OpenAI or Groq key: connect one in Sovariq › Providers. |
IDEMPOTENCY_OUTCOME_UNKNOWN | 409 | An earlier request with this key may have been applied, but its answer was lost (a timeout or a server error after it was sent). Check whether the change happened; if it didn't, send it again with a new key. The SDKs don't retry this one. |
RESOURCE_BUSY | 503 | Another change to the same thing is in progress. Retry after Retry-After seconds. |
PROJECT_MAINTENANCE | 503 | The project database is starting or under maintenance. Retry shortly. |
UPSTREAM_UNAVAILABLE | 502 / 503 | The API couldn't reach the service behind it, or it failed. Retry with backoff; for a write, check whether it was applied first (as for UPSTREAM_TIMEOUT). |
UPSTREAM_TIMEOUT | 504 | Our edge stopped waiting for the API. The request may still have finished: check before you send a write again (or send it with the same Idempotency-Key). |
INJECTION_DETECTED | 400 | The request looked like an injection or smuggling attempt and was refused (paths, headers and management settings). Row, document, file and function payloads are your data and only need to be well-formed JSON at most 20 levels deep. Send values as parameters, not inside SQL or paths. |
Symptom-first fixes for the common ones are in Troubleshooting.
#Rate limits
Requests are limited per project and per caller; the limits grow with your plan. Rate-limited responses are 429 with Retry-After, X-RateLimit-Limit and X-RateLimit-Reset headers (and X-RateLimit-Remaining where it applies). Retry with exponential backoff rather than in a tight loop.
Successful responses carry the same X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (a Unix time) headers, so a client can slow down before it is refused. The TypeScript and Python SDKs keep the last values they saw:
const limit = sovaria.rateLimit() // { limit, remaining, resetAt: Date } or null before any response
if (limit && limit.remaining === 0 && limit.resetAt) {
await new Promise((r) => setTimeout(r, limit.resetAt!.getTime() - Date.now()))
}#Everything else
Organizations, members, policies, billing, function management and the rest are listed with their routes in the JavaScript SDK and Python SDK (each method shows the HTTP route it calls).
#Coming from Firebase or Supabase?
| Platform | What this is called there |
|---|---|
| Firebase | Firebase REST APIs |
| Supabase | Supabase REST API (PostgREST) |
| Sovaria | HTTP API |
Moving an existing app? Migrate from Supabase or Firebase imports users (with their passwords), data, files and rules.