{"openapi":"3.1.0","info":{"title":"Focus Keys API","version":"0.1.0","description":"Agent-controlled Screen Time. Same capabilities as the MCP tools."},"servers":[{"url":"https://focus.keelcroft.com/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"OAuth 2.1 access token or a personal API key (fk_...)"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"]}}},"paths":{"/me":{"get":{"operationId":"getMe","summary":"Account and subscription status","responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/status":{"get":{"operationId":"getStatus","summary":"Devices, group states, active blocks/passes, pending requests","responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/groups":{"get":{"operationId":"listGroups","summary":"App groups","responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/schedules":{"get":{"operationId":"listSchedules","summary":"Recurring blocks","responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"setSchedule","summary":"Create a recurring block","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["start","end"],"properties":{"group":{"type":"string"},"name":{"type":"string"},"days":{"type":"array","items":{"type":"string"}},"start":{"type":"string"},"end":{"type":"string"},"enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/schedules/{scheduleId}":{"put":{"operationId":"updateSchedule","summary":"Update a recurring block","parameters":[{"name":"scheduleId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteSchedule","summary":"Delete a recurring block","parameters":[{"name":"scheduleId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/blocks":{"post":{"operationId":"blockNow","summary":"Block a group now","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["minutes"],"properties":{"group":{"type":"string"},"minutes":{"type":"integer"},"reason":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/blocks/{blockId}/end":{"post":{"operationId":"endBlock","summary":"End a block early","parameters":[{"name":"blockId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/passes":{"post":{"operationId":"grantPass","summary":"Grant a pass (unsolicited or by pass_id)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"pass_id":{"type":"string"},"group":{"type":"string"},"minutes":{"type":"integer"},"note":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/passes/{passId}/deny":{"post":{"operationId":"denyPass","summary":"Deny a pass request","parameters":[{"name":"passId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/settings":{"put":{"operationId":"setSettings","summary":"Pass policy and settings","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pairing-codes":{"post":{"operationId":"createPairingCode","summary":"Create a phone pairing code","responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/history":{"get":{"operationId":"getHistory","summary":"Blocks, passes and pattern facts","parameters":[{"name":"days","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/alerts":{"get":{"operationId":"getRecentAlerts","summary":"Proactive events","parameters":[{"name":"since","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK"},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}