{"openapi":"3.1.0","info":{"title":"POST /api/v1/credit/programs/{program_id}/connection-check","version":"1.0.0","description":"Run the card connection check with the active test"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/programs/{program_id}/connection-check":{"post":{"tags":["credit"],"summary":"Run the card connection check with the active test","description":"The same steps, plus the active test. Each active partner webhook endpoint is sent a signed test event and the HTTP status it answered is reported. On a sandbox whose program issues from the mock issuer a dummy line, card and $1.00 purchase are made, the purchase is voided, and the line is deleted again (`test_card`); on a live business `test_card` is skipped and no card is made. Needs write access: a `credit:read` token is refused. Steps, in order: `ramp.connected`, `ramp.card_access`, `ramp.webhook`, `program.issuing_setup`, `partner.webhook_endpoint`, `test_card`. Each has a `status` (pass, fail, warn, skipped), a plain `summary`, optional `items` and, when it does not pass, a `fix`. `ok` is true when no step fails. A step that needs an earlier one is skipped until that is fixed.","operationId":"credit_connection_check_run","parameters":[{"name":"program_id","in":"path","required":true,"schema":{"type":"string","description":"The program to check.","title":"Program Id"},"description":"The program to check."},{"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/SuccessEnvelope_ConnectionCheckReport_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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":"credit_connection_check_run_api_v1_credit_programs__program_id__connection_check_post"}}},"components":{"schemas":{"ConnectionCheckFix":{"properties":{"label":{"type":"string","title":"Label","description":"A short instruction, for a button or a line."},"kind":{"type":"string","enum":["console","action","ramp","api"],"title":"Kind","description":"console: a screen in the DayZero console (`path`). action: a DayZero call that repairs it (`action`). ramp: something to change in Ramp itself (`scopes` names the permissions). api: a call for the partner to make (`path`)."},"path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path","description":"The console path, or the API call."},"action":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action","description":"`repair_ramp_webhook`: `POST /ramp/webhook/repair`."},"scopes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Scopes","description":"Ramp permissions to turn on (`kind: ramp`), as Ramp names them."}},"type":"object","required":["label","kind"],"title":"ConnectionCheckFix","description":"What to do about a step that does not pass."},"ConnectionCheckItem":{"properties":{"key":{"type":"string","title":"Key","description":"Stable identifier within the step."},"label":{"type":"string","title":"Label","description":"What was looked at, in plain words."},"status":{"type":"string","enum":["pass","fail","warn","skipped"],"title":"Status","description":"pass, fail, warn or skipped."},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail","description":"More on what was found."}},"type":"object","required":["key","label","status"],"title":"ConnectionCheckItem","description":"One thing a step looked at."},"ConnectionCheckReport":{"properties":{"program_id":{"type":"string","title":"Program Id","description":"The program checked."},"environment":{"type":"string","enum":["sandbox","live"],"title":"Environment","description":"The book the check ran on."},"issuing_provider":{"type":"string","title":"Issuing Provider","description":"Who issues the program's cards: ramp, mock, brex, ..."},"ok":{"type":"boolean","title":"Ok","description":"True when no step fails."},"ran_at":{"type":"string","format":"date-time","title":"Ran At","description":"When the check ran (UTC)."},"steps":{"items":{"$ref":"#/components/schemas/ConnectionCheckStep"},"type":"array","title":"Steps","description":"Every step, in order."}},"type":"object","required":["program_id","environment","issuing_provider","ok","ran_at"],"title":"ConnectionCheckReport","description":"A program's card connection check."},"ConnectionCheckStep":{"properties":{"key":{"type":"string","title":"Key","description":"Stable identifier: `ramp.connected`, `ramp.card_access`, `ramp.webhook`, `program.issuing_setup`, `partner.webhook_endpoint` or `test_card`."},"title":{"type":"string","title":"Title","description":"The step's name, for a heading."},"status":{"type":"string","enum":["pass","fail","warn","skipped"],"title":"Status","description":"pass; fail (card setup is broken here); warn (worth a look, or Ramp could not be reached); skipped (not applicable here, not run, or an earlier step has to be finished first)."},"summary":{"type":"string","title":"Summary","description":"One or two plain sentences on what was found."},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail","description":"More on what was found."},"fix":{"anyOf":[{"$ref":"#/components/schemas/ConnectionCheckFix"},{"type":"null"}],"description":"What to do. Null when the step passes."},"items":{"items":{"$ref":"#/components/schemas/ConnectionCheckItem"},"type":"array","title":"Items","description":"What the step looked at, one entry each. May be empty."}},"type":"object","required":["key","title","status","summary"],"title":"ConnectionCheckStep","description":"One step of the check and what it found."},"SuccessEnvelope_ConnectionCheckReport_":{"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/ConnectionCheckReport"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ConnectionCheckReport]"},"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":[]}]}