Skip to content

Build and stage the migration file from a stored pull

POST/api/v1/credit/programs/{program_id}/loans/import/from-partner-pull

Sandbox only: pulls are kept on a sandbox business (CREDIT_090 elsewhere), so this is the console's rehearsal of the cut-over; the live book is built from the same files by an operator script. Reads the pull's merchants and transactions tables and builds the launch import (Appendix E): one row per loan with a balance, keyed on the Brex transaction id; its paid amounts are what Tie's system assessed less what it reports outstanding, per loan or from the merchant's balance split over its loans oldest first (D-58); its interest good through pull_date and, above the program's ceiling, loaded at the ceiling (D-59). With since, the tail: the transactions that posted from that date, loaded as they posted (D-60). The file is staged on the program's loan import, and run is what to send with staging_id to POST /credit/programs/{id}/loans/import for the dry run and the apply. report is the exceptions report: rows refused and why, the lines and which are not open yet, interest reduced to the ceiling, loans repaid before cut-over (phase 2), and the control totals. open_lines also opens each merchant's line with its own terms, a merchant with no balance included, and sets its email, legal name and address; send it before the apply. 400 CREDIT_770 when since is after pull_date, CREDIT_771 when nothing would be imported, CREDIT_772 for a mapping field the builder does not read, CREDIT_773 for a cut-over pull with no merchants table.

Operation ID: credit_migration_build_from_pull·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

The program to stage the file on.

Request body

pull_idstringrequired

The pull (GET /credit/sandbox/partner-pulls).

pull_datestring · daterequired

The day the pull is as at the close of. Every row's interest is good through it (accrued_through, D-59), and the import runs as at the day after.

sincestring · date

The tail (D-60): only transactions that posted on or after this date, each loaded as it posted. Null for the cut-over import.

rolesobject

Role → table name, overriding the pull's: transactions, merchants.

mappingMigrationFieldMapping | string

The partner's field names, laid over the defaults; auto works them out from the tables (a money field only on a header that is one of its names).

balance_basisstring

Where the outstanding figures are read (D-58): loan from each transaction, merchant from the merchant's balance (split over its loans oldest first), auto per loan for a merchant whose every loan carries a figure, else the merchant's.

One of: auto, loan, merchant

line_keystring

Which line id carries Tie's merchant id. external_line_id (the default) opens each line under it, idempotently.

One of: external_line_id, external_merchant_id

open_linesboolean

Also open each merchant's line with its own terms, and set its email, legal name and address from the merchants table (as PATCH /credit/lines/{id} does). Off: nothing is written but the staged file, and run opens placeholder lines inside the dry run.

Responses

201Successful Response

successboolean
messagestring
codestring
dataMigrationBuildResponse

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.