Blockchain.com Payments API

Get account status and initiate deposits and withdrawals

OpenAPI Specification

blockchain.com-payments-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Blockchain.com Exchange REST Payments API
  description: '## Introduction

    Welcome to Blockchain.com''s Exchange API and developer documentation. \

    These documents detail and give examples of various functionality offered by the API such as receiving real time market data, requesting balance information and performing trades.

    ## To Get Started

    Create or log into your existing Blockchain.com Exchange account \

    Select API from the drop down menu \

    Fill out form and click “Create New API Key Now” \

    Once generated you can view your keys under API Settings. \

    Please be aware that the API key can only be used once it was verified via email.


    The API key must be set via the \

    `X-API-Token`\

    header.


    The base URL to be used for all calls is \

    `https://api.blockchain.com/v3/exchange`


    Autogenerated clients for this API can be found [here](https://github.com/blockchain/lib-exchange-client).

    '
  version: 1.0.0
servers:
- url: https://api.blockchain.com/v3/exchange
security:
- ApiKeyAuth: []
tags:
- name: payments
  description: Get account status and initiate deposits and withdrawals
paths:
  /accounts:
    get:
      summary: Receive current account balances
      description: ''
      operationId: getAccounts
      tags:
      - payments
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BalanceMap'
  /accounts/{account}/{currency}:
    get:
      summary: Receive current account balances
      description: ''
      operationId: getAccountByTypeAndCurrency
      tags:
      - payments
      parameters:
      - in: path
        name: account
        description: Account
        required: true
        schema:
          type: string
        example: primary
      - $ref: '#/components/parameters/currencyParam'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Balance'
  /deposits/{currency}:
    post:
      summary: Get a deposit address. Currently only crypto currencies are supported
      description: ''
      operationId: getDepositAddress
      tags:
      - payments
      parameters:
      - $ref: '#/components/parameters/currencyParam'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DepositAddressCrypto'
  /deposits:
    get:
      summary: Get a list of deposits
      description: ''
      operationId: getDeposits
      tags:
      - payments
      parameters:
      - $ref: '#/components/parameters/timeFromFilter'
      - $ref: '#/components/parameters/timeToFilter'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DepositInfo'
  /deposits/{depositId}:
    get:
      summary: Get status about a deposit
      description: ''
      operationId: getDepositById
      tags:
      - payments
      parameters:
      - name: depositId
        in: path
        description: Deposit ID
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DepositInfo'
        '404':
          description: Not found
  /whitelist:
    get:
      summary: Get a list of all whitelisted withdrawal accounts
      description: ''
      operationId: getWhitelist
      tags:
      - payments
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WhitelistEntry'
  /whitelist/{currency}:
    get:
      summary: Get a list of all whitelisted withdrawal accounts
      description: ''
      operationId: getWhitelistByCurrency
      tags:
      - payments
      parameters:
      - $ref: '#/components/parameters/currencyParam'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WhitelistEntry'
  /withdrawals:
    get:
      summary: Get a list of withdrawals
      description: ''
      operationId: getWithdrawals
      tags:
      - payments
      parameters:
      - $ref: '#/components/parameters/timeFromFilter'
      - $ref: '#/components/parameters/timeToFilter'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WithdrawalInfo'
    post:
      summary: Request a withdrawal
      description: Call `GET /whitelist` first to retrieve the ID of the beneficiary. To add a beneficiary to the whitelist, please visit the profile page in the Exchange. This call only works if 2FA is enabled on the account.
      operationId: createWithdrawal
      tags:
      - payments
      requestBody:
        description: ''
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWithdrawalRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WithdrawalInfo'
  /withdrawals/{withdrawalId}:
    get:
      summary: Get status about a withdrawal
      description: ''
      operationId: getWithdrawalById
      tags:
      - payments
      parameters:
      - name: withdrawalId
        in: path
        description: Withdrawal ID
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WithdrawalInfo'
        '404':
          description: Not found
components:
  schemas:
    DepositInfo:
      type: object
      required:
      - depositId
      - amount
      - currency
      - address
      - state
      properties:
        depositId:
          $ref: '#/components/schemas/DepositId'
        amount:
          type: number
          format: double
          example: '12.23'
          description: The amount that is credited in the currency specified
        currency:
          $ref: '#/components/schemas/currency'
        address:
          $ref: '#/components/schemas/CryptoAddress'
        txHash:
          type: string
          description: The transaction hash of the transaction that deposited funds
        state:
          type: string
          enum:
          - REJECTED
          - UNCONFIRMED
          - COMPLETED
        timestamp:
          $ref: '#/components/schemas/TimestampEpoch'
    DepositId:
      type: string
      description: Unique ID for this withdrawal
    BalanceMap:
      type: object
      properties:
        primary:
          $ref: '#/components/schemas/BalanceList'
      required:
      - primary
      additionalProperties:
        $ref: '#/components/schemas/BalanceList'
    WithdrawalAmount:
      type: number
      format: double
      example: '12.23'
      description: The amount to withdraw in the currency specified
    CryptoAddress:
      type: string
      description: Address to deposit to. If a tag or memo must be used, it is separated by a colon.
    WithdrawalStatus:
      type: string
      enum:
      - REJECTED
      - PENDING
      - REFUNDED
      - FAILED
      - COMPLETED
    Balance:
      type: object
      required:
      - currency
      - balance
      - available
      - balance_local
      - available_local
      - rate
      properties:
        currency:
          $ref: '#/components/schemas/currency'
        balance:
          type: number
          format: double
          example: '0.00366963'
        available:
          type: number
          format: double
          example: '0.00266963'
        balance_local:
          type: number
          format: double
          example: '38.746779155'
        available_local:
          type: number
          format: double
          example: '28.188009155'
        rate:
          type: number
          format: double
          example: '10558.77'
    WithdrawalInfo:
      type: object
      required:
      - amount
      - currency
      - beneficiary
      properties:
        withdrawalId:
          $ref: '#/components/schemas/WithdrawalId'
        amount:
          $ref: '#/components/schemas/WithdrawalAmount'
        fee:
          $ref: '#/components/schemas/WithdrawalFee'
        currency:
          $ref: '#/components/schemas/currency'
        beneficiary:
          $ref: '#/components/schemas/WithdrawalBeneficiary'
        state:
          $ref: '#/components/schemas/WithdrawalStatus'
        timestamp:
          $ref: '#/components/schemas/TimestampEpoch'
    WithdrawalFee:
      type: number
      format: double
      example: '0.0005'
      description: The amount charged in fees for this withdrawal
    TimestampEpoch:
      type: integer
      format: int64
      description: Time in ms since 01/01/1970 (epoch)
      example: '1592830770594'
    currency:
      type: string
      pattern: ^[A-Z]{3,5}$
      description: ''
      example: BTC
    DepositAddressCrypto:
      type: object
      required:
      - type
      - address
      properties:
        type:
          type: string
        address:
          type: string
          description: Address to deposit to. If a tag or memo must be used, it is separated by a colon.
    WithdrawalBeneficiary:
      type: string
    WhitelistEntry:
      type: object
      properties:
        whitelistId:
          type: string
          description: Unique ID for each whitelist entry
        name:
          type: string
          description: User specified name for this entry
        currency:
          $ref: '#/components/schemas/currency'
    WithdrawalId:
      type: string
      description: Unique ID for this withdrawal
    BalanceList:
      type: array
      items:
        $ref: '#/components/schemas/Balance'
    CreateWithdrawalRequest:
      type: object
      required:
      - currency
      - beneficiary
      properties:
        amount:
          $ref: '#/components/schemas/WithdrawalAmount'
        currency:
          $ref: '#/components/schemas/currency'
        beneficiary:
          $ref: '#/components/schemas/WithdrawalBeneficiary'
        sendMax:
          type: boolean
          description: 'If set, sends the full available amount, minus fees. Amount may not be specified in that case. '
  parameters:
    currencyParam:
      name: currency
      in: path
      description: Currency
      required: true
      schema:
        $ref: '#/components/schemas/currency'
    timeToFilter:
      name: to
      in: query
      description: Epoch timestamp in ms
      required: false
      schema:
        $ref: '#/components/schemas/TimestampEpoch'
    timeFromFilter:
      name: from
      in: query
      description: Epoch timestamp in ms
      required: false
      schema:
        $ref: '#/components/schemas/TimestampEpoch'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Token