install.md file through draft creation, approval, and publication.
Before you start
- Create an organization API key with
content:writefor creating and approving drafts andcontent:readfor checking publication. An owner or admin can grant the write scope on an active or trialing Enterprise plan. SetTPC_API_KEYin your environment or inject it from your CI secret store. - Set
TPC_PRODUCT_IDto the ID of a product in that organization. Use a product with a connected publishing domain. - Install
curlandjq, and save the Markdown you want to publish asinstall.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, setPUBLISH_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.
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.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. ItsdocumentId 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.