DBindly Docs
API Reference

API Endpoints

Base URL

All API requests use the production API domain:

https://api.dbindly.com

Authentication

Include your API key in the X-API-Key header:

curl -H "X-API-Key: pk_live_your_key" https://api.dbindly.com/public/data/your-data-id

Endpoints

Get Single Item

Fetch a single data item by its unique ID.

GET /public/data/{dataId}

Parameters:

ParameterTypeDescription
dataIdstringUnique 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://api.dbindly.com/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:

ParameterTypeDescription
dataIdsarrayArray of data IDs (max 100)
fieldsarrayOptional - 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://api.dbindly.com/public/batch

Get Collection Data

Fetch all data from a collection with pagination and sorting.

GET /public/collections/{slug}/data

Parameters:

ParameterTypeDefaultDescription
slugstringrequiredCollection slug
pagenumber1Page number
limitnumber20Items per page (max 100)
sortstringcreatedAtField to sort by
orderstringdescSort 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://api.dbindly.com/public/collections/products/data?page=1&limit=10&sort=price&order=asc"

Subscribe to Real-Time Updates (SSE)

Open a Server-Sent Events stream that pushes data changes as they happen. Requires a plan with reactive mode (Business or higher). The JavaScript SDK uses this endpoint automatically when reactive: true is set — you only need it directly for custom integrations.

GET /subscribe

Parameters (query string — EventSource cannot set headers, so the API key travels as a parameter on this endpoint only):

ParameterTypeDefaultDescription
apiKeystringrequiredYour public API key
collectionsstring-Comma-separated collection slugs to watch (max 25)
dataIdsstring-Comma-separated data IDs to watch (max 100)

Events:

event: connected
data: {"connectionId": "...", "ttlMs": 240000}

event: update
data: {"dataId": "product-001", "data": {"name": "Product 1", "price": 99}, "action": "update"}

event: update
data: {"collectionSlug": "products", "data": {"data": [...], "total": 50, "page": 1, "limit": 20, "totalPages": 3}, "action": "update"}

event: delete
data: {"dataId": "product-001", "data": {}, "action": "delete"}

event: reconnect
data: {"reason": "cycle"}

The first messages after connecting are a snapshot of everything subscribed, so a client is always current after a (re)connect. The server closes each stream after a few minutes (reconnect event); EventSource reconnects automatically. One usage-metered API call is logged per connection cycle, not per update.

Example:

const stream = new EventSource(
  'https://api.dbindly.com/subscribe?apiKey=pk_live_your_key&collections=products'
);
stream.addEventListener('update', (e) => {
  console.log('Changed:', JSON.parse(e.data));
});

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 later."
}

Rate Limiting

API keys have configurable rate limits. Default is 1000 requests per hour, with the window resetting at the top of each hour. Plans may also enforce a monthly request limit.

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