Skip to content

API reference

Documents

Documents endpoints of the SemanticsOn REST API.

List documents

GET/projects/{projectId}/documents

Your documents in the project (documents are private to the account that created them), without body.

Path parameters

  • projectIdstringrequired

Query parameters

  • limitintegeroptional

    Items per page, 1–100.

    1–100 · default 25

  • cursorstringoptional

    Pass nextCursor from the previous page to get the next one.

    at most 200 characters

  • statusstringoptional

    One of: draft, in_review, approved, published

  • briefIdstringoptional

    at most 64 characters

  • searchstringoptional

    at most 200 characters

curl https://semanticson.com/api/v1/projects/PROJECT_ID/documents \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY"

Response · 200 OK

A list object: { "object": "list", "data": [ … ], "hasMore": false, "nextCursor": null }. See pagination.

Errors use the standard error object.

Create a document

POST/projects/{projectId}/documents

Creates a Markdown document in the project, owned by your account. A first version is saved when body is not empty.

Accepts an Idempotency-Key header for safe retries.

Path parameters

  • projectIdstringrequired

Request body

  • titlestringoptional

    1–200 characters · default "Untitled document"

  • bodystringoptional

    Markdown

    at most 400,000 characters · default ""

  • kindstringoptional

    e.g. article, landing-page, product-description

    1–40 characters · default "article"

  • languagestringoptional

    Defaults to the project's language

    2–12 characters

  • tonestringoptional

    at most 60 characters · default ""

  • statusstringoptional

    One of: draft, in_review, approved, published

    default "draft"

  • briefIdstring or nulloptional

    1–64 characters

Response fields Show 14 fields
  • object"document"
  • idstring
  • projectIdstring or null
  • briefIdstring or null
  • executionIdstring or null
  • titlestring
  • kindstring
  • languagestring
  • tonestring
  • statusstring

    One of: draft, in_review, approved, published

  • wordCountnumber
  • bodystring

    Markdown; omitted in lists

  • createdAtstring
  • updatedAtstring

    Send this back as updatedAt in PATCH to avoid overwriting newer changes

curl -X POST https://semanticson.com/api/v1/projects/PROJECT_ID/documents \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Espresso grind size: the complete chart",
  "body": "## Why grind size matters\n\nGrind size controls how fast water flows…",
  "briefId": "cm1brief…",
  "status": "draft"
}'

Response · 201 Created

A JSON object with the fields listed under Response fields.

Errors use the standard error object.

Get a document

GET/documents/{documentId}

Path parameters

  • documentIdstringrequired

    The document id

    1–64 characters

Response fields Show 14 fields
  • object"document"
  • idstring
  • projectIdstring or null
  • briefIdstring or null
  • executionIdstring or null
  • titlestring
  • kindstring
  • languagestring
  • tonestring
  • statusstring

    One of: draft, in_review, approved, published

  • wordCountnumber
  • bodystring

    Markdown; omitted in lists

  • createdAtstring
  • updatedAtstring

    Send this back as updatedAt in PATCH to avoid overwriting newer changes

curl https://semanticson.com/api/v1/documents/DOCUMENT_ID \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY"

Response · 200 OK

A JSON object with the fields listed under Response fields.

Errors use the standard error object.

Update a document

PATCH/documents/{documentId}

Send only the fields to change.

Avoid overwriting newer edits: send the updatedAt you last read. If the document changed since (in the editor, another integration or tab), nothing is saved and you get 409 conflict with the current updatedAt in details — fetch the document, merge, and retry (or send force: true to overwrite).

When title or body change, a version is saved automatically at most every 10 minutes (like the editor's autosave); send versionNote to always save a named version of the new content.

Accepts an Idempotency-Key header for safe retries.

Path parameters

  • documentIdstringrequired

    The document id

    1–64 characters

Request body

  • updatedAtstringoptional

    The updatedAt you last read (ISO timestamp)

    at most 40 characters

  • forcebooleanoptional

    Overwrite even if the document changed since updatedAt

    default false

  • titlestringoptional

    1–200 characters

  • bodystringoptional

    Markdown

    at most 400,000 characters

  • kindstringoptional

    e.g. article, landing-page, product-description

    1–40 characters

  • languagestringoptional

    2–12 characters

  • tonestringoptional

    at most 60 characters

  • statusstringoptional

    One of: draft, in_review, approved, published

  • briefIdstring or nulloptional

    1–64 characters

  • versionNotestringoptional

    1–200 characters

Response fields Show 14 fields
  • object"document"
  • idstring
  • projectIdstring or null
  • briefIdstring or null
  • executionIdstring or null
  • titlestring
  • kindstring
  • languagestring
  • tonestring
  • statusstring

    One of: draft, in_review, approved, published

  • wordCountnumber
  • bodystring

    Markdown; omitted in lists

  • createdAtstring
  • updatedAtstring

    Send this back as updatedAt in PATCH to avoid overwriting newer changes

curl -X PATCH https://semanticson.com/api/v1/documents/DOCUMENT_ID \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "updatedAt": "2026-11-20T10:15:00.000Z",
  "body": "## Why grind size matters\n\nUpdated text…",
  "versionNote": "Edited in our CMS"
}'

Response · 200 OK

A JSON object with the fields listed under Response fields.

