Skip to content

Public API ​

The CometCMS public API is the stable HTTP API for external frontends, static site generators, mobile apps, and integration scripts.

Public reads work without authentication and return only public content. Send an access token when you need drafts, protected content, or write access:

http
Authorization: Bearer YOUR_TOKEN_HERE

See Access Tokens for how to create tokens and assign permission grants.

Base URL ​

text
https://yourdomain.com/api/v1

All Public API endpoints require a workspace segment in the URL:

text
https://yourdomain.com/api/v1/workspaces/{workspace}

Requests to unscoped /api/v1/... content, content-type, and media routes are rejected with workspace_required.

For example, GET /api/v1/workspaces/site-a/content/posts reads posts from the site-a workspace. Direct media URLs for scoped responses use /media/{workspace}/{filename}; named image sizes use the same endpoint with ?size=thumbnail, ?size=medium or ?size=large.

Response shape ​

Successful JSON responses are always wrapped in data. List responses and secondary response metadata use meta.

json
{
  "data": [],
  "meta": {
    "total": 0,
    "limit": 20,
    "offset": 0,
    "sort": "created_at",
    "order": "desc"
  }
}

Errors use a single error object:

json
{
  "error": {
    "code": "not_found",
    "message": "Content entry not found."
  }
}

Unknown content types, collections, and entries return 404 with the same error shape.

OpenAPI ​

The machine-readable public API contract is available as openapi.yaml.

Health ​

GET /api/v1/workspaces/{workspace}/health ​

Returns a health check response.

The response includes runtime extension capabilities that affect key features:

  • data.extensions.gd: thumbnail-generation support (GD image functions available)
  • data.extensions.zip: backup archive support (ZipArchive/zip extension available)

Content types ​

GET /api/v1/workspaces/{workspace}/content-types ​

Returns all content type schemas. Each schema reports the workspace languages as read-only locales and default_locale; configure languages in workspace settings, not through content type writes.

GET /api/v1/workspaces/{workspace}/content-types/{collection} ​

Returns one content type schema.

POST /api/v1/workspaces/{workspace}/content-types ​

Creates a new content type schema.

Required permission: schema.create on schema:{name}

Request body fields include name (required), label, icon, fields, api_enabled, visibility, hierarchical, allow_submissions, and submission_settings. locales and default_locale are read-only workspace values and are ignored on schema writes.

PUT /api/v1/workspaces/{workspace}/content-types/{collection} ​

Updates an existing content type schema.

Required permission: schema.update on schema:{collection}

Existing entries are not modified — new fields will be absent until entries are re-saved.

DELETE /api/v1/workspaces/{workspace}/content-types/{collection} ​

Permanently deletes a content type and all its entries. This action is irreversible.

Required permission: schema.delete on schema:{collection}

Content entries ​

GET /api/v1/workspaces/{workspace}/content/{collection} ​

Returns entries in a collection.

Without a token, only published entries and scheduled entries whose published_at is in the past are returned. With a token that has content.read on the collection, drafts and protected entries are included.

New content types have api_enabled: false. Explicitly enable API exposure to make published, unprotected entries publicly readable. Disabled types are omitted from schema discovery, their content and schema read endpoints return 404, and relations cannot expose their entries. Enabling API exposure sets the type to public visibility. Website pages are independent of this setting. Existing legacy schemas retain their prior public or token-protected access until reconfigured.

Query parameters:

ParameterDescription
limitMaximum number of entries to return; omit it to return all matching entries
offsetOffset for pagination
sortSort field; prefix with - for descending, e.g. ?sort=-published_at
qFull-text search across text fields
includeComma-separated relation fields to expand one level
localeLocale code for localized content types, e.g. ?locale=de
filter[field]Exact match, e.g. ?filter[is_promo_material]=true
filter[field][in]One of several values
filter[field][ne]Not equal
filter[field][gt]Greater than
filter[field][gte]Greater than or equal
filter[field][lt]Less than
filter[field][lte]Less than or equal
filter[field][contains]Case-insensitive substring match

Boolean fields accept true/false (also 1/0). Select fields, including multi-select fields, match against the stored option value. When a stored field value is an array, filters match if any item in the array matches the requested value. Media fields are always returned as arrays of absolute media URLs, including single-file media fields. Multi-select and multi-relation fields are returned as arrays; single select and relation fields are returned as one value or null. The stable entry identifier is filterable as id; the URL slug is filterable as slug.

