# POST /api/v1/credit/sandbox/partner-export

> Seed the sandbox from a partner export

- **Tag:** credit
- **Operation ID:** `credit_seed_partner_export`

## Description

Sandbox only. `multipart/form-data` with a `transactions` file and optional `merchants` and `payments` files (DynamoDB export or scan output, a JSON list, or a CSV), or a `pull_id` from `POST /credit/sandbox/partner-pulls` in their place (both, or neither, is `CREDIT_684`; `roles` says which table of the pull is which when it could not be worked out), the `program_id` to seed, and an optional `mapping` (JSON naming the partner's fields, or `auto`). The merchants file may carry `disbursement_fee_bps`, `rate_bps` and `merchant_legal_name`, used to open new lines (a line the merchant already has keeps its own terms; the plan lists any the file contradicts). Two optional files, uploaded with files or with a `pull_id`: `opening_loans` (loans open before the export starts, with their fee, paid buckets and interest to date, loaded through the loan import as at `opening_as_of`, which is then required and must be before every transaction, payment and write-off: `CREDIT_755`, `CREDIT_756`) and `write_offs` (merchant, the loan's transaction id, `written_off_on`, optional `amount`; applied in date order with the payments, interest stopping on the day). Returns the plan as figures and as text, and warnings for any value that looks like a real person's email or phone number. A dry run (`200`) unless `dry_run` is `false`: then everything a run would refuse is refused here, and the book is written by a sandbox job (`202` with the job; poll `GET /credit/sandbox/jobs/{id}` until `succeeded`, when `result` is this response with `counts`, including each payment, opening loan or write-off the engine refused and why). One seed at a time per program (`CREDIT_757`). Applying is refused while warnings stand unless `allow_unredacted` is `true` with a `reason`, which is logged and audited.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Responses

### 200 — A dry run: the plan, written nothing.

Schema: `SuccessEnvelope_PartnerExportResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (PartnerExportResponse)

### 202 — Applying: the queued sandbox job.

Schema: `SuccessEnvelope_SandboxJobResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (SandboxJobResponse)

### 400 — Bad Request - Invalid input

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 401 — Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 403 — Forbidden - Insufficient permissions

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 404 — Not Found - Resource does not exist

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 422 — Validation Error

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/credit/sandbox/partner-export' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d ''
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/credit/sandbox/partner-export', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {}

response = httpx.post("https://api.ondayzero.com/api/v1/credit/sandbox/partner-export", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/credit/credit-seed-partner-export
- OpenAPI slice: https://www.ondayzero.com/docs/reference/credit/credit-seed-partner-export/openapi.json
- Other endpoints in **credit**: https://www.ondayzero.com/docs/reference/credit (markdown bundle: https://www.ondayzero.com/docs/reference/credit.md, OpenAPI: https://www.ondayzero.com/docs/reference/credit/openapi.json)
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md
