Bare Bitcoin API (1.0.0)

API for interacting with Bare Bitcoin. Most endpoints require authentication. Create API keys here. Read about API authentication here.

Download OpenAPI description
Languages
Servers
Prod environment
https://api.bb.no/

BitcoinTransferService

Transfer bitcoin in and out of the platform. Fetch information about past bitcoin transfers.

Operations

Fetch bitcoin deposit destinations

Request

Fetches bitcoin deposit destinations. These destinations are always valid, and can be used for receiving arbitrary amounts. Onchain addresses are refreshed every time a deposit is made, but all prior generated addresses are still valid.

Query
accountIdstring

If empty, the default account is used.

curl -i -X GET \
  'https://api.bb.no/v1/deposit-destinations/bitcoin?accountId=string' \
  -H 'x-bb-api-hmac: YOUR_API_KEY_HERE' \
  -H 'x-bb-api-key: YOUR_API_KEY_HERE' \
  -H 'x-bb-api-nonce: YOUR_API_KEY_HERE'

Responses

OK

Bodyapplication/json
onchainAddressobject(DepositDestination)
lightningAddressobject(DepositDestination)
lnurlPayobject(DepositDestination)
Response
application/json
{ "onchainAddress": { "destination": "string", "network": "NETWORK_UNSPECIFIED" }, "lightningAddress": { "destination": "string", "network": "NETWORK_UNSPECIFIED" }, "lnurlPay": { "destination": "string", "network": "NETWORK_UNSPECIFIED" } }

Create a new Lightning invoice

Request

Creates a new BOLT11 Lightning invoice. Lightning invoices are requests to receive a specific amount of bitcoin within a set amount of time. If you don't a specific amount, consider using the destinations returned from /v1/deposit-destinations/bitcoin.

Bodyapplication/jsonrequired
accountIdstring

if empty, the default account is used.

currencystring(enum)

The currency the invoice is denominated in. Once created, the invoice is for a specific amount of bitcoin.

Enum"CURRENCY_UNSPECIFIED""CURRENCY_BTC""CURRENCY_NOK"
amountnumber(double)

The amount of the invoice, in the requested currency.

publicDescriptionstring

Public description of the invoice. Shown to both the creator and the recipient of the invoice. This is the so-called "memo" field of the Lightning invoice.

internalDescriptionstring

Free-form text description of the invoice. Can be used to correlate with your own systems. Only shown to the creator of this invoice, within the Bare Bitcoin systems.

curl -i -X POST \
  https://api.bb.no/v1/deposit-destinations/bitcoin/invoice \
  -H 'Content-Type: application/json' \
  -H 'x-bb-api-hmac: YOUR_API_KEY_HERE' \
  -H 'x-bb-api-key: YOUR_API_KEY_HERE' \
  -H 'x-bb-api-nonce: YOUR_API_KEY_HERE' \
  -d '{
    "accountId": "string",
    "currency": "CURRENCY_UNSPECIFIED",
    "amount": 0.1,
    "publicDescription": "string",
    "internalDescription": "string"
  }'

Responses

OK

Bodyapplication/json
depositDestinationIdstring
invoicestring
Response
application/json
{ "depositDestinationId": "string", "invoice": "string" }

Fetch a Lightning invoice

Request

Fetches a Lightning invoice.

Path
idstringrequired

Can be:

  1. Deposit destination ID. Prefix: ded_.
  2. The Lightning invoice itself.
curl -i -X GET \
  'https://api.bb.no/v1/deposit-destinations/bitcoin/invoice/{id}' \
  -H 'x-bb-api-hmac: YOUR_API_KEY_HERE' \
  -H 'x-bb-api-key: YOUR_API_KEY_HERE' \
  -H 'x-bb-api-nonce: YOUR_API_KEY_HERE'

Responses

OK

Bodyapplication/json
depositDestinationIdstring
invoicestring
statusstring(enum)
Enum"INVOICE_STATUS_UNSPECIFIED""INVOICE_STATUS_UNPAID""INVOICE_STATUS_PENDING""INVOICE_STATUS_PAID""INVOICE_STATUS_EXPIRED""INVOICE_STATUS_CANCELED"
Response
application/json
{ "depositDestinationId": "string", "invoice": "string", "status": "INVOICE_STATUS_UNSPECIFIED" }

