urBackend provides a simplified RESTful interface for MongoDB. There is no need to write SQL or complex aggregation pipelines—just use simple JSON.
All database endpoints follow the pattern:
https://api.ub.bitbros.in/api/data/:collectionName
Replace :collectionName with the name of your collection (e.g., posts, comments, inventory).
Important
The users collection is managed through /api/userAuth/* endpoints.
Direct users access via /api/data/users* is blocked.
Endpoint: POST /api/data/:collectionName
By default, write operations require your secret key.
If you enable RLS (owner-write-only) for a collection from the dashboard, publishable-key writes are also allowed but must include a valid user token:
x-api-key: pk_live_...Authorization: Bearer <user_jwt>
Under RLS, writes are permitted only for documents owned by the authenticated user (based on configured ownerField).
If the ownerField is missing in a POST payload, urBackend can auto-fill it from the authenticated user id.
await fetch('https://api.ub.bitbros.in/api/data/posts', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
body: JSON.stringify({
title: "Why BaaS is the future",
body: "Content goes here...",
tags: ["tech", "development"],
meta: { views: 0, likes: 0 }
})
});Endpoint: GET /api/data/:collectionName
curl "https://api.ub.bitbros.in/api/data/posts" ^
-H "x-api-key: pk_live_xxx"Endpoint: GET /api/data/:collectionName/:id
curl "https://api.ub.bitbros.in/api/data/posts/64fd1234abcd5678ef901234" ^
-H "x-api-key: pk_live_xxx"Endpoint: PUT /api/data/:collectionName/:id
urBackend uses $set logic, meaning you only need to send the fields you want to change.
const postId = "YOUR_DOCUMENT_ID";
await fetch(`https://api.ub.bitbros.in/api/data/posts/${postId}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
body: JSON.stringify({
"meta.views": 105 // Nested updates are supported!
})
});Endpoint: PATCH /api/data/:collectionName/:id
await fetch(`https://api.ub.bitbros.in/api/data/posts/${postId}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
body: JSON.stringify({
title: "Edited title only"
})
});Endpoint: DELETE /api/data/:collectionName/:id
curl -X DELETE "https://api.ub.bitbros.in/api/data/posts/64fd1234abcd5678ef901234" ^
-H "x-api-key: sk_live_xxx"If you define a schema in the dashboard, urBackend will enforce it for every POST and PUT request.
- Object Support: You can define a field as an
Objectand send nested JSON. - Array Support: Define a field as an
Arrayfor lists of data. - References (Ref): Link documents across collections by storing their
_id.
401 Unauthorized: missing/invalid API key or missing/invalid JWT forpk_livewrites under RLS.403 Forbidden: owner mismatch in RLS write checks.400 Bad Request: schema validation failed (wrong type/missing required field).404 Not Found: collection or document id does not exist.