locale resolves titles, slugs, publication state, and field values before search, filters, sorting, and relation expansion. Without it, the workspace default is used. Unsupported languages return a validation error. Public reads include only published variants of the requested language, and fallback never exposes another language's draft. Responses include locale and revision.

Sorting is type-aware for numeric values and ISO-style dates, then falls back to case-insensitive string sorting.

http
GET /api/v1/workspaces/site-a/content/blogpost?filter[is_promo_material]=true
GET /api/v1/workspaces/site-a/content/blogpost?filter[category]=launch
GET /api/v1/workspaces/site-a/content/blogpost?filter[id]=7K4p9xQ2mR
GET /api/v1/workspaces/site-a/content/pages?locale=de

GET /api/v1/workspaces/{workspace}/content/{collection}/{identifier} ​

Returns one entry. {identifier} may be either the entry slug or the stable opaque id returned in the payload. Add ?locale={code} to resolve localized field values.

Public reads return only public entries. Reading drafts, protected entries, or entries hidden by status requires content.read on content:{collection}:{identifier}.

Entry payload ​

json
{
  "id": "7K4p9xQ2mR",
  "slug": "how-to-cook-pasta",
  "type": "blogpost",
  "status": "published",
  "title": "How to cook pasta",
  "published_at": "2026-05-03T12:00:00Z",
  "created_at": "2026-05-01T09:30:00Z",
  "updated_at": "2026-05-03T12:00:00Z",
  "author_id": "admin",
  "updated_by": "admin",
  "data": {
    "is_promo_material": true,
    "category": "launch",
    "hero_image": ["https://yourdomain.com/media/site-a/hero.png"]
  }
}

id is stable and opaque. slug is the human-readable URL key and may change.

POST /api/v1/workspaces/{workspace}/content/{collection} ​

Creates a new entry.

Required permission: content.create on content:{collection}:*

Body: JSON object with field values.

Creating an entry with status: "published" also requires content.publish on the entry.

For localized content types, include locale in the body to create that locale variant. The default locale is used when locale is omitted.

When a content type field defines a supported default, omitted values are created with that default before validation and normalization.

PUT /api/v1/workspaces/{workspace}/content/{collection}/{identifier} ​

Updates an existing entry by slug or stable ID.

Required permission: content.update on content:{collection}:{identifier}

Updating an entry to status: "published" also requires content.publish on the entry.

Include locale in the body to target one language. Title, slug, status, publication date, and localized custom fields belong to that language; IDs, authors, and shared fields remain shared. Omitted fields and other languages are preserved.

Send the response's revision with an update to detect stale writes. A mismatch returns HTTP 409; reload before retrying while preserving your local draft. Send reset_fields: ["intro"] to remove overrides and inherit from the default language. Explicit empty strings, null, false, zero, and empty arrays do not inherit (field validation still applies). Shared fields are edited in the default language. Whole translation maps, values, and publication are not accepted by entry write endpoints.

json
{"locale":"de","revision":"<revision from GET>","title":"Über uns","slug":"ueber-uns","status":"published"}

Schemas can use localized presentation text for labels, help text, and select-option labels:

json
{"type":"localized","values":{"en":"Your name","de":"Ihr Name"}}

Admin entry reads expose the resource-owned values and publication maps alongside a resolved projection. Existing flat entries and legacy translation maps remain readable and are converted to the new storage format on their next save. Existing workspace language choices are imported from website and content type settings when no workspace language settings exist.

DELETE /api/v1/workspaces/{workspace}/content/{collection}/{identifier} ​

Soft-deletes an entry by slug or stable ID.

Required permission: content.delete on content:{collection}:{identifier}

json
{
  "data": {
    "ok": true
  }
}

Media ​

GET /api/v1/workspaces/{workspace}/media ​

Returns uploaded media files. Without authentication, only public files are returned. With a token that has media.read, all files (including private ones) are returned.

Query parameters:

ParameterDescription
qSearch by filename
categoryFilter by media category
limitMaximum number of files to return; omit it to return all matching files
offsetOffset for pagination

Available categories are returned in meta.categories. Nested categories are represented as paths such as Brand / Logos; filtering by a parent category also includes files assigned to its subcategories.

Each file object includes the following fields:

