SITEMAP / DOCS / API REFERENCE

Playbooks API

Per-workspace executable agent specs. A PlaybookSpec pairs a lead source with a strategy and optional adaptation rules; runs are recorded against the spec and tracked over time.

See the Playbooks guide for the concept overview and spec schema.

All endpoints require auth + workspace context. Read-only workspaces return 403 on mutating calls.

01List

GET /v1/playbooks
Authorization: Bearer <token>
{ "playbooks": [ /* PlaybookSpec[] */ ] }

02Create

POST /v1/playbooks
Authorization: Bearer <token>
Content-Type: application/json

{
  "name": "Series B SaaS. New head of growth",
  "mode": "outbound",
  "buddyId": "prospect",
  "strategy": {
    "hypothesis": "...",
    "successMetric": "meeting_booked",
    "successTarget": 3
  }
}

Required fields: name, mode, buddyId, strategy.hypothesis. Missing any of these returns 400. The server assigns id, createdAt, updatedAt, and createdBy. Defaults: status=draft, leadSource.kind=manual, strategy.kind=gtm-execution, adaptation={ enabled:true, minSampleSize:50, pivotWindowDays:3, maxPivotsPerWeek:2 }.

Returns 201 with { "playbook": <spec> }.

03Get

GET /v1/playbooks/:id

Returns { "playbook": <spec> } or 404.

04Update

PUT /v1/playbooks/:id
Content-Type: application/json

{ "status": "active", "strategy": { "successTarget": 5 } }

Partial update. Nested objects (leadSource, strategy, adaptation) shallow-merge. Unknown fields are silently dropped. Invalid enum values (e.g. status: "foo") are ignored.

05Delete

DELETE /v1/playbooks/:id

Returns { "ok": true } or 404.

06Record a run

POST /v1/playbooks/:id/run

Creates a run row with status=running and initial metrics { samples:0, successes:0, metricValue:0 }. Returns 201 with { "run": <run> }.

The actual agent invocation happens client-side via playbook-runtime.ts (opens a buddy chat with a structured prompt built from the spec). This endpoint just records that a run started.

07List runs

GET /v1/playbooks/:id/runs

Returns { "runs": [ /* PlaybookRun[] */ ] } ordered by startedAt.

08Field reference

FieldEnum / bounds
statusdraft · active · paused · archived
modeinbound · outbound · hybrid
buddyIdinsights · prospect · campaign · pipeline
leadSource.kindorange-slice · crm-segment · cio-segment · manual
leadSource.query≤ 1000 chars
leadSource.sampleSize1–5000 (default 50)
strategy.kindpmf-research · gtm-execution · hybrid
strategy.hypothesis≤ 2000 chars
strategy.channels≤ 12 items, each ≤ 60 chars
strategy.successMetricreply_rate · meeting_booked · pipeline_arr · custom
adaptation.minSampleSize1–10000
adaptation.pivotWindowDays1–90
adaptation.maxPivotsPerWeek0–20