Errors use the standard error object.

Delete a document

DELETE/documents/{documentId}

Deletes the document and all its versions.

Accepts an Idempotency-Key header for safe retries.

Path parameters

  • documentIdstringrequired

    The document id

    1–64 characters

curl -X DELETE https://semanticson.com/api/v1/documents/DOCUMENT_ID \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY"

Response · 204 No Content

Success returns an empty body (204) or a small confirmation object.

Errors use the standard error object.

List saved versions

GET/documents/{documentId}/versions

Newest first, without bodies. The 50 most recent versions are kept.

Path parameters

  • documentIdstringrequired

    The document id

    1–64 characters

Query parameters

  • limitintegeroptional

    Items per page, 1–100.

    1–100 · default 25

  • cursorstringoptional

    Pass nextCursor from the previous page to get the next one.

    at most 200 characters

curl https://semanticson.com/api/v1/documents/DOCUMENT_ID/versions \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY"

Response · 200 OK

A list object: { "object": "list", "data": [ … ], "hasMore": false, "nextCursor": null }. See pagination.

Errors use the standard error object.

Restore a version

POST/documents/{documentId}/versions/{versionId}/restore

Replaces the title and body with the version's. The current content is saved as a version first, so a restore can always be undone.

Accepts an Idempotency-Key header for safe retries.

Path parameters

  • documentIdstringrequired

    The document id

    1–64 characters

  • versionIdstringrequired

    The version id

    1–64 characters

No request body. Send an empty body or {}.

Response fields Show 14 fields
  • object"document"
  • idstring
  • projectIdstring or null
  • briefIdstring or null
  • executionIdstring or null
  • titlestring
  • kindstring
  • languagestring
  • tonestring
  • statusstring

    One of: draft, in_review, approved, published

  • wordCountnumber
  • bodystring

    Markdown; omitted in lists

  • createdAtstring
  • updatedAtstring

    Send this back as updatedAt in PATCH to avoid overwriting newer changes

curl -X POST https://semanticson.com/api/v1/documents/DOCUMENT_ID/versions/VERSION_ID/restore \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY"

Response · 200 OK

A JSON object with the fields listed under Response fields.

Errors use the standard error object.

Download a document

GET/documents/{documentId}/export

Returns the file itself (content-disposition: attachment), not JSON. Formats not included in your plan return 402 export_not_in_plan.

Path parameters

  • documentIdstringrequired

    The document id

    1–64 characters

Query parameters

  • formatstringrequired

    File format: csv, json, md, html, xlsx, pdf, docx. Available formats depend on your plan (plan.features.exports in GET /me).

    One of: csv, json, md, html, xlsx, pdf, docx

curl https://semanticson.com/api/v1/documents/DOCUMENT_ID/export \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY"

Response · 200 OK

A JSON object. Objects carry an object type and an id; timestamps are ISO 8601 strings.

Errors use the standard error object.

Propose publishing a document to a connected website

POST/documents/{documentId}/publish

Creates a pending post.create change for one of the project's connected websites (Markdown is converted to HTML). Nothing is published until a person approves the change — in SemanticsOn, in the WordPress admin, or with POST /changes/{changeId}/approve. Returns the proposed change; follow it with GET /changes/{changeId} or the change.* webhooks.

Accepts an Idempotency-Key header for safe retries.

Path parameters

  • documentIdstringrequired

    The document id

    1–64 characters

Request body

  • siteIdstringrequired

    The connected site id

    1–64 characters

  • statusstringoptional

    Post status on the website once the change is approved and applied

    One of: draft, publish

    default "draft"

  • typestringoptional

    Post type on the website, e.g. post or page

    1–40 characters · default "post"

  • slugstringoptional

    at most 200 characters

  • excerptstringoptional

    at most 5,000 characters

  • metaTitlestringoptional

    at most 300 characters

  • metaDescriptionstringoptional

    at most 1,000 characters

  • categoriesarray of stringsoptional

    at most 20 items

  • tagsarray of stringsoptional

    at most 50 items

Response fields Show 22 fields
  • object"change"
  • idstring
  • siteIdstring
  • projectIdstring
  • kindstring

    One of: meta.update, post.update, post.create, post.delete, schema.set, redirect.create, redirect.update, redirect.delete, term.create, term.update, term.delete, media.update, media.import, product.variation.update, link.insert, noindex.set

  • titlestring
  • statusstring

    One of: pending, approved, applied, failed, rejected, reverted, cancelled

  • targetobject
  • payloadobject
  • previousany or null
  • resultany or null
  • errorstring or null
  • sourcestring
  • auditResultIdstring or null
  • decidedViastring or null
  • decidedAtstring or null
  • appliedAtstring or null
  • revertRequestedboolean
  • revertNeedsApprovalboolean
  • revertedAtstring or null
  • createdAtstring
  • updatedAtstring
curl -X POST https://semanticson.com/api/v1/documents/DOCUMENT_ID/publish \
  -H "Authorization: Bearer $SEMANTICSON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "siteId": "cm1site…",
  "status": "publish",
  "type": "post",
  "metaDescription": "Dial in espresso with one simple grind size chart.",
  "categories": [
    "Guides"
  ]
}'

Response · 201 Created

A JSON object with the fields listed under Response fields.

Errors use the standard error object.