{"openapi":"3.1.0","info":{"title":"Clockwork API","version":"1.0.0","description":"Execution coordination API. Workflows are dependency graphs; Clockwork owns scheduling, the critical path, and handoffs between human / AI / vendor executors."},"servers":[{"url":"https://app.clockwork-co.com/api/v1"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","description":"A ck_live_… API key."}},"schemas":{"Error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code"]}}},"paths":{"/workflows":{"get":{"summary":"List workflows","operationId":"listWorkflows","responses":{"200":{"description":"OK"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a workflow (optionally instantiate a template)","operationId":"createWorkflow","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"anchorDate":{"type":"string","format":"date-time"},"tags":{"type":"array","items":{"type":"string"}},"templateId":{"type":"string","format":"uuid"}}}}}},"responses":{"201":{"description":"Created"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/workflows/{id}":{"get":{"summary":"Get a workflow by id","operationId":"getWorkflow","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"summary":"Delete a workflow and all of its tasks","operationId":"deleteWorkflow","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/workflows/{id}/schedule":{"get":{"summary":"Query workflow schedule (tasks, CPM state, conflicts)","operationId":"querySchedule","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks":{"get":{"summary":"List tasks","operationId":"listTasks","parameters":[{"name":"workflowId","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string","enum":["pending","active","done","blocked"]}}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create a task","operationId":"createTask","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","durationMinutes","earliestStart"],"properties":{"name":{"type":"string"},"durationMinutes":{"type":"integer"},"earliestStart":{"type":"string","format":"date-time"},"deadline":{"type":"string","format":"date-time"},"assigneePlatformUserId":{"type":"string","format":"uuid"},"templateInstanceId":{"type":"string","format":"uuid"}}}}}},"responses":{"201":{"description":"Created"},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks/{id}":{"get":{"summary":"Get a task by id","operationId":"getTask","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Partially update a task","operationId":"updateTask","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"durationMinutes":{"type":"integer"},"status":{"type":"string","enum":["pending","active","done","blocked","cancelled"]},"earliestStart":{"type":"string","format":"date-time"},"deadline":{"type":"string","format":"date-time","nullable":true},"bufferAfterMinutes":{"type":"integer"},"tags":{"type":"array","items":{"type":"string"}},"priority":{"type":"string","enum":["high","medium","low"],"nullable":true}}}}}},"responses":{"200":{"description":"OK"},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks/{id}/assign":{"post":{"summary":"Reassign a task to another executor","operationId":"assignTask","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["assigneePlatformUserId"],"properties":{"assigneePlatformUserId":{"type":"string","format":"uuid"}}}}}},"responses":{"200":{"description":"OK"},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks/{id}/complete":{"post":{"summary":"Complete a task (activates dependents)","operationId":"completeTask","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks/{id}/delay":{"post":{"summary":"Delay a task (slip propagates downstream)","operationId":"delayTask","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"delayMinutes":{"type":"integer"},"newEarliestStart":{"type":"string","format":"date-time"},"reason":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/dependencies":{"post":{"summary":"Create a dependency between two tasks","operationId":"createDependency","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["fromTaskId","toTaskId"],"properties":{"fromTaskId":{"type":"string","format":"uuid"},"toTaskId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["finish_to_start","start_to_start","finish_to_finish","start_to_finish"]},"lagMinutes":{"type":"integer"}}}}}},"responses":{"201":{"description":"Created"},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates":{"get":{"summary":"List templates","operationId":"listTemplates","responses":{"200":{"description":"OK"}}}},"/events/subscriptions":{"get":{"summary":"List event subscriptions","operationId":"listSubscriptions","responses":{"200":{"description":"OK"}}},"post":{"summary":"Subscribe to push events","operationId":"createSubscription","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url","events"],"properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","enum":["task_ready","task_completed","task_delayed","conflict_detected","workflow_completed","*"]}}}}}}},"responses":{"201":{"description":"Created"}}}},"/events/subscriptions/{id}":{"delete":{"summary":"Deactivate an event subscription","operationId":"deleteSubscription","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK"},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/billing/usage":{"get":{"summary":"Get API usage summary for the caller","operationId":"getBillingUsage","responses":{"200":{"description":"OK"}}}},"/mcp/execute":{"post":{"summary":"Dispatch an MCP tool call server-side","operationId":"mcpExecute","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["tool","input"],"properties":{"tool":{"type":"string","enum":["create_workflow","instantiate_template","create_task","create_dependency","assign_task","complete_task","delay_task","query_schedule","delete_workflow","list_workflows","list_tasks","list_templates"]},"input":{"type":"object"}}}}}},"responses":{"200":{"description":"OK"},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/mcp/stream":{"get":{"summary":"Server-Sent Events stream of workflow change events","operationId":"mcpStream","responses":{"200":{"description":"SSE stream","content":{"text/event-stream":{"schema":{"type":"string"}}}}}}},"/mcp/callback":{"post":{"summary":"Callback from an AI agent after completing or failing a task","operationId":"mcpCallback","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["taskId","status"],"properties":{"taskId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["completed","failed"]},"result":{}}}}}},"responses":{"200":{"description":"OK"},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks":{"get":{"summary":"List webhook registrations","operationId":"listWebhooks","responses":{"200":{"description":"OK"}}},"post":{"summary":"Register a webhook","operationId":"createWebhook","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url","events"],"properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","enum":["task_ready","task_completed","task_delayed","conflict_detected","workflow_completed","*"]}}}}}}},"responses":{"201":{"description":"Created"}}}},"/webhooks/{id}":{"delete":{"summary":"Delete a webhook registration","operationId":"deleteWebhook","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}