Skip to content

Dry-run or apply a staged loan file across the program

POST/api/v1/credit/programs/{program_id}/loans/import

Fans the staged rows out to each line's loan import (1,000 rows per call) under one savepoint. With dry_run (the default), or any control total that does not match across the whole file, nothing is written, not one line; otherwise every line is written together. create_missing_lines opens a line for each key the program lacks, with line_defaults, through the ordinary line opening (so the program's limit envelope applies); a refusal rejects that line's rows. mode says where it runs: in the request (201 with the per-line results, the totals against the control totals, and the report id), or as a background job (202 with the batch, status running; poll GET /credit/import-batches/{id} for its progress and, when it finishes, the same result). auto, the default, runs up to 1,000 rows in the request. One run at a time per program. Operator action: an API token receives 403.

Operation ID: credit_import_run_loans·View as markdown·OpenAPI slice

Authentication

Bearer token authentication. Pass your DayZero API token in the Authorization header and the target business UUID in x-business-id.

Parameters

Path

program_idstringrequired

Request body

staging_idstringrequired

The batch from the parse step.

dry_runboolean

Run every line and report, then write nothing. On by default.

as_ofstring · date

Loan status is assessed as at this date. Today.

expected_countinteger

Rows the source file holds. A different count writes nothing.

expected_principal_centsinteger

Original principal summed over the file.

expected_outstanding_centsinteger

Outstanding summed over the file: principal, fee and accrued interest, less what was paid or credited; written-off loans count as zero.

create_missing_linesboolean

Open a line for each key the program does not have yet.

line_defaultsImportLineDefaults

Terms for the lines create_missing_lines opens.

modestring

sync runs the file in the request and answers with the result. async queues it as a background job and answers 202 with the batch (status: running); poll GET /credit/import-batches/{id}. auto (the default) runs files of up to 1,000 rows in the request and larger ones as a job. sync is refused over 2,000 rows.

One of: sync, async, auto

allow_cross_line_duplicatesboolean

A row whose original transaction id is already on a different line of the program is rejected (most likely a loan imported before under another merchant key), on a dry run as on an apply. Set true to load such rows anyway; each is listed in warnings.

dry_run_tokenstring

On an apply: the dry_run_token of the dry run you checked. The apply then runs only with exactly that dry run's inputs (as_of, the expected totals, create_missing_lines, line_defaults) under the mapping it ran with, and it must be the batch's last dry run; otherwise 400 CREDIT_690 and nothing runs. Optional.

Responses

201Run in the request: the per-line results, the totals against the control totals, and the report id.

successboolean
messagestring
codestring
dataProgramLoanImportResponse

202Queued as a background job: the batch, status running.

successboolean
messagestring
codestring
dataImportBatchResponse

400Bad Request - Invalid input

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

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

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

403Forbidden - Insufficient permissions

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

404Not Found - Resource does not exist

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

422Validation Error

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.