API Endpoints
Base URL
All API requests use your configured base URL:
https://dbindly.com/api
Authentication
Include your API key in the X-API-Key header:
curl -H "X-API-Key: pk_live_your_key" https://dbindly.com/api/public/data/your-data-id
Endpoints
Get Single Item
Fetch a single data item by its unique ID.
GET /public/data/{dataId}
Parameters:
| Parameter | Type | Description |
|---|---|---|
dataId | string | Unique identifier for the data item |
Response:
{
"id": "clx123...",
"dataId": "product-001",
"collectionId": "clx456...",
"data": {
"name": "Product Name",
"price": 99.99,
"description": "Product description"
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
Example:
curl -X GET \
-H "X-API-Key: pk_live_your_key" \
https://dbindly.com/api/public/data/product-001
Batch Fetch
Fetch multiple items in a single request.
POST /public/batch
Request Body:
{
"dataIds": ["id1", "id2", "id3"],
"fields": ["name", "price"] // optional
}
Parameters:
| Parameter | Type | Description |
|---|---|---|
dataIds | array | Array of data IDs (max 100) |
fields | array | Optional - specific fields to return |
Response:
{
"data": [
{
"dataId": "id1",
"data": { "name": "Item 1", "price": 10 }
},
{
"dataId": "id2",
"data": { "name": "Item 2", "price": 20 }
}
],
"found": 2,
"notFound": ["id3"]
}
Example:
curl -X POST \
-H "X-API-Key: pk_live_your_key" \
-H "Content-Type: application/json" \
-d '{"dataIds": ["product-001", "product-002"]}' \
https://dbindly.com/api/public/batch
Get Collection Data
Fetch all data from a collection with pagination and sorting.
GET /public/collections/{slug}/data
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
slug | string | required | Collection slug |
page | number | 1 | Page number |
limit | number | 20 | Items per page (max 100) |
sort | string | createdAt | Field to sort by |
order | string | desc | Sort order (asc/desc) |
Response:
{
"data": [
{
"dataId": "product-001",
"data": { "name": "Product 1", "price": 99 }
},
{
"dataId": "product-002",
"data": { "name": "Product 2", "price": 149 }
}
],
"total": 50,
"page": 1,
"limit": 20,
"totalPages": 3
}
Example:
curl -X GET \
-H "X-API-Key: pk_live_your_key" \
"https://dbindly.com/api/public/collections/products/data?page=1&limit=10&sort=price&order=asc"
Error Responses
400 Bad Request
Invalid request parameters.
{
"error": "Bad Request",
"message": "Invalid dataId format"
}
401 Unauthorized
Missing or invalid API key.
{
"error": "Unauthorized",
"message": "Invalid API key"
}
403 Forbidden
Domain not whitelisted for this API key.
{
"error": "Forbidden",
"message": "Domain not allowed for this API key"
}
404 Not Found
Resource not found.
{
"error": "Not Found",
"message": "Data not found"
}
429 Too Many Requests
Rate limit exceeded.
{
"error": "Too Many Requests",
"message": "Rate limit exceeded. Try again in 60 seconds."
}
Rate Limiting
API keys have configurable rate limits. Default is 1000 requests per minute.
Rate limit headers are included in responses:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1705312800
CORS
CORS is automatically configured based on your API key's allowed domains. Only requests from whitelisted domains will be accepted.
JavaScript SDK
Use DBindly's built-in methods instead of direct API calls:
// Single item
const data = await DBindly.fetchData('product-001');
// Batch fetch
const items = await DBindly.fetchBatch(['id1', 'id2', 'id3']);
// Collection with pagination
const result = await DBindly.fetchCollection('products', {
page: 1,
limit: 20,
sort: 'price',
order: 'asc'
});
Next Steps
- API Keys - Manage your API keys
- Configuration - Client configuration