Skip to content

Add a covenant to a line

POST/api/v1/credit/lines/{credit_line_id}/covenants

Writes a covenant the nightly sweep tests against the borrower's books from tonight on. comparison defaults to the kind's own (gte for the minimums, lte for max_leverage) and is required for custom_ratio, which also needs a numerator and a denominator selector naming at least one ledger id, type or concept (400 otherwise). A line with no merchant_business_id accepts covenants but every check reads unmeasured until the borrower's business is linked.

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

credit_line_idstringrequired

Credit line ID. The lender's routes need a line this business operates; the borrower's read also accepts a line it borrows on.

Request body

kindstringrequired

min_cash (cash ledgers' balance, currency), max_leverage (total liabilities / total equity), min_dscr (debt service coverage, the underwriting measurer), min_inventory_turns (cost of goods sold over 365 days / average inventory), min_current_ratio (current assets / current liabilities) or custom_ratio (two selectors).

One of: min_cash, max_leverage, min_dscr, min_inventory_turns, min_current_ratio, custom_ratio

labelstring

How the console names it.

thresholdnumberrequired

Whole currency units for min_cash; a decimal ratio otherwise.

comparisonstring

value <comparison> threshold passes. Defaults to the kind's own (gte for the minimums, lte for max_leverage); required for custom_ratio.

warn_band_bpsinteger

A pass within this share of the threshold warns (1000 = 10%).

numerator_selectorLedgerSelector

custom_ratio only: the numerator's ledgers.

denominator_selectorLedgerSelector

custom_ratio only: the denominator's ledgers.

activeboolean

Checked nightly while true.

notesstring

Operator notes.

Responses

201Successful Response

successboolean
messagestring
codestring
dataCovenantResponse

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.