</>
    SaCMS
    FiturHargaLayananDokumentasi

    Getting Started

    • Introduction
    • Authentication
    • SDK (TypeScript)

    REST API

    • Content API
    • Single Types API

    REST API Documentation

    SaCMS provides a powerful, read-only public REST API to fetch your managed content securely. Built for speed and flexibility, it supports advanced filtering, pagination, and population.

    Base URL: https://[your-domain]/api/public/[tenant]

    Authentication

    All public API requests must include your API key in the headers. You can generate API keys from your SaCMS Dashboard under the Developer settings.

    Headers
    x-api-key: your_api_key_here

    SDK (TypeScript)

    The official SaCMS TypeScript SDK provides a fluent query builder and built-in rate-limit handling. It's the recommended way to fetch data in Next.js, React, or Node.js.

    Example Usage
    import { SaCMS } from '@sacms/sdk'
    
    // Initialize client
    const sacms = new SaCMS({
      baseUrl: 'https://api.yourdomain.com',
      tenant: 'your-tenant-slug',
      token: 'your-api-key'
    })
    
    // Fluent Query Builder
    const response = await sacms.collection('articles')
      .query()
      .where('status', 'eq', 'PUBLISHED')
      .populate(['author'])
      .limit(10)
      .fetch()

    Content API

    Fetch multiple entries of a specific Content Type (Collection). Supports Strapi-like filtering operators.

    GET/content/[contentTypeSlug]
    Example Request
    fetch('/api/public/my-tenant/content/articles?filters[title][$contains]=Next.js&limit=10', {
      headers: {
        'x-api-key': '...'
      }
    })
    Response
    {
      "data": [
        {
          "id": "cm...123",
          "data": {
            "title": "Learning Next.js 16",
            "slug": "learning-nextjs-16"
          },
          "status": "PUBLISHED",
          "createdAt": "2026-05-21T00:00:00.000Z"
        }
      ],
      "meta": {
        "total": 1,
        "page": 1,
        "limit": 10
      }
    }

    Single Types API

    Fetch data for Single Types (e.g., Global Settings, Homepage configuration).

    GET/single/[singleTypeSlug]
    Example Request
    fetch('/api/public/my-tenant/single/global-settings', {
      headers: { 'x-api-key': '...' }
    })