REST API
ZendBX exposes a universal REST API for every table. No manual endpoint creation required. Supports Supabase-compatible query parameters.
Base URL
text
https://api.zendbx.inAuthentication
Every request needs two headers:
http
Authorization: Bearer <user-token> # Authenticated user JWT
apikey: <anon-key> # Project anon key (identifies the project)
Content-Type: application/json # Required for POST/PATCH💡The
apikey header identifies your project. The Authorization header authenticates the user. Both are required for protected endpoints.CRUD Endpoints
GETSelect rows
http
GET /rest/v1/todos
Authorization: Bearer <token>
apikey: <anon-key>GETSelect with filters
http
GET /rest/v1/todos?status=eq.active&limit=20&order=created_at.desc
Authorization: Bearer <token>
apikey: <anon-key>POSTInsert a row
http
POST /rest/v1/todos
Authorization: Bearer <token>
apikey: <anon-key>
Content-Type: application/json
{
"title": "Buy groceries",
"done": false
}PATCHUpdate a row
http
PATCH /rest/v1/todos?id=eq.some-uuid
Authorization: Bearer <token>
apikey: <anon-key>
Content-Type: application/json
{
"done": true
}DELETEDelete a row
http
DELETE /rest/v1/todos?id=eq.some-uuid
Authorization: Bearer <token>
apikey: <anon-key>Schema-Qualified Tables
Target tables in a specific schema using dot notation.zenhire.resumes → table resumes in schema zenhire.
http
# Dot notation for schema-qualified tables
POST /rest/v1/zenhire.resumes
Authorization: Bearer <token>
apikey: <anon-key>
Content-Type: application/json
{
"user_id": "uuid",
"filename": "resume.pdf",
"score": 85
}⚠️Previously, a bug caused POST requests to schema-qualified tables to attempt DDL (CREATE TABLE). This is fixed in the current version — POST always executes INSERT only.
Project-Scoped Routes
For Supabase SDK compatibility, REST endpoints are also available under /p/{slug}/:
http
# REST under /p/{slug}/ — for Supabase-compatible SDK usage
POST /p/my-project/rest/v1/todos
Authorization: Bearer <token>
apikey: <anon-key>
Content-Type: application/json
{ "title": "Task", "done": false }Filter Reference
bash
# Available filter operators:
?column=eq.value # column = value
?column=neq.value # column != value
?column=gt.value # column > value
?column=gte.value # column >= value
?column=lt.value # column < value
?column=lte.value # column <= value
?column=like.*pattern* # column LIKE '%pattern%'
?column=ilike.*pattern* # column ILIKE '%pattern%' (case-insensitive)
?column=is.null # column IS NULL
?column=is.not.null # column IS NOT NULL
# Pagination
?limit=20&offset=0
# Ordering
?order=created_at.desc
?order=salary.ascFull cURL Example
bash
curl -X POST https://api.zendbx.in/rest/v1/todos \
-H "Authorization: Bearer eyJhbGci..." \
-H "apikey: your-anon-key" \
-H "Content-Type: application/json" \
-d '{"title":"Hello ZendBX","done":false}'Status Codes
| Code | Meaning |
|---|---|
| 200 | Success — data returned |
| 201 | Created — row inserted |
| 400 | Bad request — malformed body or missing filter |
| 401 | Unauthorized — missing or invalid token |
| 403 | Forbidden — RLS policy blocked the operation |
| 404 | Not found — row or resource does not exist |
| 409 | Conflict — unique constraint violation |
| 500 | Server error — check the detail field in the response |
Error Response Format
json
{
"detail": {
"message": "null value in column \"user_id\" violates not-null constraint",
"sqlstate": "23502",
"detail": "Failing row contains (null, ...).",
"hint": null,
"constraint": null,
"column": "user_id"
}
}
