{"openapi":"3.1.0","info":{"title":"GET /api/v1/accounting-periods/close-commitment","version":"1.0.0","description":"Close commitment: deadline and record"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/accounting-periods/close-commitment":{"get":{"tags":["accounting-periods"],"summary":"Close commitment: deadline and record","description":"The business's close commitment ('each month closed by business day N', close_target_business_day in Settings > Automation): the deadline of the month that just ended with the business days left, its readiness score and top blockers, and the last 12 closed periods with the days each took, the on-time rate, the median and the current on-time streak. Business days are weekdays; no holiday calendar.","operationId":"get_close_commitment","parameters":[{"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_CloseCommitmentResponse_"}}}},"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"}}}},"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_close_commitment_api_v1_accounting_periods_close_commitment_get"}}},"components":{"schemas":{"CloseCommitmentCurrent":{"properties":{"period_id":{"type":"string","title":"Period Id"},"period_start":{"type":"string","title":"Period Start"},"period_end":{"type":"string","title":"Period End"},"period_label":{"type":"string","title":"Period Label"},"status":{"type":"string","title":"Status"},"deadline":{"type":"string","title":"Deadline","description":"YYYY-MM-DD the period must be closed by"},"business_days_remaining":{"type":"integer","title":"Business Days Remaining","description":"Weekdays left until the deadline; 0 on the day, negative after"},"score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Score"},"color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color"},"blockers":{"items":{"$ref":"#/components/schemas/CloseScoreBlocker"},"type":"array","title":"Blockers"},"closed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Closed At"},"on_time":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"On Time"},"business_days_to_close":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Business Days To Close"}},"additionalProperties":true,"type":"object","required":["period_id","period_start","period_end","period_label","status","deadline","business_days_remaining"],"title":"CloseCommitmentCurrent","description":"The month that just ended, against its deadline."},"CloseCommitmentHistoryItem":{"properties":{"period_id":{"type":"string","title":"Period Id"},"period_start":{"type":"string","title":"Period Start"},"period_end":{"type":"string","title":"Period End"},"period_label":{"type":"string","title":"Period Label"},"closed_at":{"type":"string","title":"Closed At"},"deadline":{"type":"string","title":"Deadline"},"business_days_to_close":{"type":"integer","title":"Business Days To Close"},"on_time":{"type":"boolean","title":"On Time"}},"additionalProperties":true,"type":"object","required":["period_id","period_start","period_end","period_label","closed_at","deadline","business_days_to_close","on_time"],"title":"CloseCommitmentHistoryItem","description":"One closed period against the commitment."},"CloseCommitmentResponse":{"properties":{"business_id":{"type":"string","title":"Business Id"},"as_of":{"type":"string","title":"As Of"},"target_business_day":{"type":"integer","title":"Target Business Day"},"current":{"anyOf":[{"$ref":"#/components/schemas/CloseCommitmentCurrent"},{"type":"null"}]},"history":{"items":{"$ref":"#/components/schemas/CloseCommitmentHistoryItem"},"type":"array","title":"History"},"closed_periods":{"type":"integer","title":"Closed Periods","default":0},"on_time_count":{"type":"integer","title":"On Time Count","default":0},"on_time_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"On Time Rate","description":"Share of the last 12 closes that met the target"},"median_business_days":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Median Business Days"},"current_streak":{"type":"integer","title":"Current Streak","default":0}},"additionalProperties":true,"type":"object","required":["business_id","as_of","target_business_day"],"title":"CloseCommitmentResponse","description":"Response for ``get_close_commitment``."},"CloseScoreBlocker":{"properties":{"category":{"type":"string","title":"Category"},"severity":{"type":"string","title":"Severity"},"label":{"type":"string","title":"Label"},"count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Count"}},"additionalProperties":true,"type":"object","required":["category","severity","label"],"title":"CloseScoreBlocker","description":"Item blocking the period close score from reaching 100."},"SuccessEnvelope_CloseCommitmentResponse_":{"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/CloseCommitmentResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CloseCommitmentResponse]"},"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":[]}]}