The sandbox
The sandbox is https://api.borrou.capital. It runs the same code as live, with the same checks, records, events and two-person approvals, against synthetic data only. It differs from live in three ways:
- Who it serves. Only sandbox credentials (
client_idstartingbpc_test_) for sandbox partners. A live credential is refused there, and a sandbox credential is refused on live. - What sits behind it. A simulated custodian and simulated KYC, e-signature, price and email providers. Nothing reaches a real custodian, a real provider or a real inbox, and no real funds move. Deposit and top-up addresses, and Borrou's receiving addresses in repayment instructions, are the simulator's: never send real assets to them.
- The simulators. Under
/v1/sandbox, they stand in for the people and systems your integration waits for in live: the borrower, the providers, the custodian and TFG's KYC reviewer.
Never send real personal data to the sandbox. Use synthetic borrowers: an application whose borrower email is not under the .test domain is refused (422 sandbox_test_email_required).
What you do, and what the simulators do
Your own steps are your API calls, exactly as in live: the application, the KYC hand-off, the loan, the contract, cancellations, increase requests and the borrower's acceptance, webhooks. The simulators never take those steps for you.
| Simulator | Stands in for | What it does | When it answers 409 sandbox_step_unavailable |
|---|---|---|---|
POST /v1/sandbox/applications/{id}/kyc with {"decision": "APPROVE" | "REJECT"} | The borrower at the KYC provider, then TFG's reviewer | Records the provider's result for the applicant your PROVIDER hand-off opened (green for approve, red for reject), which sends the file to TFG; then the sandbox's simulated reviewer decides it through the same checks a TFG reviewer's decision goes through. A RELIANCE file is already with TFG and goes straight to the decision. Approval also asks the simulated custodian to open the borrower's wallet, where payouts and collateral returns go unless TFG has registered your settlement account. You receive kyc.completed, kyc.status_changed and application.approved or application.rejected. | There is no hand-off yet, the application is no longer SUBMITTED, or TFG has already decided the borrower. |
POST /v1/sandbox/loans/{reference}/sign | The borrower at the e-signature provider | Signs the contract you issued. The signature is recorded as a real one is, and the loan's own collateral wallet is opened at the custodian. You receive contract.signed and collateral.wallet_assigned. | The contract has not been issued, the loan is not waiting for a signature, or the product's signature_mode is CLICKWRAP_OTP: that contract is accepted with a one-time code instead (see the retail flow below). |
POST /v1/sandbox/loans/{reference}/deposit with {"amount_btc"}, and optionally "confirmations" and "travel_rule_status" (OK, HELD, PENDING); or {"deposit_id", …} to move a deposit on | The borrower sending BTC, and the custodian screening and releasing it | A deposit into the loan's collateral wallet, screened clear. It reaches the loan through the same custody sync a real one does: classified against the required BTC cumulatively, counted only once released, held while its Travel Rule record is held or pending. A short or late deposit waits for TFG's go/no-go. On an ACTIVE loan it is a top-up. | The loan takes no deposit in its state, or has no collateral wallet yet. |
POST /v1/sandbox/loans/{reference}/advance | TFG's two approvals of the payout, then the custodian executing it (see below) | On a loan at COLLATERAL_DEPOSITED: the sandbox's two simulated TFG users enter and approve the payout, one each, which sends the instruction to the simulated custodian; then it plays the custodian approving and executing it. The custody sync confirms the payout and the loan becomes ACTIVE. steps names what it did. | The loan is at another step, or a TFG person entered the payout (a second TFG person approves it in TFG's console), or the sandbox runs with simulated approvals off; the message says which. |
POST /v1/sandbox/loans/{reference}/repayment (proposed, may change) | The borrower's USDT arriving at Borrou's receiving wallet at the custodian | On an ACTIVE loan: makes a transfer of the full amount the repayment instructions quote arrive at the simulated custodian, under a hash shaped like one (nothing moves), and answers it in repayment. The sandbox's two simulated TFG users then enter and confirm the repayment, one each, past the check of the transfer with the simulated custodian (steps: TRANSFER_SEEN, REPAYMENT_ENTERED, REPAYMENT_CONFIRMED): the loan is repaid in full, and advance plays its collateral's return, after which it is CLOSED. | The loan is not active, is already repaid, has a repayment waiting for its second approver, or is being liquidated; the message says which. |
POST /v1/sandbox/prices with {"btc_usd"} | The market | Sets the BTC price of your own simulated feed: quotes, new loans and coverage use it at once; the collateral monitor and the upper-limit job from their next run. Use it to see warnings, margin calls and the upper limit. | Never; a step that moves more than the price checks accept at once is 422 price_move_out_of_band (about 9.5% by default): move it in steps, each after the next price check, about a minute apart. |
GET /v1/sandbox/increase-requests/{id}/code | The borrower reading Borrou's email | Returns the current one-time code of an increase request awaiting acceptance, so you can relay the borrower's acceptance. | The request is not awaiting acceptance (increase_not_open), or its code is used, expired or out of attempts (otp_used, otp_expired, otp_attempts_exhausted): send a new one with resend-code. |
GET /v1/sandbox/loans/{reference}/contract/acceptance-code | The borrower reading Borrou's email | Returns the current one-time code that accepts a click-wrap contract (a product whose signature_mode is CLICKWRAP_OTP), so you can send the borrower's acceptance with POST /v1/loans/{reference}/contract/accept. | The contract does not await acceptance, or there is no usable code (contract_not_awaiting_acceptance): send one with POST .../contract/acceptance-code. |
Each answer is the simulator's result and, for the loan simulators, the loan's status after the custody sync for your records. When the custodian's event list has another partner's event ahead of yours, the scheduled sync (about once a minute) applies yours: poll GET /v1/loans/{reference} for a minute or two before you conclude anything.
Other timings in the sandbox: webhooks are queued about a minute after an event and sent then, and the event enters the events feed at that same moment, with its position; the collateral monitor runs every few minutes.
The payout and the two TFG approvals
Every fund movement in Borrou needs two different people at TFG to approve it, and only then is the custodian instructed. The sandbox keeps the two approvals, and on Borrou's sandbox two simulated TFG users take them for a payout, so you can reach ACTIVE without waiting for anyone:
- When your loan reaches
COLLATERAL_DEPOSITED,GET /v1/loans/{reference}showsnext_action: TFG_APPROVES_PAYOUT(byTFG). Calladvance: one simulated user enters the payout, the other approves it, through the same two-person checks and the same database rules as two TFG people, and the instruction goes to the simulated custodian, whichadvancethen plays as well. The loan becomesACTIVEonce the custody sync has applied the execution. - The simulated users act only on a sandbox partner's payout, and never approve an entry a person made: if a TFG person entered your payout, a second TFG person approves it in TFG's console, and
advancethen plays only the custodian. - On Borrou's sandbox they also take a sandbox loan's full repayment and its collateral's return, one entering and the other approving each, as for the payout:
POST /v1/sandbox/loans/{reference}/repayment, thenadvance. In live both are TFG staff's, two people each. They approve nothing else: no partial repayment, interest payment, increase, surplus return or liquidation. - On a sandbox where the simulated approvals are off,
advanceanswers409 sandbox_step_unavailableuntil TFG staff have approved the payout, then plays the custodian.
In live, every payout waits for two TFG people.
The retail flow: a bullet loan accepted with a one-time code
A second sandbox partner, on request from TFG, has one product with the retail terms a partner embedding Borrou in its own app is likely to offer. It runs the same code and the same checks as every other product; only the product's settings differ. Ask TFG for that partner's sandbox credential (its own client_id and client_secret); the flow below uses only that credential.
What the product says (GET /v1/products):
| Field | Value | What it means |
|---|---|---|
repayment_profile, term_days | BULLET, 30 | No interest periods: interest and principal are paid together, at any time and at the latest at the maturity, 30 days after the payout. |
accrual_basis | SECOND_ACT_360 | Interest accrues per second, on a 360-day year, from the payout's execution. A loan repaid after an hour owes an hour. |
signature_mode | CLICKWRAP_OTP | The borrower accepts the contract in your app by entering a one-time code Borrou emails them; there is no e-signature link. |
risk_policies.margin_call_issuance | AUTOMATIC | Borrou issues a margin call and emails the borrower its notice once two checked prices, from both sources, put the loan at or below its margin-call level. A call moves nothing. |
risk_policies.liquidation_surplus_policy | RETAIN | After a sale, the lender keeps what the sale raised beyond the debt. |
risk_policies.recourse | NON_RECOURSE | After a sale, the borrower owes nothing more. |
ladder | 160% / 135% / 125% | The initial margin, the margin-call level and the liquidation level, with a 12-hour cure window. |
The same product carries one more setting you see on the loan, not the product: its payouts, and any collateral returned, go to your settlement account at the custodian, which TFG registers for your partner (two TFG people, as for any change to your configuration), never to an address you or the borrower name. The payout resource shows it by kind only: destination.kind: PARTNER_SETTLEMENT_ACCOUNT. In the sandbox that account is the simulated custodian's.
The walk, with an Idempotency-Key on every write:
GET /v1/products, thenGET /v1/quote?principal_usdt=…&product=…: keepquote_token.POST /v1/applicationsfor a synthetic borrower (.testemail), thenPOST /v1/applications/{id}/kyc-handoffwith{"mode": "PROVIDER"}.- Sandbox:
POST /v1/sandbox/applications/{id}/kycwith{"decision": "APPROVE"}. POST /v1/loanswith the application, thequote_token, theusdt_networkandcollateral_sender(who sends the BTC). The loan readsrepayment_profile: BULLETandmatures_at: null: the maturity is set when the payout executes.strike_priceandtrigger_pricesare null until then too.POST /v1/loans/{reference}/contract:signing_linkis null, andacceptance.text.textcarries the words your app shows the borrower, exactly as given, which name the contract's SHA-256 (acceptance.text.versionis the version you send back).POST /v1/loans/{reference}/contract/acceptance-code: Borrou emails the borrower a one-time code.- Sandbox:
GET /v1/sandbox/loans/{reference}/contract/acceptance-codereads that code back, as the borrower would read the email. In live, the borrower types it into your app. POST /v1/loans/{reference}/contract/acceptwithotp,contract_sha256,text_versionandpartner_session_ref(an opaque reference of the borrower's session in your app, never an email or an IP address). The contract isSIGNEDand the loan's collateral wallet is opened.- Sandbox:
POST /v1/sandbox/loans/{reference}/depositwith the loan'srequired_collateral_btc(the loan's own, fixed at its creation, not the quote's). GET /v1/loans/{reference}:COLLATERAL_DEPOSITED,next_action: TFG_APPROVES_PAYOUT(byTFG);GET /v1/loans/{reference}/disbursementshowsdestination.kind: PARTNER_SETTLEMENT_ACCOUNT.- Sandbox:
POST /v1/sandbox/loans/{reference}/advance: the payout's two approvals, simulated, and the custodian's execution.GET /v1/loans/{reference}/disbursementreadsEXECUTED.
Once it is ACTIVE, the loan carries matures_at (the payout's execution plus 30 days), strike_price (the checked BTC price at the payout) and trigger_prices (the BTC prices at which the loan reaches its margin-call and liquidation levels, at the strike and now). Use POST /v1/sandbox/prices to move your simulated price and watch the automatic margin call arrive as loan.margin_call_issued.
GET /v1/loans/{reference}/repayment-instructions gives the full amount to repay: what the loan will owe at the end of the UTC day, valid until then. In live the repayment and the collateral's return are TFG's steps; on the sandbox, POST /v1/sandbox/loans/{reference}/repayment and then advance play them, as above.
The click-wrap acceptance, the kept surplus and non-recourse wait for legal clearance before any live loan uses them; the sandbox is never held back by that. Folder 10-retail-flow of the quick-start collection walks steps 1 to 11 and reads the repayment instructions.
The guards
Every simulator call passes all of these, checked on every request, or it is refused:
- The service runs as the sandbox, against a database that holds synthetic data only, with the simulated custodian and the simulated providers. Anywhere else, including live, every simulator answers
403 sandbox_only, before authentication. - The access token's credential is a sandbox credential, with the
sandbox:simulatescope, which only sandbox credentials can hold (403 insufficient_scopeotherwise). - The credential's partner is a sandbox partner (
403 sandbox_onlyotherwise). - The record is yours: another partner's application or loan is
404 not_found, and the custody sync a simulator runs covers your records only.
Every simulator POST is a write with an Idempotency-Key, like any other POST, and every simulator call, the code read-backs included, is recorded in Borrou's audit trail with the credential that made it.
What the simulators never do
- Approve anything but a sandbox loan's payout, its full repayment and its collateral's return. Only entries the simulated users made themselves, never one a person entered, and never any other movement.
- Take your steps. The KYC hand-off, the loan, the contract and everything else you call yourself in live, you call yourself in the sandbox.
- Act past
ACTIVE. Repayments, collateral returns, surplus returns, increase payouts and liquidation are TFG's steps in its console, in the sandbox as in live, and so is a margin call on a product whose calls TFG issues (on one whose calls are automatic, Borrou issues it on the checked price, as in live). You read them through the servicing endpoints and events; there is no simulator for them. Ask your TFG contact when you need one taken on a sandbox loan. - Decide a short or late deposit. That go/no-go is TFG's.
- Touch another partner's records, or move another partner's loans with your price.
- Run outside the sandbox, or skip any check a real step goes through.