Skip to main content
Use the Content API to publish Markdown from your CMS, docs repository, or build pipeline. This guide takes a local install.md file through draft creation, approval, and publication.

Before you start

  • Create an organization API key with content:write for creating and approving drafts and content:read for checking publication. An owner or admin can grant the write scope on an active or trialing Enterprise plan. Set TPC_API_KEY in your environment or inject it from your CI secret store.
  • Set TPC_PRODUCT_ID to the ID of a product in that organization. Use a product with a connected publishing domain.
  • Install curl and jq, and save the Markdown you want to publish as install.md.

1. Upload the Markdown

Create content accepts the file contents as a JSON string. Choose a new path for the page. In the examples below, set PUBLISH_RUN_ID to an identifier for this submission. Reuse it when retrying the same requests and use a new one when the payload changes. Read about idempotency.
Continue only after you have a draft ID. The page should be in pending_review, with sourceUrl: null. The endpoint accepts up to 25 pages per request. A batch can return ok: true with per-page failures, so check failedCount and failed and retain the IDs of successful drafts. The product’s default publishing domains apply unless you pass a product custom domain ID as canonicalDomainId in the page object.

2. Approve the draft

After you’ve reviewed the draft, send its ID to Review a content draft.
A successful approval for the Markdown page returns:
queuedForPublish: true means the publishing job was queued. Continue to the next step to check whether it finished. A draft for an external platform can be approved with queuedForPublish: false and must be published through that platform. Use Publish an approved content draft to requeue an approved site draft if its publishing job failed and the page is still unpublished.

3. Verify publication

Call Get content with the draft ID. Its documentId is empty until publishing creates or updates the live document. Once you have that ID, use the same endpoint to get the document status and URL.
Once publishing finishes, you should see a result like this:
If the command prints no result, wait and run the lookup again. In automation, poll with a time limit. If the page still doesn’t appear, check the draft and publishing domain in the dashboard. Open the returned URL to confirm that the page serves the expected content. For subsequent edits, use the document ID with Update a document. Keep the draft ID for actions on the review queue.