Initiate withdrawal

Request

Initiates a bitcoin withdrawal. The transaction is not completed until it is confirmed by the network it is sent onto. A success response from this endpoint means the transaction was successfully initiated, but does not guarantee completion.

Bodyapplication/jsonrequired
destinationstring

The bitcoin destination to send funds to. Supported formats:

  • Bitcoin address (bech32, legacy-segwit, legacy)
  • Lightning invoice (bolt11)
  • Lightning address
  • Lightning LNURL
amountBtcnumber(double)

The amount to send. This field is required for all destinations except Lightning invoices. If the destination is a Lightning invoice, the amount is derived from the invoice.

accountIdstring

The ID of the account to send from. If empty, the default account is used.

isPaymentboolean

Marks the transaction as a payment. This has consequences for how the transaction is exported for tax purposes. It has no effect on the bitcoin transaction itself.

descriptionstring

Free-form text description of the withdrawal. Can be used to correlate with your own systems.

curl -i -X POST \
  https://api.bb.no/v1/withdrawals/bitcoin \
  -H 'Content-Type: application/json' \
  -H 'x-bb-api-hmac: YOUR_API_KEY_HERE' \
  -H 'x-bb-api-key: YOUR_API_KEY_HERE' \
  -H 'x-bb-api-nonce: YOUR_API_KEY_HERE' \
  -d '{
    "destination": "string",
    "amountBtc": 0.1,
    "accountId": "string",
    "isPayment": true,
    "description": "string"
  }'

Responses

OK

Bodyapplication/json
withdrawalIdstring

The ID of the initiated withdrawal.

networkstring(enum)
Enum"NETWORK_UNSPECIFIED""NETWORK_BITCOIN""NETWORK_LIGHTNING"
statusstring(enum)

The status of the withdrawal. The withdrawal might immediately succeed, if sending to another user of the Bare Bitcoin platform.

Enum"WITHDRAWAL_STATUS_UNSPECIFIED""WITHDRAWAL_STATUS_PENDING""WITHDRAWAL_STATUS_COMPLETED""WITHDRAWAL_STATUS_FAILED"
Response
application/json
{ "withdrawalId": "string", "network": "NETWORK_UNSPECIFIED", "status": "WITHDRAWAL_STATUS_UNSPECIFIED" }

Fetch withdrawal

Request

Fetches a bitcoin withdrawal.

Path
withdrawalIdstringrequired
curl -i -X GET \
  'https://api.bb.no/v1/withdrawals/bitcoin/{withdrawalId}' \
  -H 'x-bb-api-hmac: YOUR_API_KEY_HERE' \
  -H 'x-bb-api-key: YOUR_API_KEY_HERE' \
  -H 'x-bb-api-nonce: YOUR_API_KEY_HERE'

Responses

OK

Bodyapplication/json
withdrawalIdstring
destinationstring

The destination of the withdrawal.

networkstring(enum)

The network this withdrawal was sent on.

Enum"NETWORK_UNSPECIFIED""NETWORK_BITCOIN""NETWORK_LIGHTNING"
amountBtcnumber(double)

The amount of BTC that was withdrawn.

amountNoknumber(double)

The value of the BTC that was withdrawn, in NOK equivalent at time of withdrawal.

statusstring(enum)

The status of the withdrawal.

Enum"WITHDRAWAL_STATUS_UNSPECIFIED""WITHDRAWAL_STATUS_PENDING""WITHDRAWAL_STATUS_COMPLETED""WITHDRAWAL_STATUS_FAILED"
createdAtstring(date-time)

The time the withdrawal was initiated.

sentAtstring(date-time)

The time the withdrawal was sent from the platform.

Response
application/json
{ "withdrawalId": "string", "destination": "string", "network": "NETWORK_UNSPECIFIED", "amountBtc": 0.1, "amountNok": 0.1, "status": "WITHDRAWAL_STATUS_UNSPECIFIED", "createdAt": "2019-08-24T14:15:22Z", "sentAt": "2019-08-24T14:15:22Z" }

LedgerService

Operations

PublicService

Public endpoints that don't require authentication

Operations

TradingService

Execute and cancel orders. Fetch information about past orders.

Operations

UserService

Fetch information the authenticated user and it sub accounts.

Operations