API documentation

The API is RESTful. JSON is used for request and response payloads. We recommend the header Content-Type: application/json; charset=utf-8.

There are two types of methods:

  • public (do not require authorization)
  • private (require authorization)

To access private methods, please contact customer support to obtain an authorization token {api_key}.

Authorization: send the HTTP header Authorization: Bearer {api_key}.

Base URL:
/api/{endpoint}

Below is the description of available endpoints.

 

GET /status

Public method to check service status.

Request:
/api/status

Response:
{
  "status": "ok",
  "timestamp": 1649143742,
  "datetime": "2022-04-05T07:29:02+00:00"
}

Response parameters:
Name: status
Type: text
Description: ok when service is active

Name: timestamp
Type: integer
Description: Current server time (epoch seconds)

Name: datetime
Type: datetime
Description: Current server time (ISO 8601)

 

GET /validateAddress/{btc_address}

Public method to validate a Bitcoin address.

Request:
/api/validateAddress/n3PdePLBgEeTYk4nAhcbehsnjvr1i3LyYS

Response:
{
  "result": true
}

Response parameters:
Name: result
Type: boolean
Description: true if the BTC address is valid; otherwise false

 

POST /createTransaction

Private method to create a new transaction.

Request:
/api/createTransaction

Request parameters:
{
  "delay": "1",
  "payouts": {
    "mr9if7VDsVfEZ1qUo2u3trv6rU9eH7Yx4u": "0.001",
    "mia3h2FdYvR2LbDR1to9u6TC62hiTbDKM9": "0.002"
  },
  "refCode": "qljncygz"
}

Name: delay
Type: integer
Description: Delay in hours (the transaction will not start until the delay is reached)

Name: payouts
Type: object
Description: Map of BTC_address => BTC_amount

Name: refCode
Type: string
Description: Affiliate program code (optional)

Response:
{
  "id": "JEVG1TKFP4L95EDX",
  "status": "pending",
  "depositAddress": "tb1qmc2vcq6a427v6t83z8rnyg9ldf5k5p5uj2x4xv",
  "depositAmount": 0.00316,
  "payouts": {
    "mr9if7VDsVfEZ1qUo2u3trv6rU9eH7Yx4u": "0",
    "mia3h2FdYvR2LbDR1to9u6TC62hiTbDKM9": "0"
  },
  "fee": 0.00016,
  "delay": "1",
  "refCode": "qljncygz",
  "updated": "2022-05-05T08:56:05+00:00",
  "created": "2022-05-05T08:56:05+00:00",
  "signature": "zDQlfJHSJWtzw8yFwevs7KmiDZs15FVl01RbPwPt3bc="
}

Response parameters:
Name: id (string) – Transaction ID
Name: status (string) – One of: pending | confirming | processing | complete | expired
Name: depositAddress (string) – Deposit BTC address
Name: depositAmount (decimal) – Amount to deposit (payouts + fees)
Name: payouts (object) – BTC address => payout amount
Name: fee (decimal) – Total fees
Name: delay (integer) – Delay in hours
Name: refCode (string) – Affiliate code
Name: updated (datetime) – ISO 8601
Name: created (datetime) – ISO 8601
Name: signature (string) – See Signature section

 

GET /transactions

Private method to list transactions (newest first).

Request:
/api/transactions?limit=2&offset=0

Request parameters:
Name: limit (integer) – Number of records (default 30)
Name: offset (integer) – Paging offset (default 0)

Response:
{
  "transactions": [
    {
      "id": "Y9ANXDCJMHG2J6GD",
      "status": "pending",
      "depositAddress": "tb1qfhlu3acnqztwu2ep8mn446f8mfhkyt6u4xq2dd",
      "depositAmount": 0.00316,
      "payouts": { "mr9if7VDsVfEZ1qUo2u3trv6rU9eH7Yx4u": "0.001", "mia3h2FdYvR2LbDR1to9u6TC62hiTbDKM9": "0.002" },
      "fee": 0.00016,
      "delay": "1",
      "updated": "2022-05-05T08:52:52+00:00",
      "created": "2022-05-05T08:52:52+00:00"
    },
    {
      "id": "EEFU0IKT3BAJ1JOQ",
      "status": "expired",
      "depositAddress": "tb1qu80wgqucwvwxt3wdk8lyd4weuxn3vvy23et3p3",
      "payouts": { "mx1HgMB1EG38bRtfH4tQwMGSvZXodbxdQ8": "0.005" },
      "fee": 0.0001,
      "delay": "0",
      "updated": "2022-04-29T11:46:05+00:00",
      "created": "2022-04-26T11:46:02+00:00"
    }
  ],
  "totalTransactions": 27,
  "limit": 2,
  "offset": 0
}

