Docs · API reference
On this page

API reference

A small HTTP API authenticated with a bearer key. The CLI uses exactly these endpoints and nothing more.

Authentication and base URL#

Send your key as Authorization: Bearer colo_live_…. A CLI session from colophon login (colo_sess_…) is accepted in the same header; it carries the person’s role, so an owner’s session has every scope and anyone else’s has publish and stats, within what their role allows. The API lives on the content origin, so any of these work as a base:

  • https://api.usercontent.colophon.fyi — the default
  • https://<workspace>.colophon.fyi — your own subdomain

Once a workspace has attached its own domain, every url below is on that hostname instead; the subdomain form keeps working. The key identifies the workspace; the hostname does not. Responses are JSON. Errors are { "error": "…" } with the status: 401 for a missing or revoked key, 403 when the key lacks the scope, 400 for validation, 404 when the thing is not yours — RLS makes another workspace’s id indistinguishable from a nonexistent one — and 429 with Retry-After for quotas and rate limits.

Rate limits: 120 requests per minute per key, 300 per minute per IP.

NoteThe /api/cli/* endpoints on app.colophon.here implement colophon login, create-token and switch. They are the CLI’s own and may change with it; build against the endpoints below.

Publish a site#

POST /api/v1/sites

scope publish · multipart form

FieldMeaning
archiveRequired. A .tar.gz or a .zip of the directory, told apart by its bytes rather than its name. A .zip whose files all sit in one folder publishes that folder; its files are stored or deflated, never encrypted.
nameDisplay name. Defaults to the archive filename, without its extension.
slugURL path. Defaults to a slug of the name.
visibilitypublic · unlisted (the default for a new site) · password · restricted · private. Omit it on an existing slug and the level it has is kept. A level above the workspace’s sharing limit is a 403, and under a limit below unlisted a new site with none named takes the most open level the limit leaves that needs no password.
passwordWith visibility=password: what readers type at the gate, at least 6 characters. Needed to make a site password-protected; on one that already is, omitted keeps the password and passed replaces it. Refused with any other level. Only a hash is kept, and the response says only password_set: true. See Password-protected sites.
domainOptional. A hostname you control, for this one site — see a site’s own domain. The response carries the two DNS records until they resolve; url moves to the hostname once they do.
expires_atOptional, an ISO 8601 moment in the years 1970 to 9999 UTC. After it the site answers 410 on every path, previews included; thirty days later it is deleted, unless the date was moved or cleared first. Omitted, an existing site keeps its expiry; none clears it. A moment already past is refused here — take a live site down with PATCH instead. See Expiry.
draftOptional, 1. Store the version without making it live. url becomes its preview, on a host of the version’s own with the site at its live path (https://p<version_id>.colophon.fyi/<slug>/), site_url is the live address, and an existing site’s name, visibility and password are left alone. Once it is approved, make it live here or from the dashboard. See Drafts.
reviewOptional, 1. A draft, sent for review in the same step; the response adds review. With note, what you want the reviewers to look at, up to 2000 characters.
spaOptional, 1 or 0. Turns the single-page-app fallback on or off; omitted, an existing site keeps its setting and a new one has it off. Below owner, an existing site’s cannot change (403). The response always carries spa.
shell
COPYFILE_DISABLE=1 tar -czf - -C ./site . |
  curl -sS -X POST https://api.usercontent.colophon.fyi/api/v1/sites \
    -H "Authorization: Bearer $COLOPHON_TOKEN" \
    -F "archive=@-;filename=site.tar.gz" \
    -F name="Q3 report" -F slug=q3-report -F visibility=unlisted

201 when live, or stored as a draft with draft: true; 202 with held: true when the scanner held it for review, and 202 with review and approval_required: true when the workspace needs approval before a version goes live and this publish was sent for review instead.

429 with Retry-After: 10 when another publish to the workspace was still writing after 10 seconds, or the server was running as many publishes as it takes at once; 429 with Retry-After: 60 for a limit. A workspace’s publishes land one at a time, in the order they arrived, each waiting for the ones ahead. Nothing was written, so the same request can be sent again.

Response
{
  "site_id": "…", "version_id": "…",
  "url": "https://acme.colophon.fyi/q3-report/",
  "files": 18, "bytes": 421888, "new_blobs": 2,
  "changes": { "added": 1, "removed": 0, "changed": 3 },
  "visibility": "unlisted"
}

visibility is who can open the site after this publish: the level you named, the one it kept, or for a new site with none named the workspace’s default. changes counts the files this version added, removed and changed against the one published just before it — null on a site’s first version, all zeros when nothing moved. new_blobs is a different number: how many files this workspace had not stored before.

A _redirects file at the archive’s root is read at publish (Redirects): the response adds redirects, how many rules it holds, and a line that is wrong is a 400 naming it, "_redirects line 3: …", with nothing stored.

With domain, one more field. A hostname another site or workspace holds is reported as domain: { "error": "…" } beside a publish that still went through.

Response
"domain": {
  "hostname": "docs.example.com", "verified": false,
  "records": [
    { "type": "TXT",   "name": "_colophon.docs.example.com", "value": "<token>", "ok": false },
    { "type": "CNAME", "name": "docs.example.com", "value": "edge.colophon.fyi", "ok": false }
  ]
}

COPYFILE_DISABLE=1 stops macOS tar from adding ._* resource forks. The server drops them anyway, but not sending them is faster.

List sites#

GET /api/v1/sites

scope publish · ?limit (default 50, max 200) and ?cursor

Response
{
  "sites": [{
    "id": "…", "slug": "q3-report", "name": "Q3 report", "visibility": "unlisted",
    "url": "https://acme.colophon.fyi/q3-report/",
    "versions": 3, "shared_with": 0, "updated_at": "2026-09-04T19:22:54.842Z"
  }],
  "next_cursor": "MjAyNi0wOS0wNFQxOToyMjo1NC44NDJaIDdmM2E…"
}

One page, newest first. When next_cursor is not null there are more sites: ask again with ?cursor= set to it, verbatim, until it comes back null. It is opaque — do not parse it. A cursor this API did not issue is a 400.

One site#

GET /api/v1/sites/:id

scope publish

Response
{
  "id": "…", "slug": "q3-report", "name": "Q3 report", "visibility": "unlisted",
  "url": "https://acme.colophon.fyi/q3-report/",
  "live": true, "live_version_id": "1c4f…", "shared_with": 0, "expires_at": null,
  "versions": [
    { "id": "1c4f…", "status": "active",   "created_at": "…", "files": 18, "bytes": 421888,
      "via": "ci-key", "published_by": null,
      "changes": { "since": "a91e…", "added": 1, "removed": 0, "changed": 2 } },
    { "id": "a91e…", "status": "archived", "created_at": "…", "files": 17, "bytes": 407552,
      "via": "dashboard", "published_by": "ana@acme.com",
      "changes": null }
  ]
}

Versions come newest first, so the last one is v1. Each carries changes: the files it added, removed and changed against the one published just before it (since), drafts included. null on the first version; three zeros mean a republish that changed nothing. via names the API key that published it; dashboard there means only that no key did. published_by is the email of the person who published it, signed in through colophon login or an MCP connector — null when a key published it or nobody was recorded.

A version sent for review also carries review, its latest state: in_review, changes_requested, approved or superseded. The site carries approval_required, review (the request open now, with its preview_url, or null) and reviews, every request newest first with who asked, who decided and their notes. A decision by an outside approver has decided_outside: true and their address in decided_by_email.

What changed between two versions#

GET /api/v1/sites/:id/diff

?from=<version id>&to=<version id> · scope publish

Response
{
  "from": "a91e…", "to": "1c4f…",
  "summary": { "added": 1, "removed": 0, "changed": 2 },
  "files": [
    { "path": "charts/revenue.svg", "kind": "added",   "content_type": "image/svg+xml", "size_before": null,  "size_after": 18841 },
    { "path": "index.html",         "kind": "changed", "content_type": "text/html; charset=utf-8", "size_before": 42188, "size_after": 44032 },
    { "path": "styles.css",         "kind": "changed", "content_type": "text/css; charset=utf-8",  "size_before": 6247,  "size_after": 6451 }
  ]
}

Every path whose bytes differ; a file that is the same on both sides is not listed. Both ids must be versions of this site — one from another site is 404. To see what making an older version live would change, pass the live version as from, then make it live.

Synopsis
GET /api/v1/sites/:id/diff?from=…&to=…&path=index.html
Response
{
  "path": "index.html", "kind": "changed", "content_type": "text/html; charset=utf-8",
  "size_before": 42188, "size_after": 44032,
  "patch": "diff --git a/index.html b/index.html\n--- index.html\n+++ index.html\n@@ -2,3 +2,4 @@\n …"
}

With path, one file’s unified diff in the shape git diff writes, three lines of context, so git apply and any diff viewer read it. An added or removed file is a whole-file patch. A file that is not text, or over 1 MB a side, comes back as binary: true with a reason and its sizes, and its bytes are never read.

Add format=markdown and an HTML page is compared as Markdown: its words, headings, lists and links, without the markup, as the dashboard’s Text view shows it. That patch is for reading; git apply cannot use it. Any other file is diffed as it is.

Make a version live, or roll back#

POST /api/v1/sites/:id/live

scope publish · JSON body { "version_id": "…" }

shell
curl -sS -X POST https://api.usercontent.colophon.fyi/api/v1/sites/<id>/live \
  -H "Authorization: Bearer $COLOPHON_TOKEN" -H "content-type: application/json" \
  -d '{ "version_id": "a91e…" }'
Response
{
  "id": "…", "slug": "q3-report", "url": "https://acme.colophon.fyi/q3-report/",
  "live": true, "live_version_id": "a91e…",
  "changed": true, "before": "1c4f…",
  "changes": { "added": 0, "removed": 1, "changed": 2 },
  "version": { "id": "a91e…", "status": "active", "created_at": "…", "files": 17, "bytes": 407552,
               "via": "dashboard", "published_by": "ana@acme.com", "changes": null },
  "expires_at": null
}

The dashboard’s Make live, for an agent: any version of the site from One site — an earlier one after a bad publish, or a draft once it is approved — becomes the live one on the next request. Nothing is copied or deleted; the version it replaces stays and can be made live again the same way. version is the now-live version as One site lists it, before the version that was live, and changes the files that moved against it — both null when nothing was live. The version already live is a 200 with changed: false, and nothing is written.

A version held for review or rejected in it cannot go live, and is a 400 that says which. An id that is not a version of this site is a 404. The site’s expiry stays where it was, so an expired site is still expired. A person needs the publisher role; an API key needs the publish scope. If the workspace posts to a channel when a site goes live, this posts there too, unless the site has expired.

A version in review made live this way is approved by whoever made it live. In a workspace that needs approval before a version goes live, only an owner may make one live directly; anyone else, and every API key, is a 403 that says to send it for review.

Review and approval#

POST /api/v1/sites/:id/review

scope publish · JSON body { "version_id": "…", "note": "…" }

Response
{
  "site_id": "…", "slug": "q3-report",
  "review": { "id": "…", "version_id": "b72d…", "version_number": 4, "state": "in_review",
              "requested_by": "ci-key", "by_agent": true, "requested_at": "…", "note": "New totals",
              "forced": false, "decided_by": null, "decided_at": null, "decision_note": null,
              "decided_outside": false, "decided_by_email": null, "superseded_by": null,
              "preview_url": "https://acme.colophon.fyi/q3-report/_v/b72d…/" },
  "superseded": null, "already": false
}

Sends a version for review: a draft, or an earlier version to put back. One version per site is in review at a time, so this replaces the request open before it, which comes back as superseded. The version already in review is a 200 with already: true and nothing written. The workspace’s publishers and owners are mailed once per round, and its channel is told each time, and so are the site’s outside approvers, who decide from the page. The live version, and a held or rejected one, is a 400. A person needs the editor role.

POST /api/v1/sites/:id/review/changes

scope publish · JSON body { "version_id": "…", "note": "…" }

Asks for changes to the version in review, saying what: the note is required. Answers { site_id, slug, review } with state: "changes_requested" and decision_note, mails whoever sent it, and closes the request; the next version sent opens a new one. A person needs the commenter role; an API key may ask too.

POST /api/v1/sites/:id/review/approve

scope publish · JSON body { "version_id": "…", "note": "…" }

Approves the version in review, which makes it live exactly as Make live does, and answers as it does, plus the closed review. A person from the publisher role up, signed in as themselves: an API key is a 403, since approval is a person’s sign-off. When the workspace needs approval, someone below owner cannot approve a version they sent.

A decision names the version it is about. If a newer one was sent for review since, it is a 400 naming the version in review now, so nobody approves what they did not see. Comments left on the version in review’s preview are pinned to it: read them with GET /api/v1/sites/:id/comments?version=<version_id>, which reads outdated against that version rather than the live one.

Change who can open a site, when it expires, or how it routes#

PATCH /api/v1/sites/:id

scope publish · JSON body with any of visibility, password, expires_at, spa and showcase

shell
curl -sS -X PATCH https://api.usercontent.colophon.fyi/api/v1/sites/<id> \
  -H "Authorization: Bearer $COLOPHON_TOKEN" -H "content-type: application/json" \
  -d '{ "visibility": "private" }'
Response
{ "id": "…", "slug": "q3-report", "visibility": "private", "before": "unlisted", "changed": true,
  "url": "https://acme.colophon.fyi/q3-report/" }

One of public, unlisted, password, restricted, private; the next request to the site is answered under the new level, with nothing republished. changed: false means it was that already. This grants nothing a publish key did not have — republishing with visibility set always changed it — but it does change who can open a site the moment it is called, so confirm before widening one or taking a link away from people who hold it. The footer a free public site carries is added at publish time, so a site made public here shows it from its next publish. A level above the workspace’s sharing limit is a 403 that names the limit and the levels it allows, and the site stays as it was. See Access & sharing.

json
{ "visibility": "password", "password": "…" }   // or just { "password": "…" } to change it

password goes with visibility: "password", which needs one unless the site is there already; on its own it changes the password of a site that is. A new password locks out everyone holding the old one on their next request. Moving to any other level drops it, so coming back asks for a password again. The reply says password_set: true and nothing more: the password is never returned, here or anywhere else.

json
{ "expires_at": "2026-10-01T00:00:00Z" }     // or null to clear

expires_at moves or clears the moment the site stops answering; the reply carries the new value and expires_at_before. A moment already past takes the site down on the next request and deletes nothing yet: for thirty days a new date, or none, brings it back with every version. See Expiry.

json
{ "spa": true }     // or false

spa turns the single-page-app fallback on or off from the next request; the reply carries spa and spa_before. GET /api/v1/sites/:id says spa, and redirects, the number of _redirects rules in the live version.

json
{ "showcase": true }     // or false

showcase puts a public site on the showcase, or takes it off. It is a person’s decision, so it needs an owner signed in through the CLI or a connected app: an API key is a 403, and nothing else in that request changes. It is applied after the other fields, so { "visibility": "public", "showcase": true } does both. Every reply, and GET /api/v1/sites/:id, says where the site stands:

Response
"showcase": {
  "on": true, "shown": false,
  "why_not": [{ "code": "cooling_off", "text": "It is new: …" }],
  "cooling_off_until": "2026-10-17T09:12:00Z",
  "shown_from": "2026-10-17T09:12:00Z"
}

Comments on a site#

GET /api/v1/sites/:id/comments

?status=open|resolved|all · scope publish · default open

Response
{
  "comments": [{
    "id": "…", "path": "index.html", "quote": "grew 18%", "body": "Is this Q2?",
    "author": "ana@acme.com", "by_agent": false, "outdated": false,
    "resolved_at": null, "replies": [ … ]
  }]
}

What reviewers asked for, each thread pinned to the passage they selected on that page. outdated is true once a later publish changed that page. Reviewers write them from the page, in the comment panel on Colophon’s own site; see Comments.

POST /api/v1/sites/:id/comments/:comment_id

scope publish · JSON body with reply, resolved, or both

shell
curl -sS -X POST https://api.usercontent.colophon.fyi/api/v1/sites/<id>/comments/<comment id> \
  -H "Authorization: Bearer $COLOPHON_TOKEN" -H "content-type: application/json" \
  -d '{ "reply": "Fixed in the new version.", "resolved": true }'

The reply is shown under the thread with the key’s name. A reply to a resolved thread opens it again.

Mail when someone opens it#

GET /api/v1/sites/:id/read-alerts

scope publish

PUT /api/v1/sites/:id/read-alerts

scope publish · JSON body { "mail": true } or { "mail": false }

Response
{ "site_id": "…", "mail": true, "because": "published", "turned_off": null }

Whether you are mailed when someone opens a restricted or private site for the first time, or opens a version of it they had not seen (Who opened it). because says why — published, review, owner or chose — and turned_off whose switch turned it off, site or workspace. mail: true on a site you did not publish mails you about it too. Without a site, GET and PUT /api/v1/read-alerts do the same for every site in the workspace, answering { "workspace": true, "mail": … }; a site’s own setting wins over it. Your own setting, from the publisher role up: a CLI session or a connected account, never a workspace API key, which is 403.

Read a site#

GET /api/v1/sites/:id/files

scope publish

Response
{ "site_id": "…", "version_id": "…", "url": "https://acme.colophon.fyi/q3-report/",
  "files": [{ "path": "index.html", "size": 4210, "content_type": "text/html; charset=utf-8" }] }

GET /api/v1/sites/:id/files/<path> returns one file of the live version as it was published; add ?format=markdown to get an HTML page as Markdown. Works on sites of any visibility in the workspace, for every role. See Read by AI agents for what browsers and crawlers get.

GET /api/v1/search

?q=board%20deck · scope publish

Response
{ "query": "board deck",
  "results": [{ "site_id": "…", "slug": "q3-report", "name": "Q3 report", "visibility": "restricted",
    "path": "index.html", "title": "Q3 for the board", "url": "https://acme.colophon.fyi/q3-report/",
    "snippet": "…the **board** **deck** goes out on Friday" }] }

The text of every live page in the workspace, any visibility, best match first. Words, "a phrase", -excluded and or work as in a search box; limit is 20 by default and at most 50. The snippet marks the matched words with ** and starts with … when it begins mid-sentence. Drafts and earlier versions are not searched. A page is found a few seconds after its publish answers, once it has been indexed.

Delete a site#

DELETE /api/v1/sites/:id

scope publish

Response
{ "deleted": true, "slug": "q3-report", "versions": 3 }

Removes every version and grant. 404 if the id is not a site in your workspace.

CarefulCannot be undone. To take a site down and keep its versions, PATCH an expires_at in the past (above).

Who am I#

GET /api/v1/whoami

any scope

Response
{
  "tenant": { "id": "…", "name": "Acme Research", "subdomain": "acme" },
  "key": { "id": "…", "scopes": ["publish", "links", "stats"] }
}

POST /api/v1/links

scope links · JSON body

shell
curl -sS -X POST https://api.usercontent.colophon.fyi/api/v1/links \
  -H "Authorization: Bearer $COLOPHON_TOKEN" -H "content-type: application/json" \
  -d '{ "url": "https://example.com/report", "code": "q3", "title": "Q3 report" }'

code, title and expires_at (ISO date, in the years 1970 to 9999 UTC) are optional. Returns 201:

Response
{ "id": "…", "code": "q3", "url": "https://acme.colophon.fyi/l/q3", "target_url": "https://example.com/report" }

GET /api/v1/links returns { "links": [ … ] } with state (ok, disabled, expired, flagged), expires_at, clicks_7d and created_at on each.

Traffic#

GET /api/v1/stats/sites/:id

?range=30d · scope stats · range 7d, 30d or 90d

Response
{
  "views": 1284, "uniques": 402,
  "topPages": [{ "path": "/", "views": 712 }],
  "topReferrers": [{ "host": "news.ycombinator.com", "views": 88 }],
  "countries": [], "devices": [{ "device": "desktop", "views": 1010 }],
  "daily": [{ "day": "2026-09-04", "views": 61, "uniques": 30 }]
}

daily lists only days that had traffic. See Analytics for how uniques are counted.

Audit log#

GET /api/v1/audit/export

scope audit · ?format=jsonl|csv · ?from= · ?to=

shell
curl -sS -H "Authorization: Bearer $COLOPHON_TOKEN" -o audit.jsonl \
  "https://api.usercontent.colophon.fyi/api/v1/audit/export?from=2026-01-01&to=2026-04-01"

The workspace’s audit log as a file, one entry a line, ending in a manifest Colophon signs; colophon audit verify checks it. from and to are ISO moments or dates (midnight UTC), to not included; both optional. The key needs the audit scope, which a key has only when minted with it; a login needs the owner role. The fields, the manifest and how to check it by hand are on Audit log & export.

API reference — Colophon docs