{"openapi":"3.1.0","info":{"title":"GET /api/v1/credit/sandbox/jobs/{job_id}","version":"1.0.0","description":"A sandbox job"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/credit/sandbox/jobs/{job_id}":{"get":{"tags":["credit"],"summary":"A sandbox job","description":"Its status (`queued`, `running`, `succeeded`, `failed`), the request, and the result when it succeeded or the error when it failed. `stale` is true for a job still queued or running past its one-hour limit: it will not finish, and nothing was written.","operationId":"credit_get_sandbox_job","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job 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":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SandboxJobResponse_"}}}},"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_get_sandbox_job_api_v1_credit_sandbox_jobs__job_id__get"}}},"components":{"schemas":{"PortfolioScenarioLine":{"properties":{"credit_line_id":{"type":"string","title":"Credit Line Id","description":"The line."},"external_line_id":{"type":"string","title":"External Line Id","description":"The line's id, from the seed."},"profile":{"type":"string","title":"Profile","description":"How the merchant behaves: on_time, late, partial, bounced, disputed, notify, suspend_cards, suspend_line or written_off."},"credit_limit_cents":{"type":"integer","title":"Credit Limit Cents","description":"The line's credit limit."},"delinquency_stage":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Delinquency Stage","description":"The collections stage at `as_of`, if any."},"outstanding_cents":{"type":"integer","title":"Outstanding Cents","description":"Total balance at `as_of`."}},"type":"object","required":["credit_line_id","external_line_id","profile","credit_limit_cents","outstanding_cents"],"title":"PortfolioScenarioLine"},"PortfolioScenarioResponse":{"properties":{"program_id":{"type":"string","title":"Program Id","description":"The program the book is on."},"program_created":{"type":"boolean","title":"Program Created","description":"True when the program was created for this seed."},"seed":{"type":"integer","title":"Seed","description":"The seed."},"start":{"type":"string","format":"date","title":"Start","description":"The first day of the history."},"as_of":{"type":"string","format":"date","title":"As Of","description":"The last day of the history."},"lines_opened":{"type":"integer","title":"Lines Opened","description":"Credit lines opened."},"cards_issued":{"type":"integer","title":"Cards Issued","description":"DayZero-managed cards issued, one per line, when the program issues on the mock issuer (0 on a program that does not).","default":0},"partner_cards_registered":{"type":"integer","title":"Partner Cards Registered","description":"Partner-managed cards registered on some lines as well.","default":0},"settlements":{"type":"integer","title":"Settlements","description":"Card transactions settled."},"refunds":{"type":"integer","title":"Refunds","description":"Of which refunds."},"payments":{"type":"integer","title":"Payments","description":"Payments recorded."},"payments_reversed":{"type":"integer","title":"Payments Reversed","description":"Payments returned (bounced)."},"disputes_opened":{"type":"integer","title":"Disputes Opened","description":"Disputes opened."},"loans_written_off":{"type":"integer","title":"Loans Written Off","description":"Loans written off."},"statements_closed":{"type":"integer","title":"Statements Closed","description":"Statement periods closed."},"collections_stages":{"additionalProperties":{"type":"integer"},"type":"object","title":"Collections Stages","description":"Lines in each collections stage at `as_of`."},"loan_tape_digest":{"type":"string","title":"Loan Tape Digest","description":"SHA-256 of the loan tape at `as_of` without its generated ids. The same seed, merchants, months and `as_of` give the same digest."},"elapsed_ms":{"type":"integer","title":"Elapsed Ms","description":"How long the generation took."},"lines":{"items":{"$ref":"#/components/schemas/PortfolioScenarioLine"},"type":"array","title":"Lines","description":"Every line, in the order opened."}},"type":"object","required":["program_id","program_created","seed","start","as_of","lines_opened","settlements","refunds","payments","payments_reversed","disputes_opened","loans_written_off","statements_closed","loan_tape_digest","elapsed_ms"],"title":"PortfolioScenarioResponse"},"SandboxJobResponse":{"properties":{"id":{"type":"string","title":"Id","description":"The job."},"kind":{"type":"string","const":"portfolio","title":"Kind","description":"What the job does."},"status":{"type":"string","enum":["queued","running","succeeded","failed"],"title":"Status","description":"Poll until `succeeded` or `failed`, or until `stale`."},"stale":{"type":"boolean","title":"Stale","description":"Still `queued` or `running` an hour after it started (or was queued, if it never started): past the job's own time limit, so its worker has stopped and it will not finish. Nothing was written. Stop polling; asking for the same seed again records this job as `failed` and queues a new one.","default":false},"request":{"additionalProperties":true,"type":"object","title":"Request","description":"What was asked for, with `as_of` resolved to a date."},"result":{"anyOf":[{"$ref":"#/components/schemas/PortfolioScenarioResponse"},{"type":"null"}],"description":"The book that was generated, once `succeeded`."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Why it failed (an error code and message when it has one)."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the job was queued (UTC)."},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At","description":"When it started running (UTC)."},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At","description":"When it succeeded or failed (UTC)."},"created":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Created","description":"On the POST: true when this request queued the job, false when it returned the seed's job that was already queued or running. Absent when the job is read back."}},"type":"object","required":["id","kind","status","request","created_at"],"title":"SandboxJobResponse"},"SuccessEnvelope_SandboxJobResponse_":{"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/SandboxJobResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SandboxJobResponse]"},"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":[]}]}