Pottr/Docs
Topic:API Overview & Conventions
REST API
.md

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:

PatternHeadersUse Case
Dual-Header (Recommended)

Authorization: Bearer pk_live_...
X-Pottr-User-Token: <JWT>

Single-Page Apps, mobile apps, and Jamstack clients. Authenticates the site gateway and the end-user identity simultaneously.
Secret KeyAuthorization: Bearer sk_live_...Server-to-server microservices, Node/Python backends, CI/CD scripts. Full administrative bypass.
User JWT OnlyAuthorization: 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 StatusError CodeDescription
400missing_required / unknown_field / invalid_field / validation_failedA 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.
401invalid_api_key / unauthorized / invalid_tokenMissing or invalid API key, or a missing, invalid or expired user token.
403insufficient_key_scope / forbidden / entry_limit_reached / collection_limit_reachedA public key on a secret-only route, another user’s entry, or a plan limit reached.
404collection_not_found / not_foundThe collection slug or entry ID does not exist.
409concurrency_conflict / email_existsThe entry changed since you loaded it, or the email is already registered in that app.
429api_limit_exceeded / rate_limited / rate_limit_exceededYour 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 on EventSource. Secret keys are never accepted in a query string.