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.

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

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