Skip to content

Back to main site

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/v1

Authentication

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:

  1. Obtain a personal access token for your project
  2. Include it in the Authorization header of all requests

Using the Token

Include your token in the request headers:

http
Authorization: Bearer your-token-here

Token Abilities

Tokens can have specific abilities:

  • create - Create new resources
  • write - Update existing resources
  • read - 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 requests
  • 201 Created - Successful POST requests
  • 422 Unprocessable Entity - Validation errors
  • 404 Not Found - Resource not found
  • 401 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