Bitcoin
Estimate Bitcoin Withdrawal
POST
https://api.bitvora.com/v1/bitcoin/withdraw/estimate
Request
const axios = require('axios');
let data = {
"amount": 6.99,
"currency": "usd",
"destination": "[email protected]"
};
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.bitvora.com/v1/bitcoin/withdraw/estimate',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Response
{
"status": 200,
"message": "Bitcoin withdrawal estimate fetched successfully",
"data": {
"recipient": "[email protected]",
"recipient_type": "lightning_address",
"amount_sats": 100,
"bitvora_fee_sats": 0,
"success_probability": 1
}
}
Create Lightning Invoice
POST
https://api.bitvora.com/v1/bitcoin/deposit/lightning-invoice
const axios = require('axios');
let data = {
"amount": 1000,
"currency": "sats",
"description": "500 sats for utxo",
"expiry_seconds": 3600,
"metadata": {
"userID": "abc123",
"email": "[email protected]"
}
}; //metadata is optional
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.bitvora.com/v1/bitcoin/deposit/lightning-invoice',
headers: {
'Authorization': 'Bearer YOURAPIKEY',
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Response
{
"status": 201,
"message": "Lightning invoice created successfully",
"data": {
"id": "38d936e2-592b-4c7b-9ea5-5d11c350cffd",
"node_id": "halfin.bitvora.com",
"memo": "sats for utxo",
"r_preimage": "",
"r_hash": "a513f5fa9f36cd0c1d04708ce7da99c7b5122160b79c31549fc973836ba524a8",
"amount_sats": 500,
"settled": false,
"payment_request": "lnbc5u1pnfla2lpp555flt75lxmxsc8gywzxw0k5ec763ygtqk7wrz4yle9ecx6a9yj5qdpqw35xjueqv4ehggryv4ekxunfwp6xjmmwcqzzsxqrrsssp5mff85y9e605pcgn5pmqcng48j6nvjzr9texpypc57f6jvqdlw42q9qyyssq0xwtxlf4lk6ugduahhna36y966r8cp788ae2dallllrkhwymay4qdu54cmw5ze53hudpg2ljnggy432dzlp24uhj3hcfalr27haxujqp98rvwg",
"metadata": {
"email": "[email protected]",
"userID": "abc123"
},
"lightning_address_id": null
}
}
Create Lightning Address
POST
https://api.bitvora.com/v1/bitcoin/deposit/lightning-address
const axios = require('axios');
let data = {
"handle": "", // paid accounts can specify a handle, otherwise leave blank
"domain": "", // paid accounts can specify a domain, otherwise leave blank
"metadata": {
"userID": "abc123",
"email": "[email protected]"
}
}
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.bitvora.com/v1/bitcoin/deposit/lightning-address',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOURAPIKEY'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
{
"status": 201,
"message": "Lightning address created successfully",
"data": {
"id": "87ef7b1d-bac3-4fcf-a7bd-6da17bb99f6a",
"handle": "upbeathawk824",
"domain": "bitvora.me",
"address": "[email protected]",
"metadata": {
"email": "[email protected]",
"userID": "abc123"
},
"created_at": "2024-07-18T03:34:23.077876Z",
"updated_at": "2024-07-18T03:34:23.077876Z",
"last_used_at": null,
"deleted_at": null
}
}
Create On Chain Address
POST
https://api.bitvora.com/v1/bitcoin/deposit/on-chain
const axios = require('axios');
let data = {
"address_type": "taproot", //request body is optional
"metadata": {
"userID": "abc123",
"email": "[email protected]"
}
}
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.bitvora.com/v1/bitcoin/deposit/on-chain',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOURAPIKEY',
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
{
"status": 201,
"message": "Bitcoin address created successfully",
"data": {
"address": {
"id": "56dcbfd4-5c0a-41ca-918f-b0e6f580e2a4",
"address": "tb1pzanq0mkddkej5vd24yt0flfrhpdlkfw9td633jsu8zw74dz9z73spkvs9x",
"company_id": "6fc6625d-b913-41cb-9096-d442ba2e567b",
"node_id": "ontario",
"bitcoin_address_type": "taproot",
"metadata": {
"userID": "abc123",
"email": "[email protected]"
},
"created_at": "2024-07-15T20:02:11.735886Z"
}
}
}
Confirm Bitcoin Withdrawal
POST
https://api.bitvora.com/v1/bitcoin/send/confirm
const axios = require('axios');
let data = {
"amount": 6.99,
"currency": "usd",
"destination": "[email protected]",
"metadata": {
"userID": "1234"
}
};
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.bitvora.com/v1/bitcoin/withdraw/confirm',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOURKEY'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
{
"status": 201,
"message": "Bitcoin payment queued",
"data": {
"id": "b236cab6-b01b-4d7d-800d-df295c671cf4",
"amount_sats": 10,
"recipient": "[email protected]",
"fee_sats" 0.05,
"network_type": "mainnet",
"rail_type": "lightning",
"status": "pending",
"lightning_payment": null,
"chain_tx_id": null,
"metadata": {
"userID": "1234"
},
"created_at": "2024-07-23T18:44:34.601761Z"
}
}