{"openapi":"3.1.0","info":{"title":"GET /api/v1/accounting-periods/{period_id}/command-center","version":"1.0.0","description":"Monthly close command center for a period"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/accounting-periods/{period_id}/command-center":{"get":{"tags":["accounting-periods"],"summary":"Monthly close command center for a period","description":"SOP-aligned command center returning live publication-gate blockers and warnings, the business's active SOP close runboard, and a feed of what changed in the period (adjusting JEs, proposed changes, reconciliations, acks and sign-offs).","operationId":"get_period_command_center","parameters":[{"name":"period_id","in":"path","required":true,"schema":{"type":"string","title":"Period Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CloseCommandCenterResponse_"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"get_period_command_center_api_v1_accounting_periods__period_id__command_center_get"}}},"components":{"schemas":{"CloseCommandCenterResponse":{"properties":{"period_id":{"type":"string","title":"Period Id"},"period_start":{"type":"string","format":"date","title":"Period Start"},"period_end":{"type":"string","format":"date","title":"Period End"},"period_label":{"type":"string","title":"Period Label"},"period_status":{"type":"string","title":"Period Status"},"auto_create_periods":{"type":"boolean","title":"Auto Create Periods","default":true},"gate_passed":{"type":"boolean","title":"Gate Passed","default":false},"blocking_count":{"type":"integer","title":"Blocking Count","default":0},"warning_count":{"type":"integer","title":"Warning Count","default":0},"gate_checks":{"items":{"$ref":"#/components/schemas/CloseCommandGateCheck"},"type":"array","title":"Gate Checks"},"sop":{"$ref":"#/components/schemas/CloseCommandSopSummary"},"changes":{"$ref":"#/components/schemas/CloseCommandChangesSummary"}},"type":"object","required":["period_id","period_start","period_end","period_label","period_status"],"title":"CloseCommandCenterResponse","description":"SOP-aligned Monthly Close Command Center: what is outstanding and what changed."},"CloseCommandChangesSummary":{"properties":{"manual_je_count":{"type":"integer","title":"Manual Je Count","default":0},"manual_journal_entries":{"items":{"$ref":"#/components/schemas/CloseCommandJournalChange"},"type":"array","title":"Manual Journal Entries"},"pending_approval_count":{"type":"integer","title":"Pending Approval Count","default":0},"applied_changes_count":{"type":"integer","title":"Applied Changes Count","default":0},"recent_pending_changes":{"items":{"$ref":"#/components/schemas/CloseCommandPendingChange"},"type":"array","title":"Recent Pending Changes"},"reconciliations_completed":{"type":"integer","title":"Reconciliations Completed","default":0},"reconciliations_in_progress":{"type":"integer","title":"Reconciliations In Progress","default":0},"reconciliations":{"items":{"$ref":"#/components/schemas/CloseCommandReconciliationItem"},"type":"array","title":"Reconciliations"},"checklist_acks_count":{"type":"integer","title":"Checklist Acks Count","default":0},"sign_offs_count":{"type":"integer","title":"Sign Offs Count","default":0}},"type":"object","title":"CloseCommandChangesSummary","description":"What has been changed during this close period."},"CloseCommandGateCheck":{"properties":{"check":{"type":"string","title":"Check"},"title":{"type":"string","title":"Title"},"status":{"type":"string","enum":["pass","fail","warn","skipped"],"title":"Status"},"count":{"type":"integer","title":"Count","default":0},"detail":{"type":"string","title":"Detail","default":""},"fix":{"type":"string","title":"Fix","default":""},"action_href":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action Href"},"items":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Items"}},"type":"object","required":["check","title","status"],"title":"CloseCommandGateCheck","description":"One publication-gate check surfaced in the Monthly Close Command Center."},"CloseCommandJournalChange":{"properties":{"id":{"type":"string","title":"Id"},"entry_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entry Number"},"date":{"type":"string","format":"date","title":"Date"},"description":{"type":"string","title":"Description"},"source":{"type":"string","title":"Source"},"total_cents":{"type":"integer","title":"Total Cents","default":0},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["id","date","description","source"],"title":"CloseCommandJournalChange","description":"A manual/adjusting journal entry posted or dated in this close period."},"CloseCommandPendingChange":{"properties":{"id":{"type":"string","title":"Id"},"tool_name":{"type":"string","title":"Tool Name"},"summary":{"type":"string","title":"Summary"},"status":{"type":"string","title":"Status"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"reviewed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Reviewed At"}},"type":"object","required":["id","tool_name","summary","status"],"title":"CloseCommandPendingChange","description":"A proposed change (pending approval or recently applied) tied to the close."},"CloseCommandReconciliationItem":{"properties":{"id":{"type":"string","title":"Id"},"ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Id"},"ledger_name":{"type":"string","title":"Ledger Name"},"status":{"type":"string","title":"Status"},"statement_end_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Statement End Date"}},"type":"object","required":["id","ledger_name","status"],"title":"CloseCommandReconciliationItem","description":"Bank/card reconciliation status for this period."},"CloseCommandSopJob":{"properties":{"job_id":{"type":"string","title":"Job Id"},"title":{"type":"string","title":"Title"},"owner":{"type":"string","title":"Owner"},"level":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Level"},"when":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"When"},"due_business_day":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Due Business Day"},"done_when":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Done When"},"status":{"type":"string","title":"Status","default":"planned"},"overdue":{"type":"boolean","title":"Overdue","default":false},"done_when_result":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Done When Result"},"evidence_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Evidence Url"},"blocker":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Blocker"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"},"in_close_run":{"type":"boolean","title":"In Close Run","default":false}},"type":"object","required":["job_id","title","owner"],"title":"CloseCommandSopJob","description":"One SOP close job merged with its live close-run execution state."},"CloseCommandSopSummary":{"properties":{"has_custom_sop":{"type":"boolean","title":"Has Custom Sop","default":false},"sop_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sop Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"total_jobs":{"type":"integer","title":"Total Jobs","default":0},"done_jobs":{"type":"integer","title":"Done Jobs","default":0},"blocked_jobs":{"type":"integer","title":"Blocked Jobs","default":0},"overdue_jobs":{"type":"integer","title":"Overdue Jobs","default":0},"jobs":{"items":{"$ref":"#/components/schemas/CloseCommandSopJob"},"type":"array","title":"Jobs"}},"type":"object","title":"CloseCommandSopSummary","description":"Active close SOP metadata and job runboard for this period."},"SuccessEnvelope_CloseCommandCenterResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/CloseCommandCenterResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CloseCommandCenterResponse]"},"ErrorResponse":{"title":"ErrorResponse","type":"object","description":"Envelope returned by every non-2xx response. Branch on `code` (stable) rather than `message` (human-readable, may change).","required":["error","message","code"],"properties":{"error":{"type":"string","description":"Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`."},"message":{"type":"string","description":"Human-readable explanation, safe to show to end users."},"code":{"type":"string","description":"Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`)."},"request_id":{"type":"string","description":"Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied."},"errors":{"type":"object","additionalProperties":{"type":"string"},"description":"Field-level validation messages keyed by field name. Present on 400/422 validation failures only."}}}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}