FieldDescription
filenameFile name
urlAbsolute URL to the file
thumb_urlAbsolute URL to the thumbnail size, or url
sizesThe named sizes (thumbnail, medium, large) smaller than the original, each with width, height and url. A missing size is served by url.
variantsAccepted widths (the named sizes), formats, limits, and ready-to-use URLs for raster images; otherwise null
sizeFile size in bytes
mimeMIME type
categoryAssigned category path, or empty string
widthImage width in pixels, or null
heightImage height in pixels, or null
altAlt text for the file (empty string if unset)
titleTitle / tooltip for the file (empty string if unset)
visibility"public" or "private"
uploaded_atISO 8601 upload timestamp, or null
uploaded_byUser ID of the uploader, or null

POST /api/v1/workspaces/{workspace}/media ​

Uploads one or more media files as multipart media[] parts.

Required permission: media.upload on media:*, or media:category:{category} when assigning a category

Optional form field: category. Use a nested path such as Brand / Logos to assign a subcategory.

PUT /api/v1/workspaces/{workspace}/media/{filename}/meta ​

Updates the alt text and title of a media file. Send empty strings to clear them.

Required permission: media.update on media:*

Body: { "alt": "A red apple on a white background", "title": "Product photo" }

PUT /api/v1/workspaces/{workspace}/media/{filename}/visibility ​

Sets the visibility of a media file to "public" (default) or "private".

Private files are excluded from unauthenticated GET /api/v1/workspaces/{workspace}/media responses and return 401 when fetched directly via GET /media/{workspace}/{filename} without a valid token with media.read permission.

Required permission: media.update on media:*

Body: { "visibility": "private" }

PUT /api/v1/workspaces/{workspace}/media/bulk-visibility ​

Sets the visibility of multiple media files in one request.

Required permission: media.update on media:*

Body: { "files": ["photo.jpg", "doc.pdf"], "visibility": "private" }

POST /api/v1/workspaces/{workspace}/media/categories ​

Creates a media category. Send a path in name or provide parent to create a subcategory.

Required permission: media.update on media:*

Body: { "name": "Logos", "parent": "Brand" }

json
{
  "data": {
    "name": "Brand / Logos"
  },
  "meta": {
    "categories": ["Brand", "Brand / Logos"]
  }
}

PUT /api/v1/workspaces/{workspace}/media/categories/{category} ​

Renames a media category and updates all files assigned to it or its subcategories.

Required permission: media.update on media:category:{category}

Body: { "name": "New category name" }

DELETE /api/v1/workspaces/{workspace}/media/categories/{category} ​

Deletes a media category and its subcategories. Files are not deleted; they are moved to no category.

Required permission: media.update on media:category:{category}

PUT /api/v1/workspaces/{workspace}/media/{filename}/category ​

Assigns a media file to a category. Send an empty category to clear it.

Required permission: media.update on media:{filename}

Body: { "category": "Brand / Logos" }

DELETE /api/v1/workspaces/{workspace}/media/{filename} ​

Deletes a media file.

Required permission: media.delete on media:{filename}

GET /media/{workspace}/{filename} ​

Serves a media file directly. Returns 401 if the file's visibility is "private" and no valid bearer token with media.read on media:{filename} is provided.

Raster images accept these optional transformation parameters:

ParameterDescription
sizeA named size: thumbnail, medium or large. Serves the original when it is not larger.
wTarget width. Must be one of the named sizes unless custom sizes are enabled.
hTarget height. Available when custom sizes are enabled.
fitcontain (default) or centered cover.
formatAn enabled and GD-supported output format: jpeg, png, webp, or avif.

size, w or h is required to request a variant. Images retain their aspect ratio and are never upscaled. Variants use the same public/private authorization as the original, are cached on disk, and return ETag, Last-Modified, and Cache-Control headers.

html
<img
  src="https://yourdomain.com/media/site-a/hero.jpg?size=medium"
  srcset="https://yourdomain.com/media/site-a/hero.jpg?size=thumbnail 400w,
          https://yourdomain.com/media/site-a/hero.jpg?size=medium 960w"
  sizes="(max-width: 960px) 100vw, 960px"
  alt=""
>

Admin-Only Operations ​

Trash, backup/restore, settings, users, tokens, and webhook configuration are intentionally not part of the public token API. Use the session-authenticated /admin/api endpoints from the admin UI for operational tasks.

CometCMS Documentation