Docs
Templates

Create a template

POST
/v1/templates

Authorization

BearerAuth
AuthorizationBearer <token>

API key (csk_live_…)

In: header

Request Body

application/json

slug*string

Unique template identifier (lowercase, hyphens allowed)

Match^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$
Length1 <= length <= 64
name*string

Human-readable template name

Length1 <= length <= 100
description?string

Template description

Lengthlength <= 500
baseImage*string

Base Docker image

Value in"node-22" | "python-3.12"
envVars?

Environment variables (KEY=value pairs)

guardrails?

Default guardrails for runs using this template

egressDomains?array<>

Allowed egress domains for network access

Itemsitems <= 20

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://api.cospec.io/v1/templates" \  -H "Content-Type: application/json" \  -d '{    "slug": "string",    "name": "string",    "baseImage": "node-22"  }'
{
  "template": {
    "id": "string",
    "slug": "string",
    "name": "string",
    "description": "string",
    "baseImage": "node-22",
    "envVars": {
      "property1": "string",
      "property2": "string"
    },
    "guardrails": {
      "maxTurns": 0,
      "maxCostUsd": 0,
      "timeoutMinutes": 0
    },
    "egressDomains": [
      "string"
    ],
    "isSystem": true,
    "createdBy": "string",
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "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"
}