Skip to content

Data API

The Data API manages structured data entries — content that is not a page or block, such as navigation items, settings, or any custom data collections. Data entries are identified by a name within a collection and support multiple locales.

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


List Data Collections

GET /data/collections

List all data collections available in the system.

Parameters: None

Response: 200 OK

{
  collections: string[]
}

Example:

curl http://localhost:4321/__cms/api/data/collections
{
  "collections": ["navigation", "settings"]
}

Check Data Name Availability

GET /data/name-available

Check whether a data entry name is available within a collection. Useful for validating names before creating or renaming data entries.

Parameters:

NameInTypeRequiredDescription
namequerystringyesData entry name to check
collectionquerystringyesCollection to check in
excludeIdquerystringnoExclude this content ID from the check (for rename operations)

Response: 200 OK

// Available
{
  available: true;
}

// Taken
{
  available: false;
  existingId: string; // ID of the data entry using this name
}

Errors:

StatusCodeDescription
400MISSING_REQUIRED_FIELDname or collection query parameter not provided

Example:

curl "http://localhost:4321/__cms/api/data/name-available?name=main-nav&collection=navigation"

List Data Entries

GET /data

List data entries with optional filters.

Parameters:

NameInTypeRequiredDescription
collectionquerystringnoFilter by collection
localequerystringnoFilter by locale

Response: 200 OK

{
  items: ContentManifest[]
  total: number
}

Example:

# List all data entries
curl http://localhost:4321/__cms/api/data

# List data entries in a specific collection
curl "http://localhost:4321/__cms/api/data?collection=navigation"

Get Data Entry by Name

GET /data/:name

Get a data entry by its name within a collection.

Parameters:

NameInTypeRequiredDescription
namepathstringyesData entry name
collectionquerystringyesCollection the entry belongs to
localequerystringnoIf provided, return only this locale’s data

Response: 200 OK

// ContentManifest (or filtered to single locale)
{
  id: string
  type: 'json'
  kind: 'data'
  collection: string
  locales: {
    [locale: string]: {
      locale: string
      etag: string
      created: string
      modified: string
      name: string
      meta: ContentMeta
    }
  }
}

Errors:

StatusCodeDescription
400MISSING_REQUIRED_FIELDcollection query parameter not provided
404CONTENT_NOT_FOUNDData entry not found in the specified collection

Example:

# Get a data entry
curl "http://localhost:4321/__cms/api/data/main-nav?collection=navigation"

# Get only the English locale
curl "http://localhost:4321/__cms/api/data/main-nav?collection=navigation&locale=en"