{"openapi":"3.1.0","info":{"title":"POST /api/v1/credit/cycles/assess-late","version":"1.0.0","description":"Flag and charge past-due cycles"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/cycles/assess-late":{"post":{"tags":["credit"],"summary":"Flag and charge past-due cycles","description":"Flags past-due cycles and charges them under each program's configured late rule — rate basis, grace period, day count, compounding, and cap. A program with no late rule still gets the status flag but is not charged, since the rate basis would have to be invented. Idempotent per cycle per day, so re-running the sweep never double-charges. Pass `dry_run` to preview.","operationId":"assess_late_cycles_api_v1_credit_cycles_assess_late_post","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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LateAssessmentRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_LateAssessmentResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"detail":"Invalid request parameters"}}}},"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"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LateAssessmentItem":{"properties":{"cycle_id":{"type":"string","title":"Cycle Id"},"credit_line_id":{"type":"string","title":"Credit Line Id"},"days_past_due":{"type":"integer","title":"Days Past Due"},"days_charged":{"type":"integer","title":"Days Charged","description":"Days actually charged, after any grace period."},"interest_cents":{"type":"integer","title":"Interest Cents"},"fee_cents":{"type":"integer","title":"Fee Cents"},"total_cents":{"type":"integer","title":"Total Cents"},"capped":{"type":"boolean","title":"Capped","description":"True if a cap reduced the assessment.","default":false}},"type":"object","required":["cycle_id","credit_line_id","days_past_due","days_charged","interest_cents","fee_cents","total_cents"],"title":"LateAssessmentItem","description":"What one delinquent cycle was assessed."},"LateAssessmentRequest":{"properties":{"credit_line_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Credit Line Id","description":"Limit to one line. Omit to sweep the business."},"as_of":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"As Of","description":"Treat this as today. Defaults to the current date."},"dry_run":{"type":"boolean","title":"Dry Run","description":"Compute and report without charging.","default":false}},"additionalProperties":false,"type":"object","title":"LateAssessmentRequest","description":"Run the late sweep under each program's configured rules."},"LateAssessmentResponse":{"properties":{"as_of":{"type":"string","format":"date","title":"As Of"},"marked_late":{"type":"integer","title":"Marked Late"},"charged":{"type":"integer","title":"Charged"},"skipped_no_late_rule":{"type":"integer","title":"Skipped No Late Rule"},"total_charged_cents":{"type":"integer","title":"Total Charged Cents"},"dry_run":{"type":"boolean","title":"Dry Run"},"assessments":{"items":{"$ref":"#/components/schemas/LateAssessmentItem"},"type":"array","title":"Assessments"}},"type":"object","required":["as_of","marked_late","charged","skipped_no_late_rule","total_charged_cents","dry_run"],"title":"LateAssessmentResponse","description":"Result of a late sweep.\n\n`skipped_no_late_rule` counts cycles flagged late but not charged\nbecause their program has no late rule configured — being past due is\na calendar fact, while charging for it is a commercial position."},"SuccessEnvelope_LateAssessmentResponse_":{"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/LateAssessmentResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[LateAssessmentResponse]"},"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":[]}]}