{"openapi":"3.1.0","info":{"title":"POST /api/v1/credit/underwriting/assessments","version":"1.0.0","description":"Request an underwriting assessment"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/underwriting/assessments":{"post":{"tags":["credit"],"summary":"Request an underwriting assessment","description":"Returns a pending assessment. Bank backfill, categorisation, and trailing-ratio history can take up to three days, so callers must not assume a synchronous answer — poll the get endpoint or subscribe to the completion event. We return evidence; the lending decision stays the partner's.","operationId":"request_underwriting_assessment_api_v1_credit_underwriting_assessments_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/UnderwritingAssessmentRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_UnderwritingAssessmentResponse_"}}}},"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"}}}},"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":{"AssessmentStatusEnum":{"type":"string","enum":["pending","completed","failed"],"title":"AssessmentStatusEnum","description":"Underwriting assessment lifecycle.\n\nPlaid backfill, categorisation, and trailing-ratio history can take up\nto three days (FRD §9.3), so an assessment is explicitly asynchronous."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SuccessEnvelope_UnderwritingAssessmentResponse_":{"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/UnderwritingAssessmentResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[UnderwritingAssessmentResponse]"},"UnderwritingAssessmentRequest":{"properties":{"credit_line_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Credit Line Id"},"external_application_id":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"External Application Id"},"program_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Program Id"},"criteria_override":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Criteria Override","description":"Evaluate against these instead of the program's set."}},"additionalProperties":false,"type":"object","title":"UnderwritingAssessmentRequest","description":"Request an assessment (§14, call 6; §9.3).\n\nAsynchronous by design: Plaid backfill, categorisation, and enough\nhistory for trailing ratios can take up to three days, so the caller\nmust not assume a synchronous answer."},"UnderwritingAssessmentResponse":{"properties":{"id":{"type":"string","title":"Id"},"credit_line_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Credit Line Id"},"external_application_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Application Id"},"status":{"$ref":"#/components/schemas/AssessmentStatusEnum"},"requested_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Requested At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"},"criteria":{"items":{"$ref":"#/components/schemas/UnderwritingCriterionResult"},"type":"array","title":"Criteria"},"financials":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Financials"},"failure_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Failure Reason"},"decision":{"type":"null","title":"Decision","description":"Always null. The lending decision is the partner's (§9.3)."}},"type":"object","required":["id","status"],"title":"UnderwritingAssessmentResponse","description":"Assessment evidence — criteria, values, thresholds, and sources."},"UnderwritingCriterionResult":{"properties":{"key":{"type":"string","title":"Key"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Value"},"threshold":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Threshold"},"comparator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comparator"},"passed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Passed","description":"Null means the figure could not be measured yet — distinct from a failure, and calling for a different action."},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit"},"weight":{"type":"integer","title":"Weight","default":1},"required":{"type":"boolean","title":"Required","default":false},"evidence":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Evidence"}},"type":"object","required":["key"],"title":"UnderwritingCriterionResult","description":"One criterion, its value, its threshold, and where the figure came from.\n\nWe supply the assessment, not the verdict: thresholds and the lending\ndecision remain the partner's (§9.3)."},"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":[]}]}