Skip to content

Sites API

The Sites API provides endpoints for working with site configuration, listing site-scoped pages, checking pathname availability, moving pages to new URLs, and finding untranslated content. Conloca supports multiple sites, each with its own set of locales, collections, and content.

All endpoints are relative to the API base URL (default: /__cms/api).


Get Sites Configuration

GET /sites

Get the full sites configuration including all sites, their locales, default locales, and domain mappings. This is the entry point for understanding the content structure.

Parameters: None

Response: 200 OK

// SitesConfig
{
  sites: {
    [siteName: string]: {
      locales: string[]
      defaultLocale: string
      domains?: {
        [locale: string]: string
      }
    }
  }
  globalLocales: string[]
}

Example:

curl http://localhost:4321/__cms/api/sites
{
  "sites": {
    "default": {
      "locales": ["en", "de", "zh"],
      "defaultLocale": "en",
      "domains": {
        "en": "example.com",
        "de": "example.de"
      }
    }
  },
  "globalLocales": ["en", "de", "zh"]
}

Get Site Collections

GET /:site/collections

Get all content collections for a specific site. Also works with blocks as the site name to get block collections.

Parameters:

NameInTypeRequiredDescription
sitepathstringyesSite name (or blocks for block collections)

Response: 200 OK

{
  collections: string[]
}

Errors:

StatusCodeDescription
404SITE_NOT_FOUNDNo site with this name

Example:

# Get collections for a site
curl http://localhost:4321/__cms/api/default/collections

# Get block collections
curl http://localhost:4321/__cms/api/blocks/collections
{
  "collections": ["blog", "pages"]
}

List Site Pages

GET /:site/pages

List all pages for a specific site. Not valid for the blocks scope.

Parameters:

NameInTypeRequiredDescription
sitepathstringyesSite name
localequerystringnoFilter by locale

Response: 200 OK

{
  items: ContentManifest[]
  total: number
}

Errors:

StatusCodeDescription
400INVALID_REQUESTCannot list pages for blocks scope
404SITE_NOT_FOUNDNo site with this name

Example:

# List all pages for a site
curl http://localhost:4321/__cms/api/default/pages

# List pages filtered by locale
curl "http://localhost:4321/__cms/api/default/pages?locale=en"

Check Pathname Availability

GET /:site/pathname-available

Check whether a URL pathname is available within a site. Used by the editor to validate pathnames before creating or moving pages.

Parameters:

NameInTypeRequiredDescription
sitepathstringyesSite name
pathnamequerystringyesPathname to check (e.g., /about)
localequerystringnoLocale to check in (default: en)
excludeIdquerystringnoExclude this content ID (for rename operations)

Response: 200 OK

// Available
{
  available: true;
}

// Taken
{
  available: false;
  existingId: string; // ID of the page using this pathname
}

Errors:

StatusCodeDescription
400MISSING_REQUIRED_FIELDpathname query parameter missing
400INVALID_REQUESTCannot check pathnames for blocks scope
404SITE_NOT_FOUNDNo site with this name

Example:

curl "http://localhost:4321/__cms/api/default/pathname-available?pathname=/about&locale=en"

Move Page

POST /:site/move

Move a page to a new pathname within a site. Uses etag-based concurrency control. The previous pathname is recorded for redirect handling.

Parameters:

NameInTypeRequiredDescription
sitepathstringyesSite name

Request Body:

{
  id: string; // Content ID of the page to move
  pathname: string; // New pathname
  locale: string; // Locale to update
  etag: string; // Current etag for concurrency check
}

Response: 200 OK

{
  moved: true;
  previousPathname: string;
  etag: string; // New etag after the move
}

Errors:

StatusCodeDescription
400MISSING_REQUIRED_FIELDMissing id, pathname, locale, or etag
404SITE_NOT_FOUNDNo site with this name
404CONTENT_NOT_FOUNDPage not found
409PATHNAME_TAKENAnother page already uses this pathname
412-Etag mismatch (stale write)

Example:

curl -X POST http://localhost:4321/__cms/api/default/move \
  -H "Content-Type: application/json" \
  -d '{
    "id": "abc123",
    "pathname": "/new-about",
    "locale": "en",
    "etag": "a1b2c3.d4e5f6"
  }'

Find Untranslated Content

GET /untranslated/:targetLocale

Find content that has not been translated to a specific locale. Useful for building translation dashboards and workflows.

Parameters:

NameInTypeRequiredDescription
targetLocalepathstringyesLocale to find missing translations for
excludeSitesquerystringnoComma-separated site names to exclude
includeUnpublishedquery'true'noInclude unpublished content in results

Response: 200 OK

{
  items: ContentManifest[]
  total: number
}

Example:

# Find content missing German translations
curl http://localhost:4321/__cms/api/untranslated/de

# Exclude specific sites
curl "http://localhost:4321/__cms/api/untranslated/de?excludeSites=internal"

# Include unpublished content
curl "http://localhost:4321/__cms/api/untranslated/de?includeUnpublished=true"