Programmatic access to TBUSD Escrow for business integrations
The TBUSD Escrow API allows businesses to programmatically create and manage escrows. Perfect for marketplaces, freelance platforms, or any application that needs secure payment holding.
The API is currently open and does not require authentication. Rate limits apply: 100 requests per minute per IP.
| ID | Name | Description |
|---|---|---|
| 0 | Mutual | Both parties must agree to release or refund |
| 1 | BuyerProtected | Buyer controls release and refund |
| 2 | SellerProtected | Seller controls release and refund |
| 3 | TimeRelease | Auto-releases after deadline; buyer can refund before |
Get API information and contract addresses
{
"name": "TBUSD Escrow API",
"version": "1.0.0",
"network": "Base Mainnet",
"chainId": 8453,
"contracts": {
"factory": "0x73BEf257850A977D84E6e02b62dedBbb5757dbc2",
"tbusd": "0x0d02E2E2a7ADaF2372ca0C69845c8b159A24a595"
}
}
Get factory statistics
{
"totalEscrows": 42,
"factory": "0x73BEf257850A977D84E6e02b62dedBbb5757dbc2",
"tbusd": "0x0d02E2E2a7ADaF2372ca0C69845c8b159A24a595",
"network": "Base Mainnet"
}
Get details for a specific escrow
| Name | Type | Description |
|---|---|---|
| address | string | Escrow contract address Required |
{
"address": "0x1234...5678",
"depositor": "0xBuyer...",
"recipient": "0xSeller...",
"amount": "1000000000",
"amountFormatted": "1000.00",
"escrowType": "BuyerProtected",
"escrowTypeId": 1,
"status": "Funded",
"statusId": 2,
"description": "Domain purchase - example.com",
"deadline": null,
"acceptance": {
"buyer": true,
"seller": true
}
}
List all escrows for a wallet
| Name | Type | Description |
|---|---|---|
| wallet | string | Wallet address to query Required |
{
"wallet": "0x1234...5678",
"asDepositor": 3,
"asRecipient": 2,
"total": 5,
"escrows": [
{ ... escrow details ... }
]
}
Build a transaction to create a new escrow
| Field | Type | Description |
|---|---|---|
| depositor | string | Buyer wallet address Required |
| recipient | string | Seller wallet address Required |
| amount | string | Amount in TBUSD (e.g., "100.00") Required |
| escrowType | number | Type ID (0-3) Required |
| deadline | number | Unix timestamp for TimeRelease Optional |
| description | string | Human-readable description Optional |
curl -X POST https://tbusd-escrow-api.jkm1317.workers.dev/api/v1/escrow/build \
-H "Content-Type: application/json" \
-d '{
"depositor": "0xBuyerAddress...",
"recipient": "0xSellerAddress...",
"amount": "500.00",
"escrowType": 1,
"description": "Website purchase"
}'
{
"to": "0x73BEf257850A977D84E6e02b62dedBbb5757dbc2",
"value": "0x0",
"chainId": 8453,
"params": {
"depositor": "0xBuyerAddress...",
"recipient": "0xSellerAddress...",
"amount": "500000000",
"escrowType": 1,
"deadline": 0,
"description": "Website purchase"
},
"note": "Sign this transaction with your wallet to create the escrow"
}
Here's a complete example using JavaScript and ethers.js:
import { ethers } from 'ethers';
const API_BASE = 'https://tbusd-escrow-api.jkm1317.workers.dev';
// 1. Build the transaction via API
const response = await fetch(`${API_BASE}/api/v1/escrow/build`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
depositor: buyerWallet,
recipient: sellerWallet,
amount: '500.00',
escrowType: 1, // BuyerProtected
description: 'Order #12345'
})
});
const txData = await response.json();
// 2. User signs and sends transaction
const provider = new ethers.BrowserProvider(window.ethereum);
const signer = await provider.getSigner();
const factory = new ethers.Contract(txData.to, FACTORY_ABI, signer);
const tx = await factory.createEscrow(
txData.params.depositor,
txData.params.recipient,
txData.params.amount,
txData.params.escrowType,
txData.params.deadline,
txData.params.description
);
const receipt = await tx.wait();
console.log('Escrow created:', receipt);
// 3. Poll for status updates
const escrowAddress = '0x...'; // from receipt events
const details = await fetch(`${API_BASE}/api/v1/escrow/${escrowAddress}`);
console.log(await details.json());
| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad request - check parameters |
| 404 | Escrow not found |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
For API support or integration help, contact us at [email protected]