API Overview

The PlanSpec server exposes a REST API for managing plans programmatically.

Base URL

http://localhost:3000/api/v1

Endpoints

Plans

List Plans

http
GET /plans

Response:

json
{
  "plans": [
    {
      "name": "my-plan",
      "goal": "my-goal",
      "taskCount": 5,
      "progress": 0.4
    }
  ]
}

Get Plan

http
GET /plans/:name

Response:

json
{
  "apiVersion": "planspec.io/v1alpha1",
  "kind": "Plan",
  "metadata": {
    "name": "my-plan"
  },
  "spec": {
    "goalRef": { "name": "my-goal" },
    "tasks": [...]
  }
}

Create Plan

http
POST /plans
Content-Type: application/yaml

Request body: PlanSpec YAML

Update Plan

http
PUT /plans/:name
Content-Type: application/yaml

Delete Plan

http
DELETE /plans/:name

Goals

List Goals

http
GET /goals

Get Goal

http
GET /goals/:name

Create Goal

http
POST /goals
Content-Type: application/yaml

Tasks

Update Task Status

http
PATCH /plans/:planName/tasks/:taskId
Content-Type: application/json

Request:

json
{
  "status": "complete"
}

Get Task Details

http
GET /plans/:planName/tasks/:taskId

Validation

Validate Document

http
POST /validate
Content-Type: application/yaml

Response:

json
{
  "valid": true,
  "errors": [],
  "warnings": []
}

Response Formats

Success

json
{
  "data": {...}
}

Error

json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid plan structure",
    "details": [...]
  }
}

Status Codes

CodeMeaning
200Success
201Created
400Bad Request
404Not Found
422Validation Error
500Server Error

Pagination

For list endpoints:

http
GET /plans?limit=10&offset=0

Response includes:

json
{
  "data": [...],
  "pagination": {
    "total": 25,
    "limit": 10,
    "offset": 0
  }
}

Next Steps