LitPage content management API
Discover your LitPage site, read CMS content with Management v2, and use revision IDs to save and publish the intended draft.
Use the LitPage content management API to find your site, read its CMS content, and automate publication. The hosted base URL is https://build.lit.page/api/v2. Paths below are relative to that base.
Send Authorization: ApiKey ${LITPAGE_WORKSPACE_KEY} for every request. Use a Workspace Key with read access for GET and write access for saving and publishing. Send Content-Type: application/json with JSON request bodies. Keep requests with this credential on your server or in CI.
Find the target site
- GET
/sitestakes no parameters or body. HTTP 200 returns adataarray of accessible sites. - GET
/sites/resolverequires one query string,subdomain. Supply a bare subdomain such asmy-site, itsmy-site.lit.pagehostname, or an active custom hostname. Send no body. HTTP 200 returns one site object indata. - GET
/content-typestakes no parameters or body. HTTP 200 returns the content type descriptors indata. Each descriptor includes a type ID, name, description, route prefix and pattern, maturity, example path, and capabilities. The capabilities report typed Markdown availability and nullable detail and collection contract versions. The hosted registry marks BLOG, DOC, and CHANGELOG as core.
curl --fail-with-body --get 'https://build.lit.page/api/v2/sites/resolve' \
--header "Authorization: ApiKey ${LITPAGE_WORKSPACE_KEY}" \
--data-urlencode "subdomain=${LITPAGE_SUBDOMAIN}"
Set LITPAGE_SUBDOMAIN to your site's subdomain. The site object's siteId is a string ID for management paths. The subdomain, name, defaultDomain (URL), and defaultLanguage fields are strings. customDomain is the active custom hostname or null. createdAt and updatedAt are date-time strings. An inaccessible hostname returns 404 from resolve. Check it against the result of /sites.
Read CMS content and revisions
Replace {siteId} with the ID from site discovery. For {contentId}, use the item ID, and for {slug} use the URL-encoded article slug. The GET routes take no body.
- GET
/sites/{siteId}/contentsreturns HTTP 200 with item summaries indata. Optional query fields aretype(defaults toBLOG),language(such asEN),status(DRAFT,PUBLISHED, orARCHIVED),search(matches title or excerpt),page(positive page number, default 1), andlimit(1–100, default 20). Omit optional filters you do not need. - GET
/sites/{siteId}/contents/{contentId}returns HTTP 200 with an item and its body indata. No query fields are needed. - GET
/sites/{siteId}/contents/by-slug/{slug}returns HTTP 200 with an item and its body indata. Includetype=DOCfor documents and specifylanguage=ENor the intended language to select a translation. Type defaults toBLOG. Use the list route for search and pagination. If the slug exists in multiple languages, omitting language can return 400 LANGUAGE_REQUIRED_FOR_DUPLICATE_SLUG.
curl --fail-with-body --get \
"https://build.lit.page/api/v2/sites/${SITE_ID}/contents/by-slug/${CONTENT_SLUG}" \
--header "Authorization: ApiKey ${LITPAGE_WORKSPACE_KEY}" \
--data-urlencode 'type=DOC' \
--data-urlencode 'language=EN'
Set SITE_ID from site discovery and CONTENT_SLUG to a document on your site. Use the quickstart to run a list request if you need a slug.
Interpret a successful response
This example is an illustrative excerpt for a by-ID or by-slug read of a published document with pending edits.
{
"success": true,
"data": {
"type": "DOC",
"language": "EN",
"status": "PUBLISHED",
"slug": "getting-started",
"currentRevisionId": "c7c9356a-59d4-4ea1-a72c-db5a8e1f5e29",
"hasUnpublishedChanges": true,
"draft": {
"revisionId": "c7c9356a-59d4-4ea1-a72c-db5a8e1f5e29",
"content": "Updated draft"
},
"published": {
"revisionId": "c7c9356a-59d4-4ea1-a72c-db5a8e1f5e20",
"content": "Public version"
}
},
"meta": {
"requestId": "example-request-id",
"timestamp": "2026-11-18T12:00:00.000Z",
"version": "v2"
}
}
datais a resource object for a detail read and an array for a list. Content items include string identifiers, a content type, language, status, title and slug.contentis the draft body string when returned, anddatainside a content item is type-specific metadata when present.currentRevisionIdanddraftdescribe the current editable snapshot.publisheddescribes the public snapshot and is null when none is available.hasUnpublishedChangesis a boolean. APUBLISHEDitem can have newer draft edits. Keep management responses out of public caches.paginationappears at the top level on list responses.page,limit,total, andtotalPagesare numbers.hasNextandhasPrevare booleans.metacarries string values forrequestId, ISOtimestamp, and APIversion.
Save and publish the revision you reviewed
For Markdown files, follow Publish Markdown with the LitPage CLI. The CLI handles portable document metadata and revision selection. For direct HTTP, this is the existing-draft update and publish sequence.
- Read the item by ID. Save
data.currentRevisionIdfor the write. - PATCH
/sites/{siteId}/contents/{contentId}with a JSON object containing the fields you want to change. For a body-only edit, send a non-empty Markdown string incontentand the pulled revision UUID inexpectedRevisionId. HTTP 200 returns the updated item indata. The editable revision can change while the public snapshot stays in place. - Review
data.draftand store the newdata.currentRevisionId. - POST
/sites/{siteId}/contents/{contentId}/publishwith the reviewed revision UUID in JSON fieldexpectedRevisionId. HTTP 201 returns the item with the published snapshot. Checkdata.published.revisionIdand confirm the public article in a signed-out window.
curl --fail-with-body --request PATCH \
"https://build.lit.page/api/v2/sites/${SITE_ID}/contents/${CONTENT_ID}" \
--header "Authorization: ApiKey ${LITPAGE_WORKSPACE_KEY}" \
--header 'Content-Type: application/json' \
--data '{"content":"Updated Markdown","expectedRevisionId":"c7c9356a-59d4-4ea1-a72c-db5a8e1f5e29"}'
curl --fail-with-body --request POST \
"https://build.lit.page/api/v2/sites/${SITE_ID}/contents/${CONTENT_ID}/publish" \
--header "Authorization: ApiKey ${LITPAGE_WORKSPACE_KEY}" \
--header 'Content-Type: application/json' \
--data '{"expectedRevisionId":"b6e70733-c2ee-487c-82ba-5562eaaa371e"}'
PATCH also accepts optional title, slug, excerpt and updateReason strings, a language code, a content type enum, an author object, featuredImage or cover metadata, and a type-specific data object. DOC placement uses the optional root string and parent folder path or null. Keep the item's existing type and language for a normal edit and use the CLI workflow for document placement.
Use actual revision IDs from your own reads. Both routes take the same two string IDs in the path and no query options. The revision field is optional in the transport schema. Always supply it to bind the request to the version you read. On HTTP 409, fetch the latest version, compare, and reconcile before retrying.
Handle management errors
Check the HTTP status before reading data. API v2 failure responses carry success: false, error.code, error.message, statusCode, and meta.requestId. The error message can be a string or a validation message array. Log the request ID for troubleshooting while keeping keys and draft text private.
- 400 Check input types, JSON, and content validation messages.
- 401
AUTHORIZATION_REQUIRED,INVALID_API_KEY_FORMAT, orINVALID_API_KEY. Verify your header and the full active key. - 403
API_KEY_PERMISSION_DENIEDorSITE_ACCESS_DENIED. Check read/write access and select a site in the key's workspace. - 404
SITE_NOT_FOUNDorCONTENT_NOT_FOUND. Verify IDs, slug, type, and language. - 409 Preserve concurrent edits by rereading before a retry. If
CONTENT_SLUG_CONFLICTis returned, check for an existing item with the same slug, type, and language.