Fund the Account Balance
Adding funds to your account via the API.
Business API users can add funds to their account balance using the deposit endpoint.
Account deposits via API are only available to Business API accounts. Personal accounts can add balance via the website.
How It Works
- Create a deposit invoice for the amount you want to add
- Pay via crypto
- Balance is credited once payment confirms
Creating a Deposit
const response = await fetch(`${BASE_URL}/accounts/deposit`, {
method: 'POST',
headers,
body: JSON.stringify({
amount: 1000,
currency: 'USD',
payment_method: 'bitcoin'
})
});
const { data: invoice } = await response.json();
console.log(`Send ${invoice.payment.price} ${invoice.payment.currency}`);
console.log(`To: ${invoice.payment.address}`);Flexible Amount Deposits: You can omit the
amountparameter to create a flexible-amount deposit invoice. The final amount will be determined when you pay.
Request Parameters
| Parameter | Required | Description |
|---|---|---|
currency | Yes | Currency code: USD, EUR, or BTC |
payment_method | Yes | Crypto payment method (bitcoin, lightning, ethereum, etc.) |
amount | No | Amount to deposit. If omitted, creates a flexible-amount deposit invoice |
Supported Payment Methods
All crypto payment methods are supported. See Crypto Payments for the full list.
Checking Deposit Status
Since deposits return Invoice objects, check the invoice status using the standard invoices endpoint:
const response = await fetch(`${BASE_URL}/invoices/${invoiceId}`, { headers });
const { data: invoice } = await response.json();
if (invoice.status === 'complete') {
console.log('Deposit credited to balance');
}Complete Example
async function depositToAccount(currency, paymentMethod, amount = null) {
const body = { currency, payment_method: paymentMethod };
// Amount is optional - omit for flexible-amount deposits
if (amount !== null) {
body.amount = amount;
}
const response = await fetch(`${BASE_URL}/accounts/deposit`, {
method: 'POST',
headers,
body: JSON.stringify(body)
});
const { data: invoice } = await response.json();
return {
invoiceId: invoice.id,
paymentAddress: invoice.payment.address,
paymentAmount: invoice.payment.price,
paymentCurrency: invoice.payment.currency
};
}
// Usage: Fixed amount deposit
const deposit = await depositToAccount('USD', 'bitcoin', 1000);
console.log(`Send ${deposit.paymentAmount} ${deposit.paymentCurrency} to ${deposit.paymentAddress}`);
// Usage: Flexible amount deposit
const flexibleDeposit = await depositToAccount('USD', 'bitcoin');
console.log(`Flexible deposit invoice created: ${flexibleDeposit.invoiceId}`);Monitoring Balance
After deposit completes, check your balance:
const response = await fetch(`${BASE_URL}/accounts/balance`, { headers });
const { data } = await response.json();
console.log(`Balance: ${data.balance} ${data.currency}`);Updated about 2 months ago