Content API Reference
The Content API provides endpoints for managing content entries programmatically. This document outlines all available content operations through the API.
Authentication
All content endpoints require API token authentication and specific content scopes. See the Authentication section for details about obtaining and using API tokens.
List Content
Retrieve a paginated list of content entries for a specific schema.
Get content entries. Requires {schema}:read scope.
GET
Base URL
/api/content/schema/:schema_slug
Headers1
Query Parameters
page
: Page number (default: 1)page_size
: Items per page (default: 10, max: 100)order_by
: Sort field (created_at
,updated_at
,slug
)order
: Sort direction (asc
ordesc
)search
: Search in slug and contentstatus
: Filter by status (published
ordraft
)
Response Format
{
"data": [
{
"id": "uuid",
"slug": "content-slug",
"content_type_id": "schema-uuid",
"data": {},
"is_published": true,
"published_at": "2024-01-01T00:00:00Z",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"status": "published"
}
],
"pagination": {
"current_page": 1,
"page_size": 10,
"total_pages": 5,
"total": 50
}
}
Get Single Content
Retrieve a specific content entry by its slug.
Get a specific content entry. Requires {schema}:read scope.
GET
Base URL
/api/content/schema/:schema_slug/:content_slug
Headers1
Create Content
Create a new content entry for a schema.
Create a new content entry. Requires {schema}:create scope.
POST
Base URL
/api/content/schema/:schema_slug
Headers1
Request Body
Request Body
slug
(required): URL-friendly identifier- Must be lowercase
- No spaces or underscores
- Unique within schema
data
(required): Content data matching schema fields- Must match schema field definitions
- All required fields must be provided
- Field types must match schema specifications
Update Content
Update an existing content entry.
Update an existing content entry. Requires {schema}:update scope.
PUT
Base URL
/api/content/schema/:schema_slug/:content_slug
Headers1
Request Body
Delete Content
Delete a content entry.
Delete a content entry. Requires {schema}:delete scope.
DELETE
Base URL
/api/content/schema/:schema_slug/:content_slug
Headers1
Request Body
Publish Content
Publish a content entry.
Publish a content entry. Requires {schema}:publish scope.
POST
Base URL
/api/content/schema/:schema_slug/:content_slug/publish
Headers1
Request Body
Unpublish Content
Unpublish a content entry.
Unpublish a content entry. Requires {schema}:publish scope.
POST
Base URL
/api/content/schema/:schema_slug/:content_slug/unpublish
Headers1
Request Body
Error Responses
400 Bad Request
{
"error": "Invalid request body"
}
401 Unauthorized
{
"error": "Missing or invalid API token"
}
403 Forbidden
{
"error": "Insufficient scope"
}
404 Not Found
{
"error": "Content not found"
}
Content Field Types
The content data structure supports various field types:
text
: Short text contenttextarea
: Long text contentrichtext
: Rich text with HTMLnumber
: Numeric valuesboolean
: True/false valuesdate
: Date in YYYY-MM-DD formatdatetime
: ISO 8601 datetimeemail
: Valid email addressselect
: Single selection from optionsrelation
: Reference to other content
Best Practices
-
Slug Management
- Use meaningful, URL-friendly slugs
- Keep slugs short but descriptive
- Avoid special characters
-
Content Validation
- Validate data before sending
- Handle required fields properly
- Respect field type constraints
-
Error Handling
- Implement proper error handling
- Check response status codes
- Handle rate limits appropriately
-
Content Versioning
- Track content versions
- Use proper update strategies
- Consider content lifecycle
Last updated on