{"openapi":"3.1.0","info":{"title":"POST /api/v1/credit/programs","version":"1.0.0","description":"Create a lending program"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/programs":{"post":{"tags":["credit"],"summary":"Create a lending program","description":"Stand up a partner lending program. The program carries the parameter envelope, the policy positions, statement branding, and the card-issuing configuration, so onboarding a second partner is a row rather than a build.","operationId":"create_program_api_v1_credit_programs_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/CreditProgramCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CreditProgramResponse_"}}}},"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":{"CreditProgramCreateRequest":{"properties":{"slug":{"type":"string","maxLength":64,"title":"Slug","description":"Stable partner key, e.g. \"tie\"."},"display_name":{"type":"string","maxLength":255,"title":"Display Name"},"status":{"$ref":"#/components/schemas/ProgramStatusEnum","default":"draft"},"limit_min_cents":{"type":"integer","minimum":0.0,"title":"Limit Min Cents","default":1000000},"limit_max_cents":{"type":"integer","minimum":0.0,"title":"Limit Max Cents","default":100000000},"allowed_term_days":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Allowed Term Days","description":"Selectable payback terms. Defaults to [30, 60, 90]."},"default_rate_bps":{"type":"integer","maximum":10000.0,"minimum":0.0,"title":"Default Rate Bps","default":1800},"default_disbursement_fee_bps":{"type":"integer","maximum":10000.0,"minimum":0.0,"title":"Default Disbursement Fee Bps","default":100},"max_float_days":{"type":"integer","maximum":365.0,"minimum":0.0,"title":"Max Float Days","default":60},"statement_balance_mode":{"type":"string","enum":["cumulative","cycle_scoped"],"title":"Statement Balance Mode","default":"cumulative"},"allocation_scope":{"type":"string","enum":["per_cycle","across_line"],"title":"Allocation Scope","default":"per_cycle"},"cycle_boundary_basis":{"type":"string","enum":["issuer_clearing_date","merchant_local","utc"],"title":"Cycle Boundary Basis","default":"issuer_clearing_date"},"cycle_close_rule":{"type":"string","enum":["calendar_month_end","anchor_day","operational_trigger"],"title":"Cycle Close Rule","default":"calendar_month_end"},"cycle_anchor_day":{"anyOf":[{"type":"integer","maximum":31.0,"minimum":1.0},{"type":"null"}],"title":"Cycle Anchor Day"},"excess_credit_disposition":{"type":"string","enum":["carry_forward","refund_merchant"],"title":"Excess Credit Disposition","default":"carry_forward"},"late_terms":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Late Terms","description":"Late fee / late interest rule body. Leave null while undecided — the late path raises rather than guessing a rate (§2.3)."},"early_payoff_terms":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Early Payoff Terms","description":"interest_rebate (pro_rata | fully_earned) and fee_rebate (none | pro_rata). Null while undecided (§2.5)."},"underwriting_criteria":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Underwriting Criteria","description":"Partner-owned rule set: key, label, threshold, comparator, source. Null while undecided (§2.7)."},"legal_lending_entity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Lending Entity"},"statement_branding":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Statement Branding"},"event_delivery_mode":{"$ref":"#/components/schemas/EventDeliveryMode","default":"polling"},"issuing_enabled":{"type":"boolean","title":"Issuing Enabled","default":false},"ramp_spend_program_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ramp Spend Program Id"},"allowed_mcc_codes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Allowed Mcc Codes"},"blocked_mcc_codes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Blocked Mcc Codes"}},"additionalProperties":false,"type":"object","required":["slug","display_name"],"title":"CreditProgramCreateRequest","description":"Stand up a partner lending program.\n\nEverything optional falls back to the FRD's Tie-shaped defaults, so a\nprogram that matches Tie is a slug and a display name."},"CreditProgramResponse":{"properties":{"id":{"type":"string","title":"Id"},"slug":{"type":"string","title":"Slug"},"display_name":{"type":"string","title":"Display Name"},"status":{"$ref":"#/components/schemas/ProgramStatusEnum"},"limit_min_cents":{"type":"integer","title":"Limit Min Cents"},"limit_max_cents":{"type":"integer","title":"Limit Max Cents"},"allowed_term_days":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Allowed Term Days"},"default_rate_bps":{"type":"integer","title":"Default Rate Bps"},"default_disbursement_fee_bps":{"type":"integer","title":"Default Disbursement Fee Bps"},"max_float_days":{"type":"integer","title":"Max Float Days"},"legal_lending_entity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Lending Entity"},"statement_branding":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Statement Branding"},"event_delivery_mode":{"$ref":"#/components/schemas/EventDeliveryMode"},"issuing_enabled":{"type":"boolean","title":"Issuing Enabled"},"issuing_provider":{"type":"string","title":"Issuing Provider"},"ramp_spend_program_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ramp Spend Program Id"},"allowed_mcc_codes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Allowed Mcc Codes"},"blocked_mcc_codes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Blocked Mcc Codes"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"policy":{"anyOf":[{"$ref":"#/components/schemas/PolicyDecisionStatus"},{"type":"null"}]}},"type":"object","required":["id","slug","display_name","status","limit_min_cents","limit_max_cents","default_rate_bps","default_disbursement_fee_bps","max_float_days","event_delivery_mode","issuing_enabled","issuing_provider"],"title":"CreditProgramResponse","description":"A partner lending program."},"EventDeliveryMode":{"type":"string","enum":["webhook","polling","both"],"title":"EventDeliveryMode","description":"How a partner learns that something happened.\n\nThe FRD lists this twice as an open joint decision (§13.3 items 2 and\n6). Making it per-program means the decision never blocks the build:\na partner that wants webhooks registers an endpoint, one that wants to\npoll simply does not."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"PolicyDecisionStatus":{"properties":{"statement_balance_mode":{"type":"string","title":"Statement Balance Mode"},"allocation_scope":{"type":"string","title":"Allocation Scope"},"cycle_boundary_basis":{"type":"string","title":"Cycle Boundary Basis"},"cycle_close_rule":{"type":"string","title":"Cycle Close Rule"},"excess_credit_disposition":{"type":"string","title":"Excess Credit Disposition"},"late_terms_decided":{"type":"boolean","title":"Late Terms Decided"},"early_payoff_decided":{"type":"boolean","title":"Early Payoff Decided"},"underwriting_criteria_decided":{"type":"boolean","title":"Underwriting Criteria Decided"},"undecided":{"items":{"type":"string"},"type":"array","title":"Undecided","description":"Rules with no answer yet. Paths needing them raise."}},"type":"object","required":["statement_balance_mode","allocation_scope","cycle_boundary_basis","cycle_close_rule","excess_credit_disposition","late_terms_decided","early_payoff_decided","underwriting_criteria_decided"],"title":"PolicyDecisionStatus","description":"Which rules this program is running on, and which are still open.\n\nSurfaced deliberately: a partner integrating against the API should be\nable to see that, say, the late-fee path will raise, rather than\ndiscovering it when a cycle first goes past due."},"ProgramStatusEnum":{"type":"string","enum":["draft","active","paused","retired"],"title":"ProgramStatusEnum","description":"Whether a program may open new lines."},"SuccessEnvelope_CreditProgramResponse_":{"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/CreditProgramResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CreditProgramResponse]"},"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":[]}]}