API Reference
RESTful API for collections and records.
How It Works
ReadySite connects your systems to your users through a unified data layer.
POST /api/records
{{range .Records}}
Sync data via API → Store in collections → Render instantly in pages
Base URL
https://your-site.com/api
All endpoints return JSON. Include your token in the Authorization header:
Authorization: Bearer your-token-here
Errors return JSON with a message field:
{"message": "record not found"} // 404
{"message": "unauthorized"} // 401
Don't want to write API calls? The AI assistant can create, update, and delete records for you through natural language.
Records
/collections/{collectionId}/records
List all records with optional filtering and pagination.
/collections/{collectionId}/records/{id}
Get a single record by ID.
/collections/{collectionId}/records
Create a new record. Returns 201 on success.
/collections/{collectionId}/records/{id}
Update an existing record.
/collections/{collectionId}/records/{id}
Delete a record. Returns 204 on success.
Real-time
/collections/{collectionId}/subscribe
Subscribe to changes via Server-Sent Events.
const events = new EventSource('/api/collections/posts/subscribe');
events.addEventListener('create', e => {
console.log(JSON.parse(e.data));
});
// Each event sends a JSON payload:
{
"action": "create", // "create", "update", or "delete"
"record": {
"id": "abc123",
"title": "New Post",
"content": "Hello world"
}
}
Filtering
Pass filters as the filter query parameter: /api/collections/posts/records?filter=status = 'published' && views > 100
=
Equal
status = 'published'
!=
Not equal
status != 'draft'
> <
Comparison
views > 100
~
Contains
title ~ 'hello'
&&
AND
a = 1 && b = 2
||
OR
a = 1 || b = 2