Control API
5 min read
Everything the board does, a script can do. Each running Director serves a local REST Control API - create sessions, send prompts, queue work, interrupt, and close, all over plain JSON. It is how DevThrottle's own scheduler starts sessions, and it is yours to use for automation on your machine.
Ports and discovery
Each Director claims the first free port in the range 7879-7898 on 127.0.0.1 and keeps it across restarts. More than one Director can run on a machine, so discovery is a scan: probe GET /healthz across the range and collect whoever answers.
/healthz{
"status": "ok",
"directors": 1,
"sessions": 3,
"version": "1.4.2",
"serverTime": "2026-07-06T15:04:05Z",
"directorId": "d-3f6a...",
"machineName": "MY-PC"
}List sessions
/sessions?includeExited=true to include exited ones.Each session object carries what the card shows and more - useful fields include sessionId, name, number, repoPath, agent, activityState, statusColor, lastStatusReason, needsYouSince, idleSeconds, and createdAt. GET /sessions/{id} fetches one, and PATCH /sessions/{id} with { "name": "..." } renames it.
Create a session
/sessions| Parameter | Type | Required | Description |
|---|---|---|---|
repoPath | string | Required | Working folder for the session. Must exist. Use forward slashes, e.g. "D:/repos/my-project". |
agent | string | Optional | Which agent to run. Defaults to "ClaudeCode"; "Pi" is the other verified driver. "RawCli" runs any command-line tool. |
name | string | Optional | Display name for the card. Composed automatically when omitted. |
purpose | string | Optional | Short note on what the session is for; used to compose the name when name is omitted. |
prePrompt | string | Optional | A first prompt sent automatically once the agent is ready - the way to launch a task unattended. |
prePromptWaitMs | number | Optional | How long to wait for the agent to become ready before sending prePrompt. Default 30000. |
args | string | Optional | Extra command-line arguments for the agent. Defaults per agent when omitted. |
command | string | Optional | The executable to run. Required when agent is "RawCli". |
commandArgs | string | Optional | Arguments for the RawCli command. |
resumeSessionId | string | Optional | Resume a previous Claude Code conversation instead of starting fresh. |
'{
"repoPath": "D:/repos/my-project",
"agent": "ClaudeCode",
"name": "nightly-refactor",
"prePrompt": "Run the test suite and fix any failures you find."
}' | Out-File -Encoding ascii new-session.json
curl.exe -s -X POST http://127.0.0.1:7879/sessions `
-H "Content-Type: application/json" `
--data-binary "@new-session.json"--data-binary. Shells - especially Git Bash on Windows - mangle backslashes and quotes in inline JSON, and a mangled body comes back as a bare 400 with no error message. Forward slashes in repoPath avoid the backslash problem entirely.Send prompts and queue work
/sessions/{id}/prompt{ "text": "..." }. Returns whether it was accepted and the session's activity state; 409 if the session has exited./sessions/{id}/queueGET the same path lists the queue; DELETE /sessions/{id}/queue/{itemId} removes one item, and DELETE /sessions/{id}/queue clears it.Interrupt and close
/sessions/{id}/interrupt/sessions/{id}Fleet calls through the Gateway
The Gateway (port 7878) aggregates every Director on the machine and relays to them - that is what the Cockpit and your phone talk to, and its routes require the machine's Gateway token as a bearer token. Two relays worth knowing: GET /directors lists the registered Directors with their machineName and controlEndpoint, and POST /directors/{id}/sessions creates a session on a specific Director through the Gateway. For scheduling work rather than scripting it, use the built-in cron, which drives this same API under the hood.