REST API
API Overview & Conventions
Base URLs, authentication headers, payload conventions, response structures, and standard error handling.
Base Endpoint
All Pottr REST routes are anchored under the following base URL:
Authentication Header Model
Pottr supports three primary authentication patterns depending on your client environment:
| Pattern | Headers | Use Case |
|---|---|---|
| Dual-Header (Recommended) |
| Single-Page Apps, mobile apps, and Jamstack clients. Authenticates the site gateway and the end-user identity simultaneously. |
| Secret Key | Authorization: Bearer sk_live_... | Server-to-server microservices, Node/Python backends, CI/CD scripts. Full administrative bypass. |
| User JWT Only | Authorization: Bearer <JWT> | Direct user authentication endpoints and user-scoped data calls. |
Standard Error Response Format
When an error occurs, Pottr returns a normalized JSON error payload accompanied by the relevant HTTP status code:
401 Unauthorized Response
{
"error": true,
"code": "invalid_api_key",
"message": "The provided API key is invalid or revoked."
}Common Error Codes
| HTTP Status | Error Code | Description |
|---|---|---|
400 | missing_required / unknown_field / invalid_field / validation_failed | A required field is missing or empty, the body has a key that is not in the schema, or a value fails its field type or validation rule. |
401 | invalid_api_key / unauthorized / invalid_token | Missing or invalid API key, or a missing, invalid or expired user token. |
403 | insufficient_key_scope / forbidden / entry_limit_reached / collection_limit_reached | A public key on a secret-only route, another user’s entry, or a plan limit reached. |
404 | collection_not_found / not_found | The collection slug or entry ID does not exist. |
409 | concurrency_conflict / email_exists | The entry changed since you loaded it, or the email is already registered in that app. |
429 | api_limit_exceeded / rate_limited / rate_limit_exceeded | Your monthly API-call quota is used up (writes pause first), or a rate limit was hit. Check the Retry-After header when present. |
Response Formats
By default, list endpoints return flattened entries (id as a string, created_at and your fields), and create, get and update return the stored entry. To get one uniform shape everywhere, opt in to the standard envelope with ?format=standard or the header Accept: application/vnd.pottr.v1+json:
Standard format
{
"data": {
"id": "87",
"collection": "tasks",
"attributes": { "title": "Ship documentation", "completed": false },
"created_at": "2026-11-18 10:00:00",
"updated_at": "2026-11-18 10:05:00"
}
}Other Headers
X-Pottr-App: names the app when one site hosts several, so app-user tokens and tables resolve to the right app.- Live event streams (
/events) accept the key and token as query parameters because browsers cannot set headers onEventSource. Secret keys are never accepted in a query string.