Appearance
API Documentation
Welcome to the CMS API documentation. This API provides endpoints for managing documents, components, content, and more.
Base URL
All API requests should be made to:
https://access.flatnode.io/api/v1Authentication
All API requests (except in test environments) require authentication using a Bearer token. The API uses Laravel Sanctum for authentication.
Getting a Token
Tokens are associated with Projects. To authenticate:
- Obtain a personal access token for your project
- Include it in the
Authorizationheader of all requests
Using the Token
Include your token in the request headers:
http
Authorization: Bearer your-token-hereToken Abilities
Tokens can have specific abilities:
create- Create new resourceswrite- Update existing resourcesread- Read resources
Example request with authentication:
bash
curl -X GET "https://access.flatnode.io/api/v1/document/1" \
-H "Authorization: Bearer your-token-here" \
-H "Content-Type: application/json"Response Format
All API responses are returned in JSON format. Successful responses typically include:
200 OK- Successful GET, PATCH, PUT, DELETE requests201 Created- Successful POST requests422 Unprocessable Entity- Validation errors404 Not Found- Resource not found401 Unauthorized- Authentication required
Date/Time Format
All datetime values are returned in RFC 3339 format in UTC with a Z suffix, for example:
json
"2013-08-14T01:10:00Z"Error Response Format
When an error occurs, the response will include a message and optionally an errors object:
json
{
"message": "The given data was invalid.",
"errors": {
"field_name": [
"The field name is required."
]
}
}Rate Limiting
API rate limiting may be applied. Check response headers for rate limit information.
Quick Start Example
Here's a complete example of creating a document with content:
bash
# 1. Create a document
curl -X POST "https://access.flatnode.io/api/v1/document" \
-H "Authorization: Bearer your-token-here" \
-H "Content-Type: application/json" \
-d '{"title": "My Document"}'
# Response: {"document": {"Id": 123}}
# 2. Create a component (string type)
curl -X POST "https://access.flatnode.io/api/v1/component" \
-H "Authorization: Bearer your-token-here" \
-H "Content-Type: application/json" \
-d '{"type": "string", "title": "A single string"}'
# Response: {"data": {"Id": 456}}
# 3. Create content using the document and component
curl -X POST "https://access.flatnode.io/api/v1/content" \
-H "Authorization: Bearer your-token-here" \
-H "Content-Type: application/json" \
-d '{
"DocumentId": 123,
"ComponentId": 456,
"position": "first",
"data": "Hello, World!"
}'
# 4. Retrieve the document to see the content
curl -X GET "https://access.flatnode.io/api/v1/document/123" \
-H "Authorization: Bearer your-token-here"
# Response: {"_value": "Hello, World!", "_uuid": "..."}Endpoints Overview
- Documents - Create and manage documents
- Components - Define component schemas
- Content - Create and manage content instances
- Slots & References - Build complex nested structures with slots and schema references
- Files - Upload and manage files
- Libraries - Manage component libraries
- Search - Search and query content
- Validation - Validate data against schemas