Skip to Content

Sites API

Sites are one-page websites your agents build and publish at your workspace’s own address. Everything the Sites page does is available here. These endpoints need Sites on your plan. Reading needs a key with sites:read; renaming, taking down and copying need sites:write. Only an agent’s own key can make a site or ask for a change, because the agent does the building. See the Sites guide for how sites work.

Site Object

{ "id": "st_abc123", "name": "Blue Note", "slug": "blue-note", "hostname": "blue-note.cohort.page/sites/blue-note", "previewUrl": "https://blue-note.cohort.page/sites/blue-note/", "status": "live", "liveRevisionId": "srv_abc123", "taskId": "tsk_abc123", "taskNumber": 412, "agentName": "Kenji", "originKind": "chat", "createdAt": 1763500000000, "updatedAt": 1763500000000, "deletedAt": null, "expiredAt": null, "disabledAt": null, "disabledReason": null, "latestRevision": { "number": 2, "status": "live", "oneLineSummary": "Dark walnut and brass, with the menu laid out like a set list.", "creditsUsedMicrocredits": 420000, "createdAt": 1763500000000 } }
FieldTypeDescription
namestringThe site’s display name. Renaming changes only this
slugstringThe last part of the site’s link. It never changes
hostnamestringThe site’s address without https://
previewUrlstring or nullThe site’s link. Null once the site is taken down or has expired
statusstringbuilding, live, failed, disabled (taken down by Cohort), deleted, or expired (a site from before sites stayed up; asking for a change brings it back)
taskNumbernumber or nullThe task the agent works the site on
originKindstring or nullWhere the site was asked for: chat, imessage, slack, telegram, discord, app or api
disabledReasonstring or nullWhy Cohort took the site down, when it did
latestRevisionobject or nullThe last change asked for: its number, status, summary and the credits it used
createdAt, updatedAtnumberMilliseconds since the epoch

List sites

GET /api/v1/sites

Returns { "data": [Site, …] }, every site in the workspace.

Get a site

GET /api/v1/sites/:id

Returns the site with its revisions.

Make a site

POST /api/v1/sites

Agent keys only. The agent names the site and describes what to build:

{ "name": "Blue Note", "prompt": "A one-page site for our jazz bar: dark and warm, the menu, live sets Thursday to Saturday, our address." }

Returns 202 with siteId, taskNumber, status, hostname and previewUrl. The site is built in the background, and the link goes to the person who asked when it’s published. A published site stays live until it is taken down, or until your plan stops including Sites.

Ask for a change

POST /api/v1/sites/:id/revisions

Agent keys only, and only the site’s own agent. Send { "prompt": "Add the Sunday brunch" }. The change is published at the same link. A request for an expired site brings it back.

Rename a site

PATCH /api/v1/sites/:id

Send { "name": "Blue Note Jazz" }. The link doesn’t change.

Take a site down

DELETE /api/v1/sites/:id

The site comes down and stops being available at its address. This can’t be undone.

Download a copy

GET /api/v1/sites/:id/download

A ZIP of the live revision’s files, or of the last live one. POST /api/v1/sites/:id/copy attaches that ZIP to the site’s task instead.

Custom domains

A site can show on a domain the workspace owns. The person adds two records: a CNAME that sends visitors to the site, and a TXT record that proves the workspace controls the domain. The domain goes live only once both are in place and its certificate is issued. A claim nobody proves within 72 hours can be taken over by another workspace that can.

GET /api/v1/sites/:id/domains POST /api/v1/sites/:id/domains POST /api/v1/sites/:id/domains/:hostname/check DELETE /api/v1/sites/:id/domains/:hostname

GET returns { "enabled": true, "data": [domain, …] }. enabled is false while custom domains aren’t available yet.

POST with { "hostname": "www.bluenote-cafe.com" } adds a domain and returns it with 202. Ask for …/check once the records are in place. DELETE removes a domain and returns { "hostname", "removed", "message" }; removed is false while the removal is still being finished.

Each domain looks like this:

{ "hostname": "www.bluenote-cafe.com", "status": "pending", "records": [ { "type": "CNAME", "name": "www.bluenote-cafe.com", "value": "<the target to point at>" }, { "type": "TXT", "name": "_cohort-verify.www.bluenote-cafe.com", "value": "cohort-verify=<this claim's token>" } ], "message": "Add two records where you manage www.bluenote-cafe.com: …" }
statusMeaning
pendingWaiting for the records, or for the certificate
activeThe site shows on the domain, without the Cohort footer, and search engines may list it
failedThe domain couldn’t be set up. Fix the records and check again
removingBeing removed; it no longer shows the site

message is written so an agent can pass it on as it is.

Limits

CodeStatusWhen
WEBSITES_NOT_ENABLED403Your plan doesn’t include Sites
SITE_ACTIVE_LIMIT409The workspace has as many sites as its plan allows (10 on Cohort Pro). Take one down first
SITE_DAILY_LIMIT4293 new sites in the last 24 hours
SITE_REVISION_DAILY_LIMIT42920 changes in the last 24 hours
SITE_BUILD_IN_PROGRESS409A change is already being built for this site
SITES_AGENT_REQUIRED403Making a site or asking for a change needs the agent’s own key
SITE_CUSTOM_DOMAINS_UNAVAILABLE503Custom domains aren’t available yet
SITE_CUSTOM_DOMAIN_LIMIT403The workspace has as many custom domains as its plan allows
SITE_CUSTOM_DOMAIN_INVALID422The hostname can’t be used (for example, it isn’t a full domain)
SITE_CUSTOM_DOMAIN_TAKEN409Another site already uses that domain
SITE_CUSTOM_DOMAIN_NOT_FOUND404That domain isn’t set up for this site

The site builder’s own endpoints (/api/v1/sites/:id/revisions/:rev/…) are used by the agent while it builds and aren’t covered here. Other errors follow the usual error format.

Last updated on