API Reference
The ACMS dev server exposes a REST API on port 3001 (by default) for managing content fields programmatically. This API is used by the client library, the dashboard, and can be used by custom tools.
Base URL
Section titled “Base URL”http://localhost:3001/apiEndpoints
Section titled “Endpoints”Get Full Schema
Section titled “Get Full Schema”Retrieve the complete schema including fields, groups, and metadata.
GET /api/schemaResponse:
{ "fields": { "hero": { "title": "Welcome to ACMS", "subtitle": "Schema-less content management" }, "contact": { "email": "hello@example.com" } }, "groups": ["hero", "contact"], "meta": { "hero.title": { "type": "string", "lastAccessed": "2025-01-15T10:30:00.000Z" }, "hero.subtitle": { "type": "string", "lastAccessed": "2025-01-15T10:30:00.000Z" }, "contact.email": { "type": "string", "lastAccessed": "2025-01-15T10:30:00.000Z" } }}Get Content Only
Section titled “Get Content Only”Retrieve content values without metadata. This is what the client library uses to fetch content.
GET /api/contentResponse:
{ "hero": { "title": "Welcome to ACMS", "subtitle": "Schema-less content management" }, "contact": { "email": "hello@example.com" }}Update Field Value
Section titled “Update Field Value”Set or update a field’s value.
POST /api/fieldRequest body:
{ "path": "hero.title", "value": "Welcome to My Site"}Response:
{ "success": true}Register Field
Section titled “Register Field”Register a new field (used by the client proxy during development).
POST /api/registerRequest body:
{ "path": "hero.title"}Response:
{ "success": true}If the field already exists, the endpoint returns success without modifying the value.
Update Field Metadata
Section titled “Update Field Metadata”Update metadata for a field (type, label, default value, etc.).
PATCH /api/field/:path/metaExample:
curl -X PATCH http://localhost:3001/api/field/hero.title/meta \ -H "Content-Type: application/json" \ -d '{"type": "text"}'Request body:
{ "type": "text", "label": "Hero Title", "defaultValue": "Default Title"}Response:
{ "success": true}Delete Field
Section titled “Delete Field”Remove a field from the schema.
DELETE /api/field/:pathExample:
curl -X DELETE http://localhost:3001/api/field/hero.subtitleResponse:
{ "success": true}Create New Field
Section titled “Create New Field”Create a new field with a specified type.
POST /api/field/newRequest body:
{ "path": "hero.ctaText", "type": "string", "value": "Learn More"}Response:
{ "success": true}Push Array Item
Section titled “Push Array Item”Add an item to an array field.
POST /api/array/:path/pushExample:
curl -X POST http://localhost:3001/api/array/features/push \ -H "Content-Type: application/json" \ -d '{"value": "New Feature"}'Request body:
{ "value": "New Feature"}Response:
{ "success": true}Remove Array Item
Section titled “Remove Array Item”Remove an item from an array by index.
DELETE /api/array/:path/:indexExample:
curl -X DELETE http://localhost:3001/api/array/features/2Response:
{ "success": true}Reorder Array Items
Section titled “Reorder Array Items”Change the order of items in an array.
PATCH /api/array/:path/reorderRequest body:
{ "from": 0, "to": 2}Response:
{ "success": true}Server-Sent Events
Section titled “Server-Sent Events”Subscribe to real-time schema updates.
GET /api/eventsThis endpoint returns an SSE stream. The server sends events whenever acms.json is modified:
event: schema-updatedata: {"type": "schema-update"}Example usage in JavaScript:
const eventSource = new EventSource('http://localhost:3001/api/events');
eventSource.addEventListener('schema-update', (event) => { console.log('Schema updated, refetching...'); // Refetch content from /api/content});Error Responses
Section titled “Error Responses”All endpoints return standard error responses:
{ "error": "Field not found", "status": 404}Common HTTP status codes:
| Status | Meaning |
|---|---|
200 | Success |
400 | Bad request (invalid path, missing body) |
404 | Field not found |
409 | Conflict (reserved field name) |
500 | Internal server error |
The dev server enables CORS for all origins, allowing requests from any frontend application running on any port during development.
Next Steps
Section titled “Next Steps”- Set up the Dashboard for visual editing
- Learn about TypeScript integration
- Explore Framework Guides for your stack