# POST /api/v1/credit/underwriting/assessments

> Request an underwriting assessment

- **Tag:** credit
- **Operation ID:** `request_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. While it waits, `waiting_on` names the data still landing and `wait_deadline` when the sweep completes it regardless. The result is evidence: approve or decline the completed assessment with `POST /credit/underwriting/assessments/{assessment_id}/decision`. The assessment is measured against the active version of the program's scorecard unless `scorecard_version_id` names another, and records which one. Send `requested_limit_cents`: rules written as a multiple of the limit report unmeasured without it. An unknown `program_id` is `404`; a program with no active scorecard (and no `scorecard_version_id` or `criteria_override` in the request) is `409` `CREDIT_POLICY_UNDECIDED`.

## Authentication

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

## Request body

Schema: `UnderwritingAssessmentRequest`

- `measurement_source_mode` (string) (one of: ledger, aggregate_sources) — Frozen measurement path. Aggregate sources require operator-bound source configuration and retain validated summaries only.
- `credit_line_id` (string)
- `external_application_id` (string)
- `program_id` (string)
- `criteria_override` (array · object) — Evaluate against these instead of the program's scorecard. The assessment records them as an ad-hoc snapshot rather than a scorecard version.
- `scorecard_version_id` (string) — Assess against this scorecard version. Defaults to the active version of the program's default scorecard.
- `requested_limit_cents` (integer) — The limit being applied for, in cents. Rules written as a multiple of the limit, or that apply only in a limit band, report unmeasured (`requested_limit_missing`) without it.
- `requested_term_days` (integer) — The term being applied for.
- `subject_business_id` (string) — The business whose data is measured. Defaults to the line's `merchant_business_id`, else the business in x-business-id. Must be a business the caller can access.
- `evaluate_if_ready` (boolean) — When true and the merchant's data is already complete (`waiting_on` is empty), measure and complete the assessment immediately instead of waiting for the nightly sweep.
- `auto_approve` (boolean) — When true and the completed assessment passes every required rule with zero failed criteria, automatically open the merchant's credit line for the requested limit and term. Sent true or false it wins; omitted, the program's `auto_approve_default` decides (a partner application on a sandbox auto-approves either way unless false is sent). `auto_approval.source` says which applied.
- `external_merchant_id` (string) — Your id for the merchant, used to open the credit line idempotently when `auto_approve` is true.
- `merchant_legal_name` (string) — The merchant's legal business name for automatic line opening.
- `merchant_email` (string) — The merchant's email address for automatic line opening.
- `merchant_state` (string) — Application's US state for notice template selection.
- `merchant_address` (MerchantAddress) — Application's mailing address for notices.

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_UnderwritingAssessmentResponse_`

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

### 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.

### 409 — Conflict - Resource already exists or is in an incompatible state

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/underwriting/assessments' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "measurement_source_mode": "ledger",
  "credit_line_id": "string",
  "external_application_id": "string",
  "program_id": "string",
  "criteria_override": [],
  "scorecard_version_id": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/credit/underwriting/assessments', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "measurement_source_mode": "ledger",
  "credit_line_id": "string",
  "external_application_id": "string",
  "program_id": "string",
  "criteria_override": [],
  "scorecard_version_id": "string"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {'measurement_source_mode': 'ledger',
 'credit_line_id': 'string',
 'external_application_id': 'string',
 'program_id': 'string',
 'criteria_override': [],
 'scorecard_version_id': 'string'}

response = httpx.post("https://api.ondayzero.com/api/v1/credit/underwriting/assessments", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/credit/request-underwriting-assessment
- OpenAPI slice: https://www.ondayzero.com/docs/reference/credit/request-underwriting-assessment/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
