Reference
REST API
The HTTP endpoints behind the SDK.
The SDK is a thin layer over a plain REST API. You can call it directly from anywhere. All endpoints are prefixed with /v1 and return JSON.
Authentication
curl https://api.unitcms.dev/v1/projects/proj_123/content/articles \
-H "Authorization: Bearer unit_prod_pub_..."Content
GET /v1/projects/:projectId/content/:type
GET /v1/projects/:projectId/content/:type/:idOnly published entries are returned by default. Supports limit as a query parameter.
Config
GET /v1/projects/:projectId/configFlags
GET /v1/projects/:projectId/flagsManagement API
Everything the dashboard does is available over HTTP with an admin key. Admin routes live under /v1/projects/:projectId/admin and apply to the environment the key belongs to. Never put an admin key in a mobile app.
| Resource | Endpoints |
|---|---|
types | GET, POST /types · PUT, DELETE /types/:name |
entries | GET, POST /entries · GET, PATCH, DELETE /entries/:id · POST /entries/:id/publish and /unpublish |
config | GET /config · PUT, DELETE /config/:key |
flags | GET /flags · PUT, DELETE /flags/:key |
media | GET, POST /media · DELETE /media/:id |
keys | GET, POST /keys · DELETE /keys/:id (revokes) |
curl -X POST https://api.unitcms.dev/v1/projects/proj_123/admin/entries \
-H "Authorization: Bearer unit_prod_adm_..." \
-H "Content-Type: application/json" \
-d '{ "type": "articles", "data": { "title": "Hello" }, "status": "published" }'Drafts can be saved incomplete. Required fields in the content type are enforced when you publish, and unknown fields are always rejected.
Caching headers
Delivery responses include an ETag and Cache-Control: private, max-age=15, stale-while-revalidate=300. Send If-None-Match to get a 304 when nothing changed.
Errors
Errors use one shape: { "error": { "code", "message", "issues"? } }.
| Status | Meaning |
|---|---|
401 | Missing or invalid key |
403 | The key cannot access this project or environment |
404 | Unknown project, type or entry |
429 | Too many requests |