Navbar
  • Introduction
  • Authentication
  • Partner
  • User
  • Connected Exchange
  • Connected Address
  • Errors
  • Introduction

    API endpoint

    https://api.bitbutter.com

    Examples in this documentation are written using httpie

    Welcome to the Bitbutter API! With Bitbutter you can connect multiple cryptocurrency exchanges and addresses to a user to instantly solve the difficulty of managing digital assets.

    These documents outline endpoints accessible to partners at a partnership. Endpoints can be grouped into four categories: partner, user, connected exchange, and connected address.

    Authentication

    Once a partnership is formed, a root partner account will be created to access the credentials required to make signed requests as well as the ability to create and delete partner accounts. There are two key pieces provided for the root partner: API Key and Secret.

    Headers

    All REST requests must contain the following headers:

    Signing a Message

    import * as crypto from 'crypto';
    
    const secret = '5J6AJYkZJXw97YgW...';
    
    const timestamp = Date.now() / 1000;
    const method = 'GET';
    const requestPath = '/users';
    const body = '';
    
    // 1. Concatentate required parts into one string
    const prehash = timestamp + method + requestPath + body;
    
    // 2. Base64 decode string
    const key = new Buffer(secret, 'base64');
    
    // 3. Create sha256 hmac with the base64 decoded string
    const hmac = crypto.createHmac('sha256', key);
    
    // 4. Sign with the sha256 hmac and base64 encode the result
    hmac.update(prehash).digest('base64');
    

    The signature needs four pieces of information to create: timestamp, method, requestPath and body. The method has to be all uppercase (i.e. "GET").

    1. Concatenate required parts into one string

    2. Base64 decode string

    3. Create sha256 hmac with the base64 decoded string

    4. Sign with the sha256 hmac and base64 encode the result

    Here is sample code on how we might generate this signature for our requests.

    Partner

    Member of a partnership

    Creating a Partner

    $ http POST "https://api.bitbutter.com/partners \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp" \
        "email=$email" \
        "partnership_id=$partnership_id"
    
    {
        "id": "string",
        "email": "string",
        "partnership_id": "string"
    }
    

    Creates a new partner inside of partnership

    BODY PARAMS

    email string
    partnership_id string

    Deleting a Partner

    $ http DELETE "https://api.bitbutter.com/partners/$partner_id \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp" \
        "partner_id=$partner_id"
    
    {
        "id": "string",
        "email": "string",
        "partnership_id": "string"
    }
    

    Deletes a partner inside of partnership

    PATH PARAMS

    partner_id string

    BODY PARAMS

    id string
    email string
    partnership_id string

    User

    User of application

    Create a User

    $ http POST "https://api.bitbutter.com/users \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp" \
        "partner_id=$partner_id"
    
    {
        "id": "string",
        "partnership_id": "string"
    }
    

    Creates a new user for a partnership

    BODY PARAMS

    partner_id string

    User Profile

    $ http "https://api.bitbutter.com/users/$user_id \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp" \
        "partner_id=$partner_id"
    
    {
        "id": "string",
        "connectables": [
            {
              id: "string",
              type: "string"
            }
        ],
        "balance": [
            {
                ticker: "string",
                size: "string"
            }
        ]
    }
    

    Shows details of a user

    PATH PARAMS

    user_id string

    Ledger

    $ http "https://api.bitbutter.com/users/$user_id/ledger \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    [
        {
            "id": "string",
            "sender": "string",
            "receiver": "string",
            "size": 0,
            "transferType": {
                "id": "string",
                "name": "string"
            },
            "connectable": {
                "id": "string",
                "type": "string",
                "name": "string"
            },
            "base": {
                "id": "string",
                "name": "string",
                "ticker": "string"
            },
            "quote": {
                "id": "string",
                "name": "string",
                "ticker": "string"
            },
            "time": "string",
            "fee": "string",
        }
    ]
    

    Returns all deposits, withdrawals, trades from all connected exchanges and connected addresses of a particular user in chronological order

    PATH PARAMS

    user_id string

    Users

    $ http "https://api.bitbutter.com/users/$user_id/ledger \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    [
        {
            "id": "string",
        }
    ]
    

    Gets list of all users associated to a partnership

    Delete User

    $ http DELETE "https://api.bitbutter.com/users/$user_id \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    {
        "id": "string",
        "partnership_id": "string"
    }
    

    Deletes user associated with partnership

    PATH PARAMS

    user_id string

    Connected Exchange

    Exchanges connected to a user

    Connection

    $ http POST "https://api.bitbutter.com/users/$user_id/connected-exchanges \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp" \
        "exchange_id=$exchange_id" \
        "key=$key" \
        "secret=$secret" \
        "password=$password"
    
    {
        "id": "string",
        "name": "string"
    }
    

    Connects exchange to a user

    PATH PARAMS

    user_id string

    BODY PARAMS

    exchange_id string
    key string
    secret string
    password string

    Profile

    $ http "https://api.bitbutter.com/users/$user_id/connected-exchanges/$connected_exchange_id \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    [
        {
            "id": "string",
            "size": 0,
            "name": "string",
            "asset": {
                "id": "string",
                "name": "string",
                "ticker": "string"
            }
        }
    ]
    

    Returns a list of wallets used within a connected exchange

    PATH PARAMS

    user_id string
    connected_exchange_id string

    Connected Exchanges

    $ http "https://api.bitbutter.com/users/$user_id/connected-exchanges \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    [
        {
            "id": "string",
            "name": "string"
        }
    ]
    

    Returns a list containing all exchanges connected to user

    PATH PARAMS

    user_id string

    Fills

    $ http "https://api.bitbutter.com/users/$user_id/connected-exchanges/$connected_exchange_id/fills \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    [
        {
            "id": "string",
            "size": 0,
            "name": "string",
            "asset": {
                "id": "string",
                "name": "string",
                "ticker": "string"
            }
        }
    ]
    

    Returns a list of fills from connected exchange

    PATH PARAMS

    user_id string
    connected_exchange_id string

    Withdrawals

    $ http "https://api.bitbutter.com/users/$user_id/connected-exchanges/$connected_exchange_id/withdrawals \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    [
        {
            "id": "string",
            "size": 0,
            "asset": {
                "id": "string",
                "name": "string",
                "ticker": "string"
            }
        }
    ]
    

    Returns list of withdrawals from connected exchange

    PATH PARAMS

    user_id string
    connected_exchange_id string

    Deposits

    $ http "https://api.bitbutter.com/users/$user_id/connected-exchanges/$connected_exchange_id/deposits \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    [
        {
            "id": "string",
            "size": 0,
            "asset": {
                "id": "string",
                "name": "string",
                "ticker": "string"
            }
        }
    ]
    

    Returns a list of deposits from connected exchange

    PATH PARAMS

    user_id string
    connected_exchange_id string

    Ledger

    $ http "https://api.bitbutter.com/users/$user_id/connected-exchanges/$connected_exchange_id/ledger \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    [
        {
            "id": "string",
            "sender": "string",
            "receiver": "string",
            "size": 0,
            "transferType": {
                "id": "string",
                "name": "string"
            },
            "connectable": {
                "id": "string",
                "type": "string",
                "name": "string"
            },
            "base": {
                "id": "string",
                "name": "string",
                "ticker": "string"
            },
            "quote": {
                "id": "string",
                "name": "string",
                "ticker": "string"
            },
            "time": 0,
            "fee": 0
        }
    ]
    

    Returns all deposits, withdrawals, trades from connected exchange in chronological order

    PATH PARAMS

    user_id string
    connected_exchange_id string

    Disconnecting

    $ http "https://api.bitbutter.com/users/$user_id/connected-exchanges/$connected_exchange_id \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    {
        "id": "string",
        "name": "string",
    }
    

    Disconnect connected exchange from user

    PATH PARAMS

    user_id string
    connected_exchange_id string

    Connected Address

    Address connected to a user

    Connection

    $ http POST "https://api.bitbutter.com/users/$user_id/connected-addresses \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp" \
        "asset_id=$asset_id" \
        "address=$address" 
    
    {
        "id": "string",
        "name": "string"
    }
    

    Connects address to a user

    PATH PARAMS

    user_id string

    BODY PARAMS

    asset_id string
    address string

    Profile

    $ http "https://api.bitbutter.com/users/$user_id/connected-addresses/$connected_address_id \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    [
        {
            "id": "string",
            "size": 0,
            "name": "string",
            "asset": {
                "id": "string",
                "name": "string",
                "ticker": "string"
            }
        }
    ]
    

    Returns balance stored in connected address

    PATH PARAMS

    user_id string
    connected_address_id string

    Connected Addresses

    $ http "https://api.bitbutter.com/users/$user_id/connected-addresses \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    [
        {
            "id": "string",
            "name": "string"
        }
    ]
    

    Returns a list containing all addresses connected to user

    PATH PARAMS

    user_id string

    Ledger

    $ http "https://api.bitbutter.com/users/$user_id/connected-addresses/$connected_address_id/ledger \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    [
        {
            "id": "string",
            "sender": "string",
            "receiver": "string",
            "size": 0,
            "transferType": {
                "id": "string",
                "name": "string"
            },
            "connectable": {
                "id": "string",
                "type": "string",
                "name": "string"
            },
            "base": {
                "id": "string",
                "name": "string",
                "ticker": "string"
            },
            "quote": {
                "id": "string",
                "name": "string",
                "ticker": "string"
            },
            "time": 0,
            "fee": 0
        }
    ]
    

    Returns all transfers from connected address in chronological order

    PATH PARAMS

    user_id string
    connected_address_id string

    Disconnecting

    $ http DELETE "https://api.bitbutter.com/users/$user_id/connected-addresses/$connected_address_id \
        "BB-PARTNER-ID: $partner_id" \
        "BB-ACCESS-KEY: $access_key" \
        "BB-ACCESS-SIGN: $signature" \
        "BB-TIMESTAMP: $timestamp"
    
    {
        "id": "string",
        "name": "string"
    }
    

    Disconnect connected address from user

    PATH PARAMS

    user_id string
    connected_address_id string

    Errors

    Bitbutter API uses the following error codes:

    Error Code Meaning
    400 Bad Request -- Invalid request format
    401 Unauthorized -- Invalid API key
    403 Forbidden -- Forbidden - You do not have access to the requested resource
    404 Not Found
    500 Internal Server Error -- We had a problem with our server.