{"openapi":"3.1.0","info":{"title":"POST /api/v1/accounting-periods/{period_id}/close-readiness","version":"1.0.0","description":"AI close readiness check"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/accounting-periods/{period_id}/close-readiness":{"post":{"tags":["accounting-periods"],"summary":"AI close readiness check","description":"Check period close readiness with AI-enhanced analysis.","operationId":"check_close_readiness_api_v1_accounting_periods__period_id__close_readiness_post","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":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseReadinessResponse"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"example":{"detail":"Not authenticated"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"detail":"Not enough permissions"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"detail":"Resource not found"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CloseReadinessItem":{"properties":{"check":{"type":"string","title":"Check","description":"Name of the readiness check"},"status":{"type":"string","title":"Status","description":"pass, warning, or fail"},"detail":{"type":"string","title":"Detail","description":"Explanation"},"count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Count","description":"Number of items flagged"}},"type":"object","required":["check","status","detail"],"title":"CloseReadinessItem"},"CloseReadinessResponse":{"properties":{"score":{"type":"number","maximum":100.0,"minimum":0.0,"title":"Score","description":"Overall readiness score 0-100"},"items":{"items":{"$ref":"#/components/schemas/CloseReadinessItem"},"type":"array","title":"Items"},"summary":{"$ref":"#/components/schemas/CloseReadinessSummary","description":"Period-scoped transaction counts to power dashboards without extra fetches"}},"type":"object","required":["score"],"title":"CloseReadinessResponse"},"CloseReadinessSummary":{"properties":{"transaction_count":{"type":"integer","minimum":0.0,"title":"Transaction Count","description":"Total non-deleted transactions in the period","default":0},"unreviewed_count":{"type":"integer","minimum":0.0,"title":"Unreviewed Count","description":"Transactions in the period that are still unreviewed","default":0},"uncategorized_count":{"type":"integer","minimum":0.0,"title":"Uncategorized Count","description":"Transactions in the period that are still uncategorized","default":0}},"type":"object","title":"CloseReadinessSummary","description":"Period-scoped totals computed alongside the readiness checks."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}