API Reference

CloudSource exposes a read-only JSON API for published content. All endpoints support CORS for browser-based clients.

Quick Start

  1. 1

    Open your browser and visit:

    https://your-cms-domain.com/api/content
  2. 2

    You should see JSON with your published content items.

  3. 3

    Filter by model:

    /api/content/model/blog-post

Authentication

If you've configured an API key in Settings, include it in every request:

Header (recommended)

Authorization: Bearer YOUR_API_KEY

Query parameter

/api/content?api_key=YOUR_API_KEY

No API key configured? The API is open by default — handy during development.

Endpoints

Method Endpoint Description
GET /api/models List all content models with field definitions
GET /api/models/{slug} Get a single content model by slug
GET /api/content List all published content (paginated)
GET /api/content/model/{slug} List published content filtered by model
GET /api/content/{id} Get a single content item by ID

All endpoints can be prefixed with a space slug: /api/{space-slug}/...

Query Parameters

Parameter Default Description
page 1 Page number for pagination
per_page 20 Items per page (max 100)
resolve 1 Set to 0 for raw IDs instead of full media/relation objects
model Filter by content model slug

Code Examples

const response = await fetch('https://your-cms.com/api/content', {
  headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
const { data, meta } = await response.json();

data.forEach(item => {
  console.log(item.data.title);
});
curl https://your-cms.com/api/content \
  -H "Authorization: Bearer YOUR_API_KEY"
import requests

resp = requests.get('https://your-cms.com/api/content', headers={
    'Authorization': 'Bearer YOUR_API_KEY'
})
for item in resp.json()['data']:
    print(item['data']['title'])
$ch = curl_init('https://your-cms.com/api/content');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = json_decode(curl_exec($ch), true);

foreach ($data['data'] as $item) {
    echo $item['data']['title'];
}

Example Response

{
  "data": [
    {
      "id": 1,
      "model": "blog_post",
      "model_name": "Blog Post",
      "data": {
        "title": "Hello World",
        "body": "<p>First post content...</p>",
        "hero_image": {
          "id": 5,
          "url": "https://bucket.s3.amazonaws.com/uploads/hero.jpg",
          "filename": "hero.jpg",
          "mime_type": "image/jpeg",
          "width": 1200,
          "height": 630,
          "alt_text": "Hero image"
        }
      },
      "created_at": "2025-06-01 10:30:00",
      "updated_at": "2025-06-02 14:15:00"
    }
  ],
  "meta": {
    "total": 42,
    "page": 1,
    "per_page": 20,
    "total_pages": 3
  }
}

Error Responses

Status Meaning Response Body
401 Missing or invalid API key {"error": "Unauthorized"}
404 Item not found or not published {"error": "Not found"}