# Initiate withdrawal

POST https://api.bb.no/v1/withdrawals/bitcoin

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. Requests are not idempotent: after a
 timeout, check your withdrawals before retrying.

## Authentication

x-bb-api-key: Public part of your API key. Starts with `bb/public/`.

x-bb-api-hmac: HMAC authentication for the API request, constructed using the corresponding secret value from your API key.

x-bb-api-nonce: Nonce value. Used to ensure correct ordering of all API requests, as well as prevent attackers from being able to replay old requests. Can be set to any value, but needs to increase for each request. Recommendation is to use the current Unix timestamp in milliseconds.

API-key permission: bitcoin withdrawals.

[API keys and signing](https://barebitcoin.no/developers/authentication/api-keys)

## Parameters

None.

## Request body

[SendBitcoinRequest](https://barebitcoin.no/developers/models/SendBitcoinRequest).

## Examples

### Signed API key

```sh
curl -X POST \
  https://api.bb.no/v1/withdrawals/bitcoin \
  -H "Content-Type: application/json" \
  -H "x-bb-api-key: $BB_API_KEY" \
  -H "x-bb-api-nonce: $BB_NONCE" \
  -H "x-bb-api-hmac: $BB_HMAC" \
  -d '{
    "amountBtc": 0.0001,
    "destination": "REPLACE_WITH_BITCOIN_ADDRESS_OR_INVOICE",
    "tfrInfo": {
      "fullName": "REPLACE_WITH_RECIPIENT_NAME",
      "country": "NO",
      "address": "REPLACE_WITH_RECIPIENT_ADDRESS",
      "selfCustody": true
    }
  }'
```



## Responses

### 200

OK

Example:

```json
{
  "withdrawalId": "wi_01JA2B3C4D5E6F7G8H9J0K1M2N",
  "network": "NETWORK_BITCOIN",
  "status": "WITHDRAWAL_STATUS_COMPLETED"
}
```

[SendBitcoinResponse](https://barebitcoin.no/developers/models/SendBitcoinResponse).

Source: https://barebitcoin.no/developers/api/transfers/initiate-withdrawal


## Model: SendBitcoinRequest





### destination

Type: string.

The bitcoin destination to send funds to.
 Supported formats:
 - Bitcoin address (bech32, legacy-segwit, legacy)
 - Lightning invoice (bolt11)
 - Lightning address
 - Lightning LNURL





### amountBtc

Type: number · 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.





### accountId

Type: string.

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





### isPayment

Type: boolean.

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.





### description

Type: string.

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





### tfrInfo

Type: Info.

The recipient of this transaction, per EU's travel rule. Required for all
 withdrawals to new destinations. full_name and address are always
 required, also when the recipient is an organisation.



The recipient of this transaction, per EU's travel rule. Required for all
 withdrawals to new destinations. full_name and address are always
 required, also when the recipient is an organisation.



[Info](https://barebitcoin.no/developers/models/Info).

## Model: SendBitcoinResponse





### withdrawalId

Type: string.

The ID of the initiated withdrawal.





### network

Type: string · enum.



Values: NETWORK_BITCOIN, NETWORK_LIGHTNING



### status

Type: string · enum.

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

Values: WITHDRAWAL_STATUS_PENDING, WITHDRAWAL_STATUS_COMPLETED, WITHDRAWAL_STATUS_FAILED



## Model: Info





### fullName

Type: string.

Recipient name. For an organisation this is its registered name. Required
 for a private individual; optional for an organisation, which is identified
 by the organisasjonsnummer in nin.





### country

Type: string.

ISO-3166-1 alpha-2 country code





### address

Type: string.







### nin

Type: string.

The recipient's fødselsnummer, or a 9-digit organisasjonsnummer when the
 recipient is an organisation. Only required if the TFR config said so.





### exchange

Type: string.







### selfCustody

Type: boolean.