Response parameters:
Name: transactions (array) – List of transactions
Name: totalTransactions (integer) – Total count
Name: limit (integer) – Page size
Name: offset (integer) – Page offset

 

GET /transaction/{id}

Private method to retrieve transaction details.

Request:
/api/transaction/Q96G3MSNW8MPQRTX

Response:
{
  "id": "Q96G3MSNW8MPQRTX",
  "status": "complete",
  "depositAddress": "tb1q0pkwdj3pqdp587yrc8sus876kccn5tq577ce5x",
  "depositAmount": "0.0062244",
  "depositTxid": "80bb6cda5036ce277598d949d2e4b3771c56b31ba77b757bf9753a370f16c99",
  "payouts": { "mfuAKvSsAMrC7gjbEEb521uc1myeF9BSsc": "0.006" },
  "txid": "0ea6f3a702a368ed09830d959f1c82b7d8f65f53a783965514380e123fc8ca4e",
  "fee": 0.0002244,
  "delay": "0",
  "updated": "2022-04-28T09:46:11+00:00",
  "created": "2022-04-28T09:42:41+00:00",
  "refCode": "qljncygz",
  "signature": "BASE64_SIGNATURE"
}

Response parameters:
Name: id (string) – Transaction ID
Name: status (string) – pending | confirming | processing | complete | expired
Name: depositAddress (string) – Deposit BTC address
Name: depositAmount (decimal) – BTC deposit amount received
Name: depositTxid (string) – TXID of the received deposit
Name: payouts (object) – BTC address => payout amount
Name: txid (string) – Withdrawal TXID
Name: fee (decimal) – Total fees
Name: delay (integer) – Delay in hours
Name: refCode (string) – Affiliate reference code
Name: updated (datetime) – ISO 8601
Name: created (datetime) – ISO 8601
Name: signature (string) – See Signature section

 

Signature

Each transaction includes a signature that confirms the data is authentic and unmodified.

Along with the authorization token {api_key}, support will provide a secret key {secret_key} to verify the authenticity of responses.

Signature calculation (PHP):
$secret_key = '{secret_key}';
$transaction_details = [
  "id" => "Q96G3MSNW8MPQRTX",
  "status" => "complete",
  "depositAddress" => "tb1q0pkwdj3pqdp587yrc8sus876kccn5tq577ce5x",
  "depositAmount" => "0.0062244",
  "depositTxid" => "80bb6cda5036ce277598d949d2e4b3771c56b31ba77b757bf9753a370f16c99",
  "payouts" => [ "mfuAKvSsAMrC7gjbEEb521uc1myeF9BSsc" => "0.006" ],
  "txid" => "0ea6f3a702a368ed09830d959f1c82b7d8f65f53a783965514380e123fc8ca4e",
  "fee" => 0.0002244,
  "delay" => "0",
  "updated" => "2022-04-28T09:46:11+00:00",
  "created" => "2022-04-28T09:42:41+00:00"
];
$signature = base64_encode(
  hash_hmac(
    'sha256',
    implode('|', array_map(function($a){ return is_array($a) ? implode(',', array_keys($a)).','.implode(',', $a) : $a; }, array_values($transaction_details))),
    $secret_key,
    true
  )
);

Note: parameter order must match the response exactly. Do not include signature itself in the calculation.

 

Error codes

On success, the server returns HTTP 200 OK.

ERROR response:
{
  "code": 400,
  "description": "Invalid JSON data."
}

Response parameters:
Name: code (integer) – Matches HTTP status:
- 400 – Bad request (validation error)
- 401 – Missing/invalid API key
- 403 – Blocked account / API access denied
- 404 – Endpoint not found
- 503 – Service temporarily unavailable

Name: description (string) – Error description

By using BtcMix, you agree to Privacy policy.