Docs
Runs

Create a run

Start an AI agent run on a GitHub repository using a specified template.

POST
/v1/runs

Authorization

BearerAuth
AuthorizationBearer <token>

API key (csk_live_…)

In: header

Request Body

application/json

repo*string

GitHub repository in owner/repo format or full URL

Length1 <= length
branch?string

Git branch to clone

prompt*string

Task prompt for the AI agent

Length1 <= length <= 50000
template*string

Template slug to use for the sandbox

Length1 <= length
guardrails?

Guardrails to limit agent execution

model?string

AI model to use

Default"sonnet"
Value in"sonnet" | "opus" | "haiku"
env?

Environment variables to inject into the sandbox

callbackUrl?string

URL to POST results to on completion/failure

Formaturi
Lengthlength <= 2048
metadata?|

User-defined key-value metadata echoed in responses and webhooks. Max 4 KB, 50 keys.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://api.cospec.io/v1/runs" \  -H "Content-Type: application/json" \  -d '{    "repo": "string",    "prompt": "string",    "template": "string"  }'
{
  "id": "string",
  "status": "pending",
  "createdAt": "2019-08-24T14:15:22Z"
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "requestId": "string"
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "requestId": "string"
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "requestId": "string"
}