https://api.ub.bitbros.inPattern:
https://api.ub.bitbros.in/api/data/:collectionName
Replace :collectionName with the name of your collection (e.g., posts, products, orders).
API keys and write access
Use
sk_live for server-side writes. Use pk_live + RLS + a user JWT to let authenticated frontend users write their own data. See Row-Level Security for details.
Create a document
Endpoint:POST /api/data/:collectionName
By default, write operations require your secret key (sk_live_...). If you enable RLS on the collection, you can also write with a publishable key and a valid user JWT.
When writing with
pk_live and RLS enabled, you can omit the owner field from the body. urBackend will automatically set it to the authenticated user’s ID.Read documents
Read operations use your publishable key (pk_live_...) and never expose your secret key in frontend code.
Fetch all documents
Endpoint:GET /api/data/:collectionName
Fetch a single document
Endpoint:GET /api/data/:collectionName/:id
Query parameters
Use query parameters to filter, sort, and paginate results.Advanced filtering
You can append suffixes to field names in the query string to apply MongoDB comparison operators._regex patterns are capped at 128 characters; invalid or oversized patterns return 400 Bad Request.
Filtering example — published posts, newest first, price strictly greater than 10 and strictly less than 50 (exclusive bounds):
Update a document
PUT replaces specified fields using $set logic — you only send the fields you want to change, not the entire document. Nested field updates are supported using dot notation.
Endpoint: PUT /api/data/:collectionName/:id
Partial update
PATCH works the same way as PUT for partial updates. Use it when you want to update a subset of fields.
Endpoint: PATCH /api/data/:collectionName/:id
Soft delete and trash
When you delete a document usingDELETE /api/data/:collectionName/:id, your backend moves it to the trash instead of removing it immediately.
- Documents enter a 30-day grace period before permanent deletion.
- You can view trashed documents by appending the
include_deleted=truequery parameter to your read or aggregation requests. - A background BullMQ cleanup worker automatically hard-deletes expired documents after 30 days.
Your
databaseUsed quota is only reclaimed after the 30-day period when the cleanup worker permanently deletes the expired documents.Schema validation
If you define a schema for a collection in the dashboard, urBackend enforces it on everyPOST and PUT request. Supported field types include:
- String, Number, Boolean, Date — scalar values
- Object — nested JSON structures
- Array — lists of values
- Ref — references to documents in another collection (stores
_id)
400 Bad Request with a message describing which field failed and why.
Connect your own MongoDB (BYOD)
By default, your project runs on urBackend’s managed MongoDB. You can switch to your own cluster (for example, MongoDB Atlas) at any time from Dashboard → Project Settings → Database (MongoDB). Your data stays in your cluster; urBackend only holds the encrypted connection string.Add a connection string
- Open Project Settings → Database (MongoDB).
- Paste a standard MongoDB connection URI (for example,
mongodb+srv://user:pass@cluster.mongodb.net/dbname). - Click Connect Database.
400 Bad Request and the configuration is not stored.
Whitelist the server IPs
MongoDB Atlas and most self-hosted clusters block inbound connections by default. Because urBackend validates the URI from two separate services, you must whitelist both server IPs in your cluster’s network access list (Atlas: Network Access → IP Access List). The dashboard shows both public IPs directly under the connection URI field (“Public IP:”). Copy them into your Atlas allowlist before clicking Connect Database. If either IP is not whitelisted, you’ll see:URI restrictions
urBackend rejects connection strings that point at internal or unreachable hosts. The following are blocked and return400 Bad Request with the message DB URI is pointing to a restricted host, internal network, or unsupported URI format.:
localhostand themetadata.google.internalcloud metadata endpoint- Loopback addresses (
127.0.0.0/8,::1) - RFC-1918 private ranges (
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16) - Link-local, unique local, and unspecified IPv6 addresses
- IPv4-mapped IPv6 addresses (
::ffff:x.x.x.x) that resolve to any of the above - Hostnames whose DNS records resolve to any restricted range
mongodb+srv://<cluster>.mongodb.net hostname provided in the Atlas UI is the right value to paste.
Timeouts and connection errors
Each verification connection uses a 5-second server-selection timeout, and the overall check across both services is capped at ~9.5 seconds. Common outcomes:
Once verification passes, the dashboard shows Connected to external MongoDB and all
/api/data/* traffic for the project routes to your cluster. Use Update URI to rotate the connection string, or Remove to switch back to urBackend’s managed database.
