Skip to content
Coritan Docs

Organization API: Org Workspace

Every Organization API operation tagged Org Workspace.

View as Markdown

Base URL: https://api.coritan.com/api/v1. Paths below are complete.

To try these requests in the browser, open the interactive Organization API reference.

Method Path Summary
GET /api/v1/orgs/{org_slug}/workspace/builder/servers The servers a project can be linked to
GET /api/v1/orgs/{org_slug}/workspace/builder/sessions The signed-in customer's projects
POST /api/v1/orgs/{org_slug}/workspace/builder/sessions Start a project
GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid} One project
PATCH /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid} Rename, link or archive a project
POST /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/approvals/{tool_use_id} Answer a run's card
GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/changes What a project has changed in its workspace
GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/events Read a project's events
GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/events/stream Stream a project's events
GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/files List a folder of a project's workspace
GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/files/content Read a file of a project's workspace
GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/messages A project's conversation
POST /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/messages Send a message and start a run
POST /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/repository Give a project its repository
POST /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/runs/{run_id}/cancel Stop a run
POST /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/workspace/wake Wake a project's workspace
GET /api/v1/orgs/{org_slug}/workspace/config Workspace config
GET /api/v1/orgs/{org_slug}/workspace/github The signed-in customer's connected GitHub account
DELETE /api/v1/orgs/{org_slug}/workspace/github Disconnect the signed-in customer's GitHub account
POST /api/v1/orgs/{org_slug}/workspace/github/authorize Start connecting the signed-in customer's GitHub account
GET /api/v1/orgs/{org_slug}/workspace/github/branches Branches of a repository the customer's GitHub account reaches
GET /api/v1/orgs/{org_slug}/workspace/github/callback Where GitHub sends the browser after the customer approves the store's App
POST /api/v1/orgs/{org_slug}/workspace/github/link Finish connecting the signed-in customer's GitHub account
GET /api/v1/orgs/{org_slug}/workspace/github/repositories Repositories the customer's GitHub account reaches through the store's App
POST /api/v1/orgs/{org_slug}/workspace/github/repositories Create a repository on the customer's GitHub account or one of their organizations
PUT /api/v1/orgs/{org_slug}/workspace/limit Set or remove the signed-in customer's own monthly limit for paid models
GET /api/v1/orgs/{org_slug}/workspace/usage The signed-in customer's own paid model usage, newest first, one item for each run

The servers a project can be linked to

Section titled The servers a project can be linked to

GET /api/v1/orgs/{org_slug}/workspace/builder/servers

The signed-in customer's servers that a project, or a chat with the store's assistant, can be linked to.

items holds {id, name, software, state} for each, by name, at most 50: the customer's own servers and the ones another customer shared with them with the right to add files. A server whose service is suspended, cancelled or ending is left out, and so is every server of another customer. id is what server takes in POST /workspace/builder/sessions and PATCH /workspace/builder/sessions/{uuid}. state is running, starting, stopping, offline or unknown, or installing, install_failed or transferring while one of those holds the server up. A customer with no such server gets an empty list.

Needs the customer's bearer token (401 without one). A support session can read it. Answers 404 when the store has no workspace. The list takes no parameter and is not rate limited.

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
items array of BuilderServer The servers a project can be linked to, by name. At most 50.
items[].id string The server's id: what server takes when a project is created or changed.
items[].name string The server's name.
items[].software string What the server runs, such as Paper. Empty when nothing names it.
items[].state string running, starting, stopping, offline or unknown, or what holds the server up: installing, install_failed or transferring.

The signed-in customer's projects

Section titled The signed-in customer's projects

GET /api/v1/orgs/{org_slug}/workspace/builder/sessions

One page of the customer's own projects, the one with the newest activity first.

A project is a place where a paid model builds something for the customer: it holds the conversation, the runs, and a workspace with the files. The list never holds another customer's project. total counts every project with the same status, for paging with offset and limit.

Needs the customer's bearer token (401 without one). A support session can read it. Answers 404 when the store has no workspace.

Name In Type Required Description
org_slug path string yes
status query string no active lists the projects that are not archived, archived the archived ones. Any other word answers 422 with a sentence that names the two. Default: active.
offset query integer no How many projects to skip, for the next page: the previous offset plus limit. A negative number answers 422. Default: 0.
limit query integer no How many projects to answer, 1 to 100. Anything else answers 422. Default: 30.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
items array of BuilderSession
items[].uuid string The project's id in every route here.
items[].title string
items[].status string active or archived.
items[].repository string The project's GitHub repository as owner/name. Empty when it has none.
items[].base_branch string The branch the project started from. Empty without a repository.
items[].branch string The branch the project pushes to. Empty without a repository.
items[].model string The paid model of the project's last message. Empty before the first.
items[].pr BuilderPullRequest or null The pull request of the project's branch. Null when it has none.
items[].pull_requests array of BuilderListedPullRequest Every pull request the project opened, newest first.
items[].spent string What the project has cost the customer so far, in USD with four decimals.
items[].workspace BuilderWorkspaceState
items[].preview BuilderPreview or null The project's preview address. Null when it has none.
items[].server BuilderLinkedServer or null The customer's server this project is linked to. Null when it has none, and when that server is gone, suspended or no longer the customer's.
items[].active_run BuilderRun or null The run that is live now. Null when none is.
items[].last_run BuilderRun or null The newest run that ended. Null before the first has.
items[].last_activity_at string or null When the project last changed, ISO 8601 in UTC with a Z.
items[].created_at string or null
total integer How many projects have this status, for paging.
offset integer
limit integer

POST /api/v1/orgs/{org_slug}/workspace/builder/sessions

Creates a project for the signed-in customer and answers it with 201. Nothing runs and nothing is charged until the first message.

title is 1 to 120 characters after trimming, and New project when left out. repository names a GitHub repository as owner/name: the customer's connected GitHub account must reach it through the store's App, and the project then starts from base_branch, or from the repository's default branch when that is left out. Without a repository the project starts empty, and one can be named later.

server links the project to one of the customer's own servers: an id from GET /workspace/builder/servers. The model is then told that the project is for one of the customer's servers, and its list of servers marks which. Each copy of a file still waits for the customer's answer on its card. Left out or null, the project has no linked server, and one can be linked later with PATCH.

