| title | List Documents |
|---|---|
| description | Retrieve all documents in a collection with optional filtering, sorting, and pagination. |
Returns a list of documents from the specified collection. Supports pagination, sorting, and field-level filtering via query parameters.
`/api/data/users*` is blocked for all keys. Use `/api/userAuth/*` for user management.x-api-key: your pk_live_… or sk_live_… key.
If the collection has RLS enabled:
public-readmode: anyone can read all documents with a validx-api-key.privatemode: requiresAuthorization: Bearer <accessToken>— only the owner's documents are returned.
const params = new URLSearchParams({
page: '1',
limit: '10',
sort: '-createdAt',
status: 'published',
include_deleted: 'true'
});
const res = await fetch(
`https://api.urbackend.in/api/data/posts?${params}`,
{
headers: {
'x-api-key': 'pk_live_YOUR_KEY'
}
}
);
const { data } = await res.json();
// data.items contains the array of matching documents
// data.total contains the total countcurl "https://api.urbackend.in/api/data/posts?page=1&limit=10&sort=-createdAt&status=published&include_deleted=true" \
-H "x-api-key: pk_live_YOUR_KEY"const res = await fetch('https://api.urbackend.in/api/data/notes', {
headers: {
'x-api-key': 'pk_live_YOUR_KEY',
'Authorization': `Bearer ${accessToken}` // Required for private-mode collections
}
});{
"success": true,
"data": {
"items": [
{
"_id": "64fd1234abcd5678ef901234",
"title": "Why BaaS is the future",
"status": "published",
"isDeleted": false,
"deletedAt": null,
"createdAt": "2024-01-15T10:30:00.000Z"
},
{
"_id": "64fd5678abcd1234ef905678",
"title": "Getting started with urBackend",
"status": "published",
"isDeleted": true,
"deletedAt": "2026-05-20T10:30:00.000Z",
"createdAt": "2024-01-14T08:00:00.000Z"
}
],
"total": 42,
"page": 1,
"limit": 10
},
"message": "Data fetched successfully"
}| Status | Cause |
|---|---|
401 Unauthorized |
Missing/invalid API key, or missing Bearer token on a private collection |
403 Forbidden |
pk_live write attempt without RLS, or quota exceeded |
404 Not Found |
Collection does not exist |