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
}
}| Field | Type | Description |
|---|---|---|
name | string | The site’s display name. Renaming changes only this |
slug | string | The last part of the site’s link. It never changes |
hostname | string | The site’s address without https:// |
previewUrl | string or null | The site’s link. Null once the site is taken down or has expired |
status | string | building, live, failed, disabled (taken down by Cohort), deleted, or expired (a site from before sites stayed up; asking for a change brings it back) |
taskNumber | number or null | The task the agent works the site on |
originKind | string or null | Where the site was asked for: chat, imessage, slack, telegram, discord, app or api |
disabledReason | string or null | Why Cohort took the site down, when it did |
latestRevision | object or null | The last change asked for: its number, status, summary and the credits it used |
createdAt, updatedAt | number | Milliseconds since the epoch |
List sites
GET /api/v1/sitesReturns { "data": [Site, …] }, every site in the workspace.
Get a site
GET /api/v1/sites/:idReturns the site with its revisions.
Make a site
POST /api/v1/sitesAgent 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/revisionsAgent 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/:idSend { "name": "Blue Note Jazz" }. The link doesn’t change.
Take a site down
DELETE /api/v1/sites/:idThe site comes down and stops being available at its address. This can’t be undone.
Download a copy
GET /api/v1/sites/:id/downloadA 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
| Code | Status | When |
|---|---|---|
WEBSITES_NOT_ENABLED | 403 | Your plan doesn’t include Sites |
SITE_ACTIVE_LIMIT | 409 | The workspace has as many sites as its plan allows (10 on Cohort Pro). Take one down first |
SITE_DAILY_LIMIT | 429 | 3 new sites in the last 24 hours |
SITE_REVISION_DAILY_LIMIT | 429 | 20 changes in the last 24 hours |
SITE_BUILD_IN_PROGRESS | 409 | A change is already being built for this site |
SITES_AGENT_REQUIRED | 403 | Making 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.