Error codes
Every error has the same body:
{ "error": { "code": "application_not_approved", "message": "…", "request_id": "…" } }
- Branch on
code, never onmessage. Codes are stable; messages are for people and may be reworded. New codes may be added at any time (see Versioning): treat an unknown code by its HTTP status. request_idis also in theX-Request-Idheader of every response. Quote it when you ask TFG about a request.Retry-After(seconds) comes with every429, with503 price_unavailableand with503 provider_unavailable. Wait at least that long.
Retries and the Idempotency-Key
Every POST and DELETE (except the token request) takes an Idempotency-Key. A retry of the same request sends the same key; a new request sends a new key.
The last column below says whether a refusal is stored under the key:
- Stored: the refusal is about the request itself. Sending the same key again replays it, with
Idempotent-Replayed: true. To try something different, change the request and send a new key. - Not stored: the refusal can change without the request changing (TFG acts, a price comes back, a provider answers). The same key works once the situation has changed.
- Before the write: refused before anything ran (authentication, validation, a malformed id, not found), so nothing is stored and the same key can be used once the request is fixed.
- Read: a
GET; there is no key.
Retry automatically only on no answer (a timeout or a dropped connection), 429 and 5xx, with the same key, honouring Retry-After, with backoff and a limit on attempts. Every 409 is a conflict with the state of a loan, an application or a request: retrying it unchanged gets the same answer. Borrou never answers 409 to a concurrent retry with the same key; that request waits for the first one and replays its answer.
Authentication and access
| Code | HTTP | When | What to do | Stored |
|---|---|---|---|---|
invalid_client | 401 | The token request's client credentials are missing, malformed, unknown, wrong, revoked, for the other environment (a sandbox credential on live, or the reverse), or for a partner the API does not serve now. Which part was wrong is never said. | Check the client_id and client_secret and the base URL. If they were rotated or revoked, use the current ones; otherwise contact TFG. | n/a |
unsupported_grant_type | 400 | grant_type is not client_credentials. | Send grant_type=client_credentials. | n/a |
invalid_scope | 400 | The token request asked for a scope that does not exist or was not granted to the credential. | Ask only for scopes the credential holds, or leave scope out to get all of them. | n/a |
invalid_token | 401 | No Bearer token, or one that is expired, forged, for the other environment, from a revoked credential, from a secret a rotation has retired, or for a partner the API does not serve now (disabled, or an access mode without the API). | Get a new token and retry once. If a fresh token is refused too, the credential or the partner's access has changed: contact TFG. | Before the write |
insufficient_scope | 403 | The token does not carry the scope the endpoint needs (named in the message and in WWW-Authenticate). | Ask TFG to grant the scope to the credential, then get a new token. | Before the write |
rate_limited | 429 | Too many requests: per partner per minute (RateLimit-* headers), per source address, on the token endpoint, or on a capped action (replays, contract reminders, one-time codes). | Wait Retry-After seconds, then retry with the same key. Cache tokens instead of asking for one per request. | Not stored |
Requests and idempotency
| Code | HTTP | When | What to do | Stored |
|---|---|---|---|---|
invalid_request | 400, 422 | 400: the body or query failed validation (the message names the field), an unknown field was sent (bodies are strict), a cursor is not one of yours (or, for the events feed, not a position), the token request is malformed, or the Idempotency-Key is not 1 to 255 visible ASCII characters. 422: a new webhook subscription would exceed ten active ones. | Fix the request as the message says. For the subscription cap, disable one you no longer use. | Before the write; the subscription cap is stored |
unsupported_media_type | 415 | A body that is not application/json (or, for the token request, not form-encoded or JSON). | Send Content-Type: application/json. | Before the write |
payload_too_large | 413 | The body is over 64 KiB. | Send less; no request needs that much. | Before the write |
idempotency_key_required | 400 | A POST or DELETE without an Idempotency-Key. | Generate a key (a UUID) for the request and keep it for its retries. | Before the write |
idempotency_key_mismatch | 422 | The key was already used with a different request (another path or body). Nothing is written. | Use a new key for every new request. Send a key again only to retry the same request. | Nothing written |
not_found | 404 | No such endpoint, a malformed id, or a resource that does not exist or belongs to another partner (the two look the same). | Check the id or reference, and that it is one of yours. | Before the write |
Catalogue, quotes and prices
| Code | HTTP | When | What to do | Stored |
|---|---|---|---|---|
product_unavailable | 409 | You have no active product on the API channel, your product sizes collateral from agreed terms (which the API cannot take), or you named a product that is not your active one. | Ask TFG to activate an API product with quoted collateral, or quote the code the message names. | Not stored |
amount_above_limit | 422 | A principal above the product's maximum (quote, application, loan); an increase above what may be requested now; a surplus return above what may go back. | Ask for less. For an increase or a surplus return, read GET /v1/loans/{reference}/upper-limit first. | Stored for an application or a loan; not stored for an increase or a surplus return |
amount_below_minimum | 422 | A principal below the product's minimum. | Ask for more. | Stored |
price_unavailable | 503 | No checked BTC price right now (its circuit breaker is open, or the sources disagree). Nothing was created. | Wait Retry-After and retry with the same key. GET /v1/prices/btc-usd shows the breaker. | Not stored |
quant_platform_unavailable | 503 | Not offered: only for a product priced per loan by a pricing platform (operating.pricing_source: QUANT), which no partner is set to. That pricing is not available, or did not quote this loan. Nothing was created. | Retry later with the same key. | Not stored |
invalid_quote_token | 422 | The quote_token was not issued by this service to your partner. | Quote again (GET /v1/quote) and send its token, or leave the token out. | Stored |
quote_expired | 422 | The quote_token is past quote_expires_at; where the deployment pins the quoted price (price_pinned), the message says how old that price is. | Quote again and send the new token. | Stored |
quote_mismatch | 422 | The quote_token was issued for another principal than the application's. | Quote the application's principal. | Stored |
quote_terms_changed | 409 | Your product's terms changed after the quote. | Quote again and send the new token. | Not stored |
Applications and KYC
| Code | HTTP | When | What to do | Stored |
|---|---|---|---|---|
duplicate_external_reference | 409 | Another application of yours already has this external_reference. | Read that application, or send a different reference. | Stored |
borrower_mismatch | 409 | A borrower with this email is already your client under a different name. One email is one borrower. | Check the borrower's details; correct the name or the email. | Stored |
application_not_cancellable | 409 | The application is already cancelled or already a loan. | Nothing to cancel. To stop a loan before activation, cancel the loan. | Stored |
kyc_handoff_not_open | 409 | The application is cancelled or already a loan (stored); or the borrower's KYC file is with TFG or TFG has decided it (not stored). | Wait for TFG's decision (application.approved or application.rejected). | Stored for a cancelled application or a loan; not stored while TFG holds or has decided the file |
reliance_not_approved | 403 | A RELIANCE hand-off from a partner TFG has not approved for reliance, or while TFG does not let a reliance attestation stand for its identity checks (a setting still open). | Use mode: PROVIDER, or ask TFG about reliance. | Not stored |
country_not_accepted | 422 | The borrower's country of residence is on TFG's block-list, outside the countries your agreement with TFG covers, or not one your product lends to (an application); or there is none on file (a RELIANCE hand-off). | Send the borrower's real country of residence; a country excluded for you or your product cannot borrow under it. Ask TFG if your agreement should cover it. | Stored |
kyc_link_not_replayable | 409 | A retry, with the same key, of a PROVIDER hand-off: its short-lived link is handed over once and kept nowhere. The body carries the hand-off without the link. | For a fresh link, send a new hand-off with a new key. | Stored (this is the stored answer) |
provider_unavailable | 503 | The KYC or e-signature provider did not answer (a hand-off, or a contract), or the custodian did not open the loan's collateral wallet when a click-wrap acceptance was sent. Nothing was sent to the borrower, and no acceptance was recorded (the one-time code stays unspent); a contract's retry makes the agreement on the same document. | Wait Retry-After and retry with the same key (for an acceptance, the same code). | Not stored |
Loans and origination
| Code | HTTP | When | What to do | Stored |
|---|---|---|---|---|
application_not_approved | 409 | TFG has not approved the borrower yet, so no loan can be created. | Wait for application.approved, then retry with the same key. | Not stored |
borrower_not_eligible | 409 | On POST /v1/loans: TFG approved the borrower, but no new loan can start now: an override of missing documents has expired, the country of residence is to be confirmed or not one your product lends to, the approval predates the identity checks TFG now requires, or the borrower's identity verification does not pass at the KYC provider at the moment. On POST /v1/loans/{reference}/contract: the borrower is no longer approved by TFG, or does not pass at the KYC provider. The message says which. | Provide what the message names (your operators can upload a missing proof of address or source-of-funds declaration), or ask TFG compliance; then retry with the same key. | Not stored |
application_not_open | 409 | The application is cancelled, or already a loan (the message names it). | Read the application; submit a new one if needed. | Stored |
exposure_limit_reached | 422 | The loan, or the increase, would take you over your remaining capacity with TFG. | Ask for less, or ask TFG about your capacity. | Not stored |
network_not_accepted | 422 | usdt_network is not one Borrou offers, or not one your product accepts. | Send a network from your product's usdt_networks. | Stored when the product does not accept it; before the write when Borrou does not offer it |
destination_not_accepted | 422 | The body has an address or destination field, at any depth. Payouts and collateral returns go to your settlement account at the custodian, if TFG has registered one for you, or otherwise to the borrower's wallet at the custodian, opened when TFG approves the borrower; the API takes no address. | Remove the field. | Before the write |
payout_destination_required | 422 | Not offered: only for a product that pays out to an address you provide, which no partner is set to. POST /v1/loans carried no payout. | Ask TFG about your product's settings. | Stored |
collateral_return_destination_required | 422 | Not offered: only for a product that returns collateral to an address you provide, which no partner is set to. POST /v1/loans carried no collateral_return. | Ask TFG about your product's settings. | Stored |
destination_address_invalid | 422 | Not offered: only for a product that takes an address from you, which no partner is set to. The address does not fit its network. | Ask TFG about your product's settings. | Stored |
contract_not_issuable | 409 | The contract can be issued only while the loan is LOAN_CREATED. | Read GET /v1/loans/{reference}/contract: it may already be sent or signed. | Stored |
contract_not_awaiting_signature | 409 | A reminder for a contract that is not waiting for the borrower's signature. | Nothing to remind. | Not stored |
contract_not_awaiting_acceptance | 409 | A one-time code or an acceptance for a contract that is not a click-wrap one (signature_mode CLICKWRAP_OTP) awaiting the borrower's acceptance; in the sandbox read-back, no usable code. | Read GET /v1/loans/{reference}/contract: it may be signed already, or signed through the e-signature link. In the sandbox, send a new code first. | Stored; read for the sandbox read-back |
contract_document_mismatch | 422 | contract_sha256 is not the SHA-256 of the loan's stored contract. No attempt is spent. | Show the borrower the contract GET .../contract describes, and send its document.sha256. | Stored |
acceptance_code_rejected | 422 | The code does not accept the contract: wrong, expired, already used, out of attempts, or none sent. One answer for all of them; a wrong code spends one of its five attempts. Nothing was recorded. | Ask the borrower to check the latest email from Borrou, or send a new code with POST .../contract/acceptance-code; send the next attempt with a new key. | Stored |
legal_clearance_pending | 409 | Live only: the product's terms wait for legal clearance (today: click-wrap acceptance, a liquidation surplus kept by the lender, or a non-recourse loan), so no loan is created and no contract issued on them. Nothing was created. | Contact TFG. Retrying changes nothing until TFG has recorded the clearance. | Not stored |
partner_kyc_not_accepted | 403 | kyc_evidence sent, but TFG has not set your partner to send its own KYC evidence (proposed, pending TFG). The application was not created. | Send the application without kyc_evidence and use a KYC hand-off, or ask TFG; then retry with the same key. | Not stored |
kyc_evidence_not_accepted | 409 | kyc_evidence for a borrower whose KYC file is with TFG for review or already decided, or whose country on file is not kyc_evidence.residence_country. The application was not created. | Send the application without kyc_evidence, or ask TFG to confirm the borrower's country. | Not stored |
repayment_detection_off | 409 | Not offered: repayment announcements (POST /v1/loans/{reference}/repayments) are not taken. Nothing was recorded. | Send nothing here; TFG records repayments. | Not stored |
repayment_announced_differently | 409 | Not offered (repayment announcements): this hash was already announced on the loan with another network, asset or amount. Nothing was recorded. | Check the transfer, and announce it with its own figures. | Stored |
collateral_announcement_not_taken | 409 | Proposed (collateral announcements, POST /v1/loans/{reference}/collateral/announcements): the loan has a deposit address of its own, or takes no collateral in its state. Nothing was recorded. | Send the collateral to the loan's deposit address; no announcement is needed. | Stored |
collateral_transfer_already_announced | 409 | Proposed (collateral announcements): the transaction was already announced for another loan. Nothing was recorded. | Announce each loan's own transaction: one transaction is one loan's collateral. | Stored |
asset_not_accepted | 422 | Not offered (repayment announcements): the loan is not repaid in the asset announced (USDT today). | Announce the transfer in the loan's asset. | Stored |
deposit_address_unavailable | 409 | No deposit address yet (before the signature), none any more (the loan is active: use the top-up address; or it has ended), or the address cannot be confirmed right now: Borrou's records disagree, or its signature on the address does not verify. | Follow next_action. If the address cannot be confirmed, contact TFG before anything is sent, and never use an address you held from before. | Read |
lender_of_record_not_configured | 503 | Live only: the lender of record for the loan's product is not set yet, so no loan is created and no contract issued. Nothing was created. | Contact TFG. Retrying changes nothing until TFG has set it. | Not stored |
loan_not_cancellable | 409 | The loan is active or has ended (stored); or TFG has entered its payout, or the payout is with the custodian (not stored). | Contact TFG to stop a payout already entered. | Stored for an active or ended loan; not stored while a payout is entered or with the custodian |
Servicing
| Code | HTTP | When | What to do | Stored |
|---|---|---|---|---|
loan_not_active | 409 | The step needs an active loan (a top-up address, an increase, a surplus return, a repayment announcement). | Follow next_action. | Read for the top-up address; not stored for an increase or a surplus return; stored for a repayment announcement |
nothing_to_repay | 409 | Repayment instructions for a loan that is not active, or is repaid in full and waits for its collateral to go back. | Send nothing. | Read |
repayment_address_not_configured | 503 | Live only: Borrou has no receiving address configured for the loan's network yet. | Send no funds; contact TFG. | Read |
loan_repaid_in_full | 409 | A top-up address for a loan repaid in full whose collateral is going back. | Send nothing more to the loan. | Read |
address_verification_pending | 409 | Live only: the deposit or top-up address carries no Borrou signature yet, or the service holds no key to check one, so it is not served (see Verifying an address). | Ask TFG for it; never use an address from anywhere else. | Read |
Above the upper limit
| Code | HTTP | When | What to do | Stored |
|---|---|---|---|---|
upper_limit_unavailable | 409 | The loan is not above its upper limit with no breach continuing (the message names why: below the limit, a margin call open, interest overdue, a liquidation under way, and so on), or the borrower has no verified email for the one-time code. | Read GET /v1/loans/{reference}/upper-limit; reason says why. | Not stored |
increase_in_progress | 409 | An increase is already offered or accepted on the loan. An increase and a surplus return never run together. | Wait for it to be paid or to end, or withdraw it. | Not stored |
surplus_return_in_progress | 409 | A surplus return is requested or under way on the loan. | Wait for it to end. | Not stored |
increase_not_open | 409 | The increase is no longer awaiting the borrower (accepted, paid, expired or cancelled). | Read the request's status. | Stored; read for the sandbox code read-back |
increase_expired | 409 | The increase has ended (its acceptance window passed, or ten wrong codes in all). Nothing was recorded. | Request a new increase if the borrower still wants one. | Stored |
increase_not_cancellable | 409 | TFG has entered the increase's payout. | Ask TFG to stop it. | Not stored |
surplus_return_not_cancellable | 409 | TFG has entered the return, or the request has already ended or lapsed. | Ask TFG to stop an entered return. | Stored |
acceptance_text_mismatch | 422 | text_sha256 is not the SHA-256 of the text Borrou issued for this request. | Show the borrower acceptance_text.text exactly as given, and send its hash. | Stored |
acceptance_text_outdated | 422 | text_version is unknown or not the current version. | Show the text in the request as it is now, and send its version. | Stored |
invalid_accepted_at | 422 | accepted_at is before the request or its one-time code, or in the future. | Send the time of the borrower's click from a synchronised clock. | Stored |
otp_not_issued | 409 | No one-time code has been sent for the request (or, in the sandbox read-back, the current one was not issued by this sandbox). | Send one with POST .../resend-code. | Stored on an acceptance; read for the sandbox read-back |
otp_invalid | 422 | Not the code Borrou emailed the borrower. It spends one of the code's five attempts. | Ask the borrower to check the code; send the next attempt with a new key (the body changed). | Stored |
otp_expired | 422, 409 | The code is past its ten minutes (422 on an acceptance; 409 on the sandbox read-back). | Send a new one with resend-code. | Stored on an acceptance; read for the sandbox read-back |
otp_used | 409 | The code was already used. | Read the request: it is probably accepted. | Stored on an acceptance; read for the sandbox read-back |
otp_attempts_exhausted | 422, 409 | Five wrong attempts on this code (422 on an acceptance; 409 on the sandbox read-back). | Send a new one with resend-code. Ten wrong codes in all end the request. | Stored on an acceptance; read for the sandbox read-back |
Webhooks
| Code | HTTP | When | What to do | Stored |
|---|---|---|---|---|
invalid_destination | 422 | The webhook URL is not https, not on port 443, carries a user name or password, or its host is not a public DNS name resolving to public addresses. | Use a public https endpoint on the default port. | Before the write |
subscription_inactive | 409 | A replay of a delivery whose subscription is disabled. | Subscribe again, or read the event from GET /v1/events. | Stored |
Sandbox
| Code | HTTP | When | What to do | Stored |
|---|---|---|---|---|
sandbox_only | 403 | A sandbox simulator called anywhere but the sandbox, with a live credential, or for a partner that is not a sandbox partner. | Call the simulators only on the sandbox with your sandbox credential. In live, the borrower, the providers, the custodian and TFG take these steps. | Before the write |
sandbox_step_unavailable | 409 | The simulator has nothing to do for the loan or application as it stands; the message says what it waits for. This includes advance on a payout a TFG person entered (a second TFG person approves it), or, on a sandbox where simulated approvals are off, any payout until two TFG people have approved it. | Follow the message: the step it names, or ask your TFG contact to approve the payout. | Not stored |
price_move_out_of_band | 422 | A sandbox price step moves more than the price checks accept at once from the price they last accepted. | Move the price in smaller steps, each after the next price check (about a minute). | Not stored |
sandbox_test_email_required | 422 | An application in the sandbox names a borrower email outside the .test domain. The sandbox takes synthetic borrowers only, so nothing it sends can reach a real person. | Use a synthetic address under .test, such as borrower-1@partner.test. | Stored |
Service
| Code | HTTP | When | What to do | Stored |
|---|---|---|---|---|
internal_error | 500 | Something went wrong on Borrou's side. Nothing was saved. | Retry with the same key, with backoff. If it persists, contact TFG with the request_id. | Not stored |