Needs the customer's bearer token (401 without one). Answers 404 when the store has no workspace. A support session cannot create a project (403). Then, each with a sentence in detail:

  • 422 for a title that is too long and for a repository that is not owner/name.
  • 422 with You have no server with that id. for a server that is not one of the customer's own servers: an unknown id, another customer's server, a suspended or ending one, and text that is no id all read the same. No project is created.
  • The refusal's own status when the customer's GitHub account does not reach the repository.
  • 409 when the customer keeps as many projects as they may. Archiving one makes room.
  • 429 after 20 project changes in an hour: creating, renaming, archiving, linking a server and naming a repository count.

A created project is recorded in the store's audit log, with the server it was linked to.

Name In Type Required
org_slug path string yes

application/json (required)

Field Type Required Description
title string or null no The project's name: 1 to 120 characters after trimming. Left out or empty: New project. A longer one answers 422.
repository string or null no A GitHub repository as owner/name that the customer's connected account reaches through the store's App. Left out or empty: a project with no repository. Any other form answers 422, and one the account cannot reach answers the refusal's own status with a sentence.
base_branch string or null no The branch to start from. Left out: the repository's default branch. Ignored without a repository.
server string or null no The id of one of the customer's own servers, from GET /workspace/builder/servers, to link the project to. Left out or null: a project with no linked server. Anything else answers 422 with You have no server with that id.: an unknown id, another customer's server, a suspended or ending one, and text that is no id. Text over 200 characters and a value that is no text answer 422 with the list of fields.
Status Meaning
201 Success.
422 The request is not valid. detail lists each problem.

Fields of a 201 response:

