Endpoints
Bitcoin

Bitcoin

Estimate Bitcoin Withdrawal

POST

https://api.bitvora.com/v1/bitcoin/withdraw/estimate

The Estimate Bitcoin Withdrawal endpoint is useful to determine the fees for the transaction, the success probability and to validate the destination. Acceptable destination types: lightning address, on-chain bitcoin address, lightning invoice, lnurl.

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

Create Lightning Invoice generates a bolt11 payment request and an internal invoice id, which can be used to lookup it's status later.
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

Free accounts are able to generate unlimited amounts of randomly generated lightning addresses with the bitvora.me domain to receive bitcoin. Paid accounts are able to use custom handles and bring their own domain. Request body is optional.
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

On-chain addresses are used to receive bitcoin on the blockchain. You can generate as many as you need. We currently support Taproot and Segwit formats.
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

Confirm a bitcoin withdrawal is the endpoint to send bitcoin (as opposed to the estimate endpoint). This endpoint can send to an on-chain address, lightning address, lightning invoice or lnurl string.
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"
    }
}