Field Type Description
uuid string The project's id in every route here.
title string
status string active or archived.
repository string The project's GitHub repository as owner/name. Empty when it has none.
base_branch string The branch the project started from. Empty without a repository.
branch string The branch the project pushes to. Empty without a repository.
model string The paid model of the project's last message. Empty before the first.
pr BuilderPullRequest or null The pull request of the project's branch. Null when it has none.
pr.number integer
pr.url string or null
pr.state string or null open, closed or merged.
pull_requests array of BuilderListedPullRequest Every pull request the project opened, newest first.
pull_requests[].number integer
pull_requests[].url string or null
pull_requests[].state string or null open, closed or merged.
pull_requests[].branch string or null
pull_requests[].title string or null
spent string What the project has cost the customer so far, in USD with four decimals.
workspace BuilderWorkspaceState
workspace.status string none (the project has no workspace yet), starting, ready, asleep, failed or locked.
preview BuilderPreview or null The project's preview address. Null when it has none.
preview.url string The address of the project's preview. Anyone with the link can open it.
preview.ready boolean Whether the address is served yet.
server BuilderLinkedServer or null The customer's server this project is linked to. Null when it has none, and when that server is gone, suspended or no longer the customer's.
server.id string The server's id, as the customer's server pages use it.
server.name string The server's name as it is now.
active_run BuilderRun or null The run that is live now. Null when none is.
active_run.id integer
active_run.status string queued, running, waiting_approval (a card waits for the customer's answer), waiting_workspace (the workspace is starting), completed, failed or cancelled. The first four are live.
active_run.step integer How many times the model has answered in this run.
active_run.model string The paid model the run works with.
active_run.error string or null A sentence for the customer that says why the run ended early. Null when it has none.
active_run.started_at string or null When the run began to work, ISO 8601 in UTC with a Z. Null while it is queued.
active_run.finished_at string or null When the run ended. Null while it is live.
last_run BuilderRun or null The newest run that ended. Null before the first has.
last_run.id integer
last_run.status string queued, running, waiting_approval (a card waits for the customer's answer), waiting_workspace (the workspace is starting), completed, failed or cancelled. The first four are live.
last_run.step integer How many times the model has answered in this run.
last_run.model string The paid model the run works with.
last_run.error string or null A sentence for the customer that says why the run ended early. Null when it has none.
last_run.started_at string or null When the run began to work, ISO 8601 in UTC with a Z. Null while it is queued.
last_run.finished_at string or null When the run ended. Null while it is live.
last_activity_at string or null When the project last changed, ISO 8601 in UTC with a Z.
created_at string or null

GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}

One of the customer's own projects.

spent is what the project has cost so far. workspace.status is none, starting, ready, asleep, failed or locked. active_run is the run that works now, and last_run the newest one that ended: its error is a sentence to show the customer. preview is null unless the project has a preview address.

Needs the customer's bearer token (401 without one). A support session can read it. Answers 404 with There is no such project. for a uuid that is not one of the customer's own projects, whatever else it names, and 404 when the store has no workspace.

Name In Type Required
org_slug path string yes
session_uuid path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
uuid string The project's id in every route here.
title string
status string active or archived.
repository string The project's GitHub repository as owner/name. Empty when it has none.
base_branch string The branch the project started from. Empty without a repository.
branch string The branch the project pushes to. Empty without a repository.
model string The paid model of the project's last message. Empty before the first.
pr BuilderPullRequest or null The pull request of the project's branch. Null when it has none.
pr.number integer
pr.url string or null
pr.state string or null open, closed or merged.
pull_requests array of BuilderListedPullRequest Every pull request the project opened, newest first.
pull_requests[].number integer
pull_requests[].url string or null
pull_requests[].state string or null open, closed or merged.
pull_requests[].branch string or null
pull_requests[].title string or null
spent string What the project has cost the customer so far, in USD with four decimals.
workspace BuilderWorkspaceState
workspace.status string none (the project has no workspace yet), starting, ready, asleep, failed or locked.
preview BuilderPreview or null The project's preview address. Null when it has none.
preview.url string The address of the project's preview. Anyone with the link can open it.
preview.ready boolean Whether the address is served yet.
server BuilderLinkedServer or null The customer's server this project is linked to. Null when it has none, and when that server is gone, suspended or no longer the customer's.
server.id string The server's id, as the customer's server pages use it.
server.name string The server's name as it is now.
active_run BuilderRun or null The run that is live now. Null when none is.
active_run.id integer
active_run.status string queued, running, waiting_approval (a card waits for the customer's answer), waiting_workspace (the workspace is starting), completed, failed or cancelled. The first four are live.
active_run.step integer How many times the model has answered in this run.
active_run.model string The paid model the run works with.
active_run.error string or null A sentence for the customer that says why the run ended early. Null when it has none.
active_run.started_at string or null When the run began to work, ISO 8601 in UTC with a Z. Null while it is queued.
active_run.finished_at string or null When the run ended. Null while it is live.
last_run BuilderRun or null The newest run that ended. Null before the first has.
last_run.id integer
last_run.status string queued, running, waiting_approval (a card waits for the customer's answer), waiting_workspace (the workspace is starting), completed, failed or cancelled. The first four are live.
last_run.step integer How many times the model has answered in this run.
last_run.model string The paid model the run works with.
last_run.error string or null A sentence for the customer that says why the run ended early. Null when it has none.
last_run.started_at string or null When the run began to work, ISO 8601 in UTC with a Z. Null while it is queued.
last_run.finished_at string or null When the run ended. Null while it is live.
last_activity_at string or null When the project last changed, ISO 8601 in UTC with a Z.
created_at string or null

Rename, link or archive a project

Section titled Rename, link or archive a project

PATCH /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}

Renames a project, links it to a server or unlinks it, archives it, or any of these at once, and answers the project.

title is 1 to 120 characters after trimming. archived: true archives the project and stops its live run. The conversation stays readable, the workspace and its files are deleted soon after, and the project itself is deleted later. An archived project cannot be opened again: archived: false answers 409 for one, and changes nothing for an active project.

server is read only when the body holds the key. An id from GET /workspace/builder/servers links the project to that server, in the place of the one it was linked to. null unlinks it, and changes nothing for a project with no link. A body without the key leaves the link as it is. The link takes effect with the project's next message: the model is told the project is for one of the customer's servers, and its list of servers marks which. Each copy of a file still waits for the customer's answer on its card.

Needs the customer's bearer token (401 without one). A support session cannot change a project (403). Answers 404 for a project that is not the customer's own, and 429 after 20 project changes in an hour. Then, each with a sentence in detail:

  • 422 for a body with none of the three fields, and for a title that is empty or too long.
  • 422 with You have no server with that id. for a server that is not one of the customer's own servers: an unknown id, another customer's server, a suspended or ending one, and text that is no id all read the same. Nothing is changed, the title included.
  • 409 for a server in the body of an archived project, whose link can no longer change.

Archiving, linking and unlinking are recorded in the store's audit log.

Name In Type Required
org_slug path string yes
session_uuid path string yes

application/json (required)

Field Type Required Description
title string or null no A new name: 1 to 120 characters after trimming. An empty or longer one answers 422.
archived boolean or null no true archives the project and stops its live run. false changes nothing for an active project and answers 409 for an archived one, which cannot be opened again. Anything but true or false answers 422.
server string or null no The id of one of the customer's own servers, from GET /workspace/builder/servers, links the project to it and replaces the server it was linked to. null unlinks the project. A body without the key leaves the link as it is. Anything else answers 422 with You have no server with that id.: an unknown id, another customer's server, a suspended or ending one, and text that is no id. Text over 200 characters and a value that is no text answer 422 with the list of fields.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
uuid string The project's id in every route here.
title string
status string active or archived.
repository string The project's GitHub repository as owner/name. Empty when it has none.
base_branch string The branch the project started from. Empty without a repository.
branch string The branch the project pushes to. Empty without a repository.
model string The paid model of the project's last message. Empty before the first.
pr BuilderPullRequest or null The pull request of the project's branch. Null when it has none.
pr.number integer
pr.url string or null
pr.state string or null open, closed or merged.
pull_requests array of BuilderListedPullRequest Every pull request the project opened, newest first.
pull_requests[].number integer
pull_requests[].url string or null
pull_requests[].state string or null open, closed or merged.
pull_requests[].branch string or null
pull_requests[].title string or null
spent string What the project has cost the customer so far, in USD with four decimals.
workspace BuilderWorkspaceState
workspace.status string none (the project has no workspace yet), starting, ready, asleep, failed or locked.
preview BuilderPreview or null The project's preview address. Null when it has none.
preview.url string The address of the project's preview. Anyone with the link can open it.
preview.ready boolean Whether the address is served yet.
server BuilderLinkedServer or null The customer's server this project is linked to. Null when it has none, and when that server is gone, suspended or no longer the customer's.
server.id string The server's id, as the customer's server pages use it.
server.name string The server's name as it is now.
active_run BuilderRun or null The run that is live now. Null when none is.
active_run.id integer
active_run.status string queued, running, waiting_approval (a card waits for the customer's answer), waiting_workspace (the workspace is starting), completed, failed or cancelled. The first four are live.
active_run.step integer How many times the model has answered in this run.
active_run.model string The paid model the run works with.
active_run.error string or null A sentence for the customer that says why the run ended early. Null when it has none.
active_run.started_at string or null When the run began to work, ISO 8601 in UTC with a Z. Null while it is queued.
active_run.finished_at string or null When the run ended. Null while it is live.
last_run BuilderRun or null The newest run that ended. Null before the first has.
last_run.id integer
last_run.status string queued, running, waiting_approval (a card waits for the customer's answer), waiting_workspace (the workspace is starting), completed, failed or cancelled. The first four are live.
last_run.step integer How many times the model has answered in this run.
last_run.model string The paid model the run works with.
last_run.error string or null A sentence for the customer that says why the run ended early. Null when it has none.
last_run.started_at string or null When the run began to work, ISO 8601 in UTC with a Z. Null while it is queued.
last_run.finished_at string or null When the run ended. Null while it is live.
last_activity_at string or null When the project last changed, ISO 8601 in UTC with a Z.
created_at string or null

POST /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/approvals/{tool_use_id}

Records the customer's yes or no to a card, and answers the run.

A run shows a card before it copies a file from the workspace to one of the customer's own servers: the approval_requested event holds its tool_use_id and a summary to show. The run waits, as waiting_approval, until the customer answers. approve lets the copy happen and deny tells the model that the customer said no. The time a card waits does not count towards the run's time limit.

Only the project's own customer answers, with their own sign-in. Needs the customer's bearer token (401 without one). A support session cannot answer (403). Answers 404 for a project that is not the customer's own, 409 with a sentence when no run is live or that card is not waiting, 422 for a decision that is neither word, and 429 after 30 answers in an hour. The answer is recorded in the store's audit log with the server and the destination the card named.

Name In Type Required Description
org_slug path string yes
session_uuid path string yes
tool_use_id path string yes The tool_use_id of the approval_requested event that showed the card.

application/json (required)

Field Type Required Description
decision string, one of approve, deny yes approve or deny. Any other word answers 422.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
run BuilderRun
run.id integer
run.status string queued, running, waiting_approval (a card waits for the customer's answer), waiting_workspace (the workspace is starting), completed, failed or cancelled. The first four are live.
run.step integer How many times the model has answered in this run.
run.model string The paid model the run works with.
run.error string or null A sentence for the customer that says why the run ended early. Null when it has none.
run.started_at string or null When the run began to work, ISO 8601 in UTC with a Z. Null while it is queued.
run.finished_at string or null When the run ended. Null while it is live.

What a project has changed in its workspace

Section titled What a project has changed in its workspace

GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/changes

The files the project changed since its last push, with one unified diff. It waits up to 20 seconds for the workspace.

It never wakes a workspace. Needs the customer's bearer token (401 without one). A support session is refused (403). Answers 404 for a project that is not the customer's own, 409 with The workspace is asleep. Send a message to wake it. while the workspace is asleep, starting or not there, 429 after 600 reads of the workspace in an hour, 502 with a sentence when the workspace could not do it and 504 when it did not answer in time.

Name In Type Required
org_slug path string yes
session_uuid path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
files array of BuilderChangedFile
files[].path string or null
files[].status string or null added, modified, deleted or renamed.
files[].additions integer or null
files[].deletions integer or null
diff string The changes as one unified diff.
truncated boolean True when the diff was cut because it is long.

GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/events

The project's events, oldest first. Pass last_id as after to read on. Events are kept for seven days, and the conversation stays in the messages after that.

An event is {id, kind, payload, created_at}. The kinds are run_started, run_finished, status, message, text_delta, tool_call, tool_output, tool_result, approval_requested, approval_resolved, usage, pushed, branch, pull_request, deployed and workspace. usage holds {run_id, spent}, where spent is what the project has cost when the event is read. workspace holds {status}. An error in a payload is a sentence to show the customer. Events of any other kind are not sent, so a page can hold fewer than limit events, or none, while last_id still moves on.

run_id keeps one run's events, which is how a page that opens while a run works rebuilds it. tail tells a page that already holds the messages where to start following from.

Needs the customer's bearer token (401 without one). A support session is refused (403): an organization's staff never read a project's conversation or files. Answers 404 for a project that is not the customer's own.

Name In Type Required Description
org_slug path string yes
session_uuid path string yes
after query integer no Answer the events with an id above this one. 0 reads from the start. A negative number answers 422. Default: 0.
limit query integer no The most events to read, 1 to 500. Anything else answers 422. Default: 200.
run_id query integer or null no Keep the events of this run of the project. A run of any other project matches nothing.
tail query boolean no true answers no events and last_id as the id of the project's newest event, 0 when it has none. Default: False.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
events array of BuilderEvent
events[].id integer The cursor: pass it as after to read on.
events[].kind string run_started, run_finished, status, message, text_delta, tool_call, tool_output, tool_result, approval_requested, approval_resolved, usage, pushed, branch, pull_request, deployed or workspace.
events[].payload Payload
events[].created_at string or null
last_id integer The id of the last event read, sent or not. Pass it as after for the next page.

GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/events/stream

The project's events as server-sent events: what it holds after the cursor, then each new one as it is written.

Each frame has id (the event's id), event (its kind) and data (its payload as JSON), with the same kinds and payloads as GET .../events. The stream opens with the comment : connected, sends the comment : keepalive after 15 quiet seconds and ends after 15 minutes. Connect again with Last-Event-ID, or with after, to carry on from the last event received. Send Accept: text/event-stream, as a browser's EventSource does, so the frames arrive as they are written.

Needs the customer's bearer token (401 without one). A support session is refused (403): an organization's staff never read a project's conversation or files. Answers 404 for a project that is not the customer's own.

Name In Type Required Description
org_slug path string yes
session_uuid path string yes
after query integer or null no Start after this event id. Left out: the Last-Event-ID header, else 0. A negative number answers 422.
Last-Event-ID header string or null no The id of the last event the client received. Used when after is left out. A value that is not a number counts as 0.
Status Meaning
200 Server-sent events. Each has id, event (the kind) and data (the payload as JSON).
422 The request is not valid. detail lists each problem.

List a folder of a project's workspace

Section titled List a folder of a project's workspace

GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/files

One level of a folder in the project's workspace: each entry's path, type (file or dir) and size.

It never wakes a workspace. Needs the customer's bearer token (401 without one). A support session is refused (403). Answers 404 for a project that is not the customer's own and, with a sentence, for a folder that is not there or is a file. Answers 409 while the workspace is asleep, starting or not there, 422 for a bad path, 429 after 600 reads of the workspace in an hour, 502 when the workspace could not do it and 504 when it did not answer in time.

Name In Type Required Description
org_slug path string yes
session_uuid path string yes
path query string no A folder relative to the project's root, such as src/main. Empty: the root. An absolute path, or one that holds .., answers 422 with a sentence.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
entries array of BuilderFileEntry
entries[].path string or null
entries[].type string or null file or dir.
entries[].size integer or null Bytes, for a file.

Read a file of a project's workspace

Section titled Read a file of a project's workspace

GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/files/content

One file of the project's workspace as text. A long file is cut and truncated says so. A binary file answers binary: true and no content.

It never wakes a workspace. Needs the customer's bearer token (401 without one). A support session is refused (403). Answers 404 for a project that is not the customer's own and, with a sentence, for a file that is not there or is a folder. Answers 409 while the workspace is asleep, starting or not there, 422 for a bad path, 429 after 600 reads of the workspace in an hour, 502 when the workspace could not do it and 504 when it did not answer in time.

Name In Type Required Description
org_slug path string yes
session_uuid path string yes
path query string yes A file relative to the project's root, such as src/main/App.java. An empty or absolute path, or one that holds .., answers 422 with a sentence.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
content string The file's text. Empty for a binary file.
size integer The file's size in bytes.
truncated boolean True when the file is long and content holds its start only.
binary boolean

GET /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/messages

Every message of the project in order.

A message's content is a list of blocks: text, tool_use (what the model asked a tool to do) and tool_result (what the tool answered). No other kind of block is sent, so a message can hold an empty list.

Needs the customer's bearer token (401 without one). A support session is refused (403): an organization's staff never read a project's conversation or files. Answers 404 for a project that is not the customer's own.

Name In Type Required
org_slug path string yes
session_uuid path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
messages array of BuilderMessage
messages[].id integer
messages[].seq integer The message's place in the conversation, from 1.
messages[].role string user or assistant.
messages[].content array of object The message's blocks: {type: text, text}, {type: tool_use, id, name, input} and {type: tool_result, tool_use_id, content, is_error}. No other kind of block is sent.
messages[].created_at string or null

Send a message and start a run

Section titled Send a message and start a run

POST /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/messages

Saves the customer's message and queues the run that answers it with a paid model. Answers 202 with the run and the message. Follow the run on the project's event stream.

model is the id of a paid model from models of GET /workspace/config. Each call the model makes is charged to the customer's account credit at the store's price.

Before anything is saved the route asks whether the customer may use that model now. A refusal answers 402 with detail: {code, message}: code is builder_closed, inactive, verify_email, blocked, no_price (the model is not a paid model on offer), daily_cap, monthly_limit or add_funds, and message is a sentence to show the customer.

Needs the customer's bearer token (401 without one). A support session cannot send a message (403). Answers 404 for a project that is not the customer's own, 409 with a sentence for an archived project and while a run is live in the project, 422 with a sentence for a text that is empty or longer than 20,000 characters, and 429 after 60 messages in an hour. The store's audit log records that a run started and with which model, never the text.

Name In Type Required
org_slug path string yes
session_uuid path string yes

application/json (required)

Field Type Required Description
text string yes What the customer asks for: 1 to 20,000 characters after trimming. Anything else answers 422 with a sentence.
model string yes The id of a paid model from models of GET /workspace/config. A model that is not on offer, and the free model, answer 402 with the code no_price.
Status Meaning
202 Success.
422 The request is not valid. detail lists each problem.

Fields of a 202 response:

Field Type Description
run BuilderRun
run.id integer
run.status string queued, running, waiting_approval (a card waits for the customer's answer), waiting_workspace (the workspace is starting), completed, failed or cancelled. The first four are live.
run.step integer How many times the model has answered in this run.
run.model string The paid model the run works with.
run.error string or null A sentence for the customer that says why the run ended early. Null when it has none.
run.started_at string or null When the run began to work, ISO 8601 in UTC with a Z. Null while it is queued.
run.finished_at string or null When the run ended. Null while it is live.
message BuilderMessage
message.id integer
message.seq integer The message's place in the conversation, from 1.
message.role string user or assistant.
message.content array of object The message's blocks: {type: text, text}, {type: tool_use, id, name, input} and {type: tool_result, tool_use_id, content, is_error}. No other kind of block is sent.
message.created_at string or null

POST /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/repository

Names the GitHub repository of a project that started without one, and answers the project.

The customer's connected GitHub account must reach repository through the store's App. The project's next push then puts its files on a new branch on top of base_branch, or of the repository's default branch when that is left out. A project has one repository: it cannot be changed afterwards.

Needs the customer's bearer token (401 without one). A support session cannot change a project (403). Answers 404 for a project that is not the customer's own, 409 for a project that has a repository and for an archived one, 422 for a repository that is not owner/name, the refusal's own status with a sentence when the account does not reach it, and 429 after 20 project changes in an hour. It is recorded in the store's audit log.

Name In Type Required
org_slug path string yes
session_uuid path string yes

application/json (required)

Field Type Required Description
repository string yes The GitHub repository as owner/name. Any other form answers 422 with a sentence.
base_branch string or null no The branch the project's work goes onto. Left out: the repository's default branch.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
uuid string The project's id in every route here.
title string
status string active or archived.
repository string The project's GitHub repository as owner/name. Empty when it has none.
base_branch string The branch the project started from. Empty without a repository.
branch string The branch the project pushes to. Empty without a repository.
model string The paid model of the project's last message. Empty before the first.
pr BuilderPullRequest or null The pull request of the project's branch. Null when it has none.
pr.number integer
pr.url string or null
pr.state string or null open, closed or merged.
pull_requests array of BuilderListedPullRequest Every pull request the project opened, newest first.
pull_requests[].number integer
pull_requests[].url string or null
pull_requests[].state string or null open, closed or merged.
pull_requests[].branch string or null
pull_requests[].title string or null
spent string What the project has cost the customer so far, in USD with four decimals.
workspace BuilderWorkspaceState
workspace.status string none (the project has no workspace yet), starting, ready, asleep, failed or locked.
preview BuilderPreview or null The project's preview address. Null when it has none.
preview.url string The address of the project's preview. Anyone with the link can open it.
preview.ready boolean Whether the address is served yet.
server BuilderLinkedServer or null The customer's server this project is linked to. Null when it has none, and when that server is gone, suspended or no longer the customer's.
server.id string The server's id, as the customer's server pages use it.
server.name string The server's name as it is now.
active_run BuilderRun or null The run that is live now. Null when none is.
active_run.id integer
active_run.status string queued, running, waiting_approval (a card waits for the customer's answer), waiting_workspace (the workspace is starting), completed, failed or cancelled. The first four are live.
active_run.step integer How many times the model has answered in this run.
active_run.model string The paid model the run works with.
active_run.error string or null A sentence for the customer that says why the run ended early. Null when it has none.
active_run.started_at string or null When the run began to work, ISO 8601 in UTC with a Z. Null while it is queued.
active_run.finished_at string or null When the run ended. Null while it is live.
last_run BuilderRun or null The newest run that ended. Null before the first has.
last_run.id integer
last_run.status string queued, running, waiting_approval (a card waits for the customer's answer), waiting_workspace (the workspace is starting), completed, failed or cancelled. The first four are live.
last_run.step integer How many times the model has answered in this run.
last_run.model string The paid model the run works with.
last_run.error string or null A sentence for the customer that says why the run ended early. Null when it has none.
last_run.started_at string or null When the run began to work, ISO 8601 in UTC with a Z. Null while it is queued.
last_run.finished_at string or null When the run ended. Null while it is live.
last_activity_at string or null When the project last changed, ISO 8601 in UTC with a Z.
created_at string or null

POST /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/runs/{run_id}/cancel

Asks a run of the project to stop and answers it. The run ends at its next step, so read the project or follow its events to see it end. A run that has ended is answered as it is.

Needs the customer's bearer token (401 without one). A support session cannot stop a run (403). Answers 404 for a project that is not the customer's own and for a run that is not this project's, and 429 after 120 stops in an hour. A stop is recorded in the store's audit log.

Name In Type Required Description
org_slug path string yes
session_uuid path string yes
run_id path integer yes The run's id. One that is not a number answers 422.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
run BuilderRun
run.id integer
run.status string queued, running, waiting_approval (a card waits for the customer's answer), waiting_workspace (the workspace is starting), completed, failed or cancelled. The first four are live.
run.step integer How many times the model has answered in this run.
run.model string The paid model the run works with.
run.error string or null A sentence for the customer that says why the run ended early. Null when it has none.
run.started_at string or null When the run began to work, ISO 8601 in UTC with a Z. Null while it is queued.
run.finished_at string or null When the run ended. Null while it is live.

POST /api/v1/orgs/{org_slug}/workspace/builder/sessions/{session_uuid}/workspace/wake

Starts the project's workspace, or makes one when the project has none, and answers its state at once while it starts. Read the project, or follow its workspace events, to see it become ready.

A customer wakes a workspace to look at its files. Sending a message wakes it too. A workspace goes back to sleep when nothing has used it for a while.

Needs the customer's bearer token (401 without one). A support session cannot wake a workspace (403). Only a customer who may use a paid model now can wake one: a refusal of the spending guard (no credit, an email that is not verified, a block) answers 402 with {code, message} and starts nothing. Answers 404 for a project that is not the customer's own, and 429 after 30 wakes in an hour. Answers 409 with a sentence for an archived project, while paid models are closed, when another of the customer's projects is working, when the store's workspaces are all in use, and for a workspace that is locked.

Name In Type Required
org_slug path string yes
session_uuid path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
workspace BuilderWorkspaceState
workspace.status string none (the project has no workspace yet), starting, ready, asleep, failed or locked.

GET /api/v1/orgs/{org_slug}/workspace/config

What the store's AI workspace offers: the free model, the paid models with their prices, and the caller's account.

Answers 404 when the store has no workspace. It works without a token: account is then null and signed_in false. Send the customer's bearer token to get their balance, what they spent, their limits and paid, which says whether they may use a paid model now and, when not, why (code and a sentence in message). A token that is sent must be valid: an expired one answers 401.

free is the model the assistant chat answers with. It costs the customer nothing and keeps the chat's own message limits. models are the paid models, cheapest output first, each with this store's price in USD for one million tokens as a string. While builder is false no paid model can be chosen yet, and paid.code is builder_closed.

github.available says whether the store has a GitHub App, so the page can offer to connect GitHub. github.linked and github.login are the caller's connected account, and false and null without a token.

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
enabled boolean Always true. A store without the workspace answers 404.
builder boolean Whether a paid model can be chosen yet. While false, list the paid models and let none be picked.
signed_in boolean Whether the request carried a valid customer token.
currency string The currency of every amount here.
free FreeModel
free.model string The id of the model the assistant answers with. It costs the customer nothing.
free.name string Its display name, or the id when the name cannot be read.
free.messages_per_minute integer How many messages a signed-in customer may send it in a minute.
free.messages_per_day integer How many messages a signed-in customer may send it in a day.
models array of PaidModel The paid models with this store's prices, cheapest output first.
models[].id string The model's id.
models[].name string Its display name, or the id when the name cannot be read.
models[].input string USD for one million input tokens.
models[].output string USD for one million output tokens.
models[].cache_read string USD for one million tokens read from the cache.
models[].cache_write string USD for one million tokens written to the cache.
models[].context_tokens integer or null How many tokens of context the model takes. Null when it cannot be read.
account Account or null The signed-in customer's figures. Null without a token.
account.balance string The customer's account credit, in USD with four decimals.
account.owed string Paid model usage that is not charged to the balance yet.
account.available string balance less owed, never below zero.
account.spent_today string What the customer spent on paid models today (UTC).
account.daily_cap string The most this customer may spend on paid models in one day (UTC), with two decimals.
account.spent_month string What the customer spent on paid models this calendar month (UTC).
account.monthly_limit string or null The customer's own limit for a calendar month. Null: no limit.
account.paid PaidVerdict
github GithubState
github.available boolean Whether this store has a GitHub App, so a customer can connect GitHub.
github.linked boolean Whether the signed-in customer has connected a GitHub account. False without a token.
github.login string or null The connected account's GitHub login. Null when none is connected.

The signed-in customer's connected GitHub account

Section titled The signed-in customer's connected GitHub account

GET /api/v1/orgs/{org_slug}/workspace/github

Whether the store has a GitHub App, and the GitHub account the signed-in customer connected.

configured is false and install_url null when the store has no GitHub App. linked is false, and login, name and linked_at are null, until the customer connects an account. It never shows another customer's account, and never a token.

Needs the customer's bearer token (401 without one). A support session can read it. Answers 404 when the store has no workspace.

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
configured boolean Whether this store has a GitHub App, so a customer can connect GitHub.
linked boolean Whether the signed-in customer has connected a GitHub account.
login string or null The connected account's GitHub login. Null when none is connected.
name string or null The connected account's display name. Null when it has none or none is connected.
linked_at string or null When the account was connected, ISO 8601 in UTC with a Z. Null when none is connected.
app_name string or null The name of the store's GitHub App, as GitHub shows it. Null when the store has none.
install_url string or null GitHub's page where the customer chooses which repositories the store's App may reach. Null when the store has no App.

Disconnect the signed-in customer's GitHub account

Section titled Disconnect the signed-in customer's GitHub account

DELETE /api/v1/orgs/{org_slug}/workspace/github

Deletes the customer's connection and the tokens kept with it, then asks GitHub to revoke the token.

Nobody else's connection changes. It answers {"linked": false} when nothing was connected too. The connection is gone even when GitHub cannot be reached to revoke the token.

Needs the customer's bearer token (401 without one). Answers 403 in a support session and 429 after ten starts, redeems and disconnects in an hour. Answers 404 when the store has no workspace.

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
linked boolean Always false.

Start connecting the signed-in customer's GitHub account

Section titled Start connecting the signed-in customer's GitHub account

POST /api/v1/orgs/{org_slug}/workspace/github/authorize

Answers the GitHub address to send the browser to. It works for ten minutes.

Send the request from the workspace page. After the customer approves, GitHub sends the browser back to the storefront host the request came from (its Origin header, else its Referer) when that host is one of the store's own, and to the store's main host otherwise.

Needs the customer's bearer token (401 without one). Answers 409 with a sentence when the store has no GitHub App, 403 in a support session, and 429 after ten starts, redeems and disconnects in an hour. Answers 404 when the store has no workspace.

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
url string The GitHub address to send the browser to, so the customer can approve the store's App.
expires_in integer Seconds the address works for.

Branches of a repository the customer's GitHub account reaches

Section titled Branches of a repository the customer's GitHub account reaches

GET /api/v1/orgs/{org_slug}/workspace/github/branches

The branches of one repository: the default branch first, at most 100.

Needs the customer's bearer token (401 without one). A support session can read it. Answers 404 with a sentence when the repository does not exist or the store's GitHub App cannot reach it, 409 when the customer has not connected GitHub or GitHub asks them to connect again, 429 after 120 list reads in an hour or when GitHub limits requests, and 502 when GitHub cannot be reached. Answers 404 when the store has no workspace.

Name In Type Required Description
org_slug path string yes
repository query string yes The repository as owner/name, as GitHub shows it. Anything else answers 422 with a sentence that names the form.
q query string no Part of a branch name, ignoring case. Empty lists every branch. More than 100 characters answers 422.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
branches array of string At most 100 branch names, the default branch first.
default_branch string

Where GitHub sends the browser after the customer approves the store's App

Section titled Where GitHub sends the browser after the customer approves the store's App

GET /api/v1/orgs/{org_slug}/workspace/github/callback

GitHub calls this with no sign-in token, so the signed state is what is checked.

Answers 303 to the workspace page of the storefront the customer started on. On success the address carries github=ticket and a ticket, which the page posts to POST /workspace/github/link with the customer's token. Otherwise it carries github=error and a reason: denied (the customer said no at GitHub), state (the state is forged, expired, used or from another store), exchange (GitHub did not accept the code or did not answer), account (the GitHub account cannot be used, for example another customer of the store connected it) or not_configured (the store has no GitHub App). A bad state is never a 5xx.

Answers 404 when the store has no workspace or no storefront to send the browser to.

Name In Type Required Description
org_slug path string yes
code query string or null no The code GitHub issued. Missing when the customer refused.
state query string or null no The signed state POST /workspace/github/authorize made.
error query string or null no GitHub's word for a refusal, such as access_denied.
Status Meaning
303 Success.
422 The request is not valid. detail lists each problem.

Finish connecting the signed-in customer's GitHub account

Section titled Finish connecting the signed-in customer's GitHub account

POST /api/v1/orgs/{org_slug}/workspace/github/link

Redeems the ticket the callback made. A ticket works once, for the customer who started, within 15 minutes.

The answer is what GET /workspace/github answers. Connecting again replaces the customer's earlier connection.

Needs the customer's bearer token (401 without one). Answers 400 for a ticket that is forged, expired, used or made at another store, 403 for one another customer started (it still works for its owner), and 409 when another customer of the store has connected that GitHub account. Answers 403 in a support session and 429 after ten starts, redeems and disconnects in an hour. Answers 404 when the store has no workspace.

Name In Type Required
org_slug path string yes

application/json (required)

Field Type Required Description
ticket string yes The ticket the callback put in the workspace page's address as ticket.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
configured boolean Whether this store has a GitHub App, so a customer can connect GitHub.
linked boolean Whether the signed-in customer has connected a GitHub account.
login string or null The connected account's GitHub login. Null when none is connected.
name string or null The connected account's display name. Null when it has none or none is connected.
linked_at string or null When the account was connected, ISO 8601 in UTC with a Z. Null when none is connected.
app_name string or null The name of the store's GitHub App, as GitHub shows it. Null when the store has none.
install_url string or null GitHub's page where the customer chooses which repositories the store's App may reach. Null when the store has no App.

Repositories the customer's GitHub account reaches through the store's App

Section titled Repositories the customer's GitHub account reaches through the store's App

GET /api/v1/orgs/{org_slug}/workspace/github/repositories

One page of the repositories the customer chose for the store's GitHub App, sorted by name.

Archived repositories are left out. installations is zero when the customer has not chosen repositories yet: send them to install_url, GitHub's page for that, and read the list again when they come back.

accounts holds the accounts the store's App is installed on for the customer, each as {login, kind}: their own account first (kind is user), then organizations by login (kind is organization), each once. It is where POST /workspace/github/repositories can create a repository, and it is empty when installations is zero.

Needs the customer's bearer token (401 without one). A support session can read it. Answers 409 when the customer has not connected GitHub or GitHub asks them to connect again, 429 after 120 list reads in an hour or when GitHub limits requests, and 502 when GitHub cannot be reached. Answers 404 when the store has no workspace.

Name In Type Required Description
org_slug path string yes
q query string no Part of owner/name, ignoring case. Empty lists every repository. More than 100 characters answers 422.
page query integer no Page number, 1 to 100. Each page holds 30 repositories. A page past the end is empty. Anything else answers 422. Default: 1.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
items array of Repository At most 30 repositories, sorted by full_name.
items[].full_name string owner/name.
items[].default_branch string
items[].private boolean
has_more boolean True when another page follows.
installations integer How many installations of the store's App the customer's account reaches. Zero: they have not chosen repositories yet.
accounts array of GithubAccount The accounts a new repository can go to: the ones the store's App is installed on for the customer. Their own account comes first when the App is installed on it, then organizations by login. The same on every page.
accounts[].login string The account's GitHub login, as GitHub spells it.
accounts[].kind string user for the customer's own account, organization for an organization.
install_url string or null GitHub's page where the customer chooses repositories, as GET /workspace/github answers it.

Create a repository on the customer's GitHub account or one of their organizations

Section titled Create a repository on the customer's GitHub account or one of their organizations

POST /api/v1/orgs/{org_slug}/workspace/github/repositories

Creates a repository on GitHub as the signed-in customer, with a first commit to build on, and answers it.

name is 1 to 100 letters, digits, dots, hyphens and underscores, is not . or .. and does not end in .git. private is true unless the body says false. description is one line of at most 350 characters. owner is the GitHub login the repository goes to, in any case: left out, null or the customer's own login for their own account, else an organization in accounts of GET /workspace/github/repositories.

The answer is 201 with {full_name, default_branch, private, html_url, reachable}. reachable is false when the customer chose selected repositories for the store's App and GitHub did not add the new one: send them to install_url to choose it, then read the list again. This route creates a repository and nothing else: no route here deletes, renames or changes one.

Needs the customer's bearer token (401 without one). Answers 404 when the store has no workspace. A support session cannot create a repository (403). Then, each with a sentence in detail:

  • 422 for a name, a description or an owner outside its rule, and for an owner that is neither the customer's own account nor an organization the store's App is installed on. GitHub is not asked to create anything, and a bad name or description uses none of the hourly budget.
  • 409 when the customer has not connected GitHub or GitHub asks them to connect again, when the store's App is not installed on their own account (send them to install_url first), and when a repository with that name exists in the account.
  • 422 when GitHub does not accept the name.
  • 403 when GitHub does not allow the customer or the store's App to create a repository in that account.
  • 429 after ten creations in an hour, or when GitHub limits requests.
  • 502 when GitHub cannot be reached.

A created repository is recorded in the store's audit log with its owner/name and whether it is private.

Name In Type Required
org_slug path string yes

application/json (required)

Field Type Required Description
name string yes The new repository's name: 1 to 100 letters, digits, dots, hyphens and underscores. It is not . or .. and does not end in .git. Anything else answers 422 with a sentence that says what a name holds.
private boolean no Whether the repository is private. True when left out. Anything but true or false answers 422.
description string or null no One line of at most 350 characters for the repository's page on GitHub. Left out, null or empty: no description. A line break inside it, or a longer one, answers 422 with a sentence.
owner string or null no The GitHub login the repository goes to, in any case: the customer's own, or an organization in accounts of GET /workspace/github/repositories. Left out or null: the customer's own account. Any other login answers 422 with a sentence.
Status Meaning
201 Success.
422 The request is not valid. detail lists each problem.

Fields of a 201 response:

Field Type Description
full_name string owner/name, as GitHub spells it.
default_branch string
private boolean
html_url string The repository's page on GitHub.
reachable boolean Whether the store's App can reach the new repository. False when the customer chose selected repositories for the App and GitHub did not add this one: send them to install_url to choose it.

Set or remove the signed-in customer's own monthly limit for paid models

Section titled Set or remove the signed-in customer's own monthly limit for paid models

PUT /api/v1/orgs/{org_slug}/workspace/limit

Set or remove the signed-in customer's own monthly limit for paid models.

Send {"monthly_limit": "20.00"} to set it: USD from 0.01 to 10000 with at most two decimals, as a string or a number. Send {"monthly_limit": null} to remove it. Anything else answers 422 with a sentence that says what the field takes. Once what the customer spent in a calendar month (UTC) reaches the limit, paid refuses with monthly_limit until they raise it or the month ends.

The answer is the customer's account, as account in GET /config. Needs the customer's bearer token. A support session cannot change the limit (403). A customer may change it 30 times an hour (429).

Name In Type Required
org_slug path string yes

application/json (required)

Field Type Required Description
monthly_limit any or null no The most to spend on paid models in a calendar month, in USD: a string or a number from 0.01 to 10000 with at most two decimals. Null removes the limit.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
balance string The customer's account credit, in USD with four decimals.
owed string Paid model usage that is not charged to the balance yet.
available string balance less owed, never below zero.
spent_today string What the customer spent on paid models today (UTC).
daily_cap string The most this customer may spend on paid models in one day (UTC), with two decimals.
spent_month string What the customer spent on paid models this calendar month (UTC).
monthly_limit string or null The customer's own limit for a calendar month. Null: no limit.
paid PaidVerdict
paid.allowed boolean Whether this customer may use a paid model now.
paid.code string or null Why not: builder_closed, support_session, inactive, verify_email, blocked, daily_cap, monthly_limit or add_funds. Null when allowed is true.
paid.message string or null A sentence for the customer that says why not.

The signed-in customer's own paid model usage, newest first, one item for each run

Section titled The signed-in customer's own paid model usage, newest first, one item for each run

GET /api/v1/orgs/{org_slug}/workspace/usage

The signed-in customer's own paid model usage, newest first, one item for each run.

A run is one piece of work with a paid model. Its item sums the calls of the run: the models that answered, the tokens, and amount in USD with four decimals. status is charged once every call is paid from the balance, else owed. total counts every run, for paging with limit and offset. month holds what the customer spent this calendar month (UTC) and the same for each model. The free model is never in it.

Needs the customer's bearer token (401 without one). Answers 404 when the store has no workspace.

Name In Type Required Description
org_slug path string yes
limit query integer no How many runs to answer, 1 to 100. Anything else answers 422. Default: 20.
offset query integer no How many runs to skip, for the next page: the previous offset plus limit. A negative number answers 422. Default: 0.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Fields of a 200 response:

Field Type Description
items array of UsageRun
items[].run_ref string What the calls belong to: one piece of work with a paid model.
items[].models array of string The models that answered in this run.
items[].calls integer
items[].input_tokens integer
items[].output_tokens integer
items[].cache_read_tokens integer
items[].cache_write_tokens integer
items[].amount string What the run came to, in USD with four decimals.
items[].status string charged once every call of the run is paid from the balance, else owed.
items[].at string When the newest call of the run was made, ISO 8601 in UTC.
total integer How many runs there are, for paging.
month UsageMonth
month.amount string What the customer spent on paid models this calendar month (UTC).
month.by_model array of UsageModelMonth The same, for each model, the dearest first.