NAV Navigation
BETA Version
Shell HTTP JavaScript Node.JS PHP Ruby Python Java Go

Introduction

Welcome to the Crypto APIs documentation! Cryptoapis.io is a simple, mostly RESTful JSON API for interacting with blockchains, accessed over HTTPS from the api.cryptoapis.io domain. Crypto APIs is an all-in-one platform unifying the way developers interact with Blockhains & Crypto Exchanges.

You will be able to get a wide range of data for top cryptocurrency exchanges & blockchains, plus integrate our API’s using this technical documentation. It is a fast, reliable and unified API Endpoint provider to access real-time or historical data.

Currently, there is only one version of our API (v1).

Getting Started

You can save time by using our Rest APIs, WebSockets and SDKs. We provide direct access to the most important blockchains and data to more than 150 top crypto exchanges.

Here is what you need to do next in order to get started:

Step 1: Read the documentation or Pick SDK

We recommend that you read the API documentation (https://docs.cryptoapis.io/) and familiarize yourself with the different API functions and calls so you can get the most out of the Crypto APIs!

For SDK’s:

Step 2: Create API Key

Production endpoints, require API key for authentication and providing real data. Be sure to generate an API Key from your Crypto APIs dashboard - https://dashboard.cryptoapis.io/account/api-keys . Click on “Create New API Key”.

Step 3: Using your API Key

You will be able to generate multiple API keys and to enable/disable them at any time. You may use them to get access to Crypto APIs Endpoints related to blockchains and exchanges. Be sure to authenticate yourself when performing queries to Crypto APIs.

Step 4: Get the right package for your business

In order to get the full potential of Crypto APIs, we suggest that you select the best package for your business needs. Follow the link below & sign-in.

Simply, select “Purchase” for your preferred plan and follow the instructions.

In case you need any help, please don't hesitate to use our direct chat or send us an email to: [email protected].

RESTFul resources

RESTful JSON API’s for interacting with blockchains & exchanges, are accessed over HTTPS from the https://api.cryptoapis.io domain. Currently, Crypto APIs supports Bitcoin, Ethereum, Litecoin, & Bitcoin Cash, both main & test net. We are working on implementing more blockchain such as EOS, Stellar & Ripple, plus additional exchanges. The data provided is HTTPS protocol which works on a Request-Reply basis.

All resources under a particular blockchain follow the following patter:

https://api.cryptoapis.io/$API_VERSION/BC/$COIN/${NETWORK}

Coin Network Resource
Bitcoin Main https://api.cryptoapis.io/v1/bc/btc/mainnet
Bitcoin Testnet https://api.cryptoapis.io/v1/bc/btc/testnet
Bitcoin Cash Main https://api.cryptoapis.io/v1/bc/bch/mainnet
Bitcoin Cash Testnet https://api.cryptoapis.io/v1/bc/bch/testnet
Litecoin Main https://api.cryptoapis.io/v1/bc/ltc/mainnet
Litecoin Testnet https://api.cryptoapis.io/v1/bc/ltc/testnet
Ethereum Main https://api.cryptoapis.io/v1/bc/eth/mainnet
Ethereum Ropsten (Testnet) https://api.cryptoapis.io/v1/bc/eth/ropsten
Ethereum Rinkeby (Testnet) https://api.cryptoapis.io/v1/bc/eth/rinkeby

Regarding our data provided by the exchanges, we have production endpoints, which require API Credentials for authentication and providing real-data: https://api.cryptoapis.io domain. In order to get real-time market data streaming, use WebSockets provided by Crypto APIs.

Exchange Functionality Resource Pathways Description
Get Exchanges https://api.cryptoapis.io/v1/exchanges Get a detailed list of exchanges provided by the system.
Get Assets https://api.cryptoapis.io/v1/assets Get detailed list of assets.
Get Mappings https://api.cryptoapis.io/v1/mappings Get detailed list of symbols & mappings.
Get OHLCV https://api.cryptoapis.io/v1/ohlcv Open, High, Low, Close, Volume timeseries data.
Get Trades https://api.cryptoapis.io/v1/trades This section describes calls related to executed transactions data, also known as matched orders data or active data.
Get Quotes https://api.cryptoapis.io/v1/quotes This section describes calls related to quotes data, also known as quotes or passive level 1 data.

WebSocket resources

Blockchains are highly transactional systems. Many usage patterns require knowing when an event occurs: i.e., when a transaction is included into a block, or when an unconfirmed transaction is relayed through the network. Instead of requiring you to continuously poll resources, we provide push APIs to facilitate those use cases, and support both WebSockets and WebHooks.

WebSocket endpoint provides real-time market data streaming from the exchanges, which works in Subscribe-Publish communication model.

Crypto APIs WebSockets is located on wss://ws.cryptoapis.io

Authentication

Getting an API Key

Production endpoints, require API key for authentication and providing real data. Be sure to create and get your API key from the API Keys section on the CryptoAPIs dashboard - https://dashboard.cryptoapis.io/account/api-keys

From there you can also create new API keys and delete old ones, which you do not want to have access anymore.

Using your API Key

'X-API-Key: my-api-key' 'Content-Type: application/json'

Once API Key has been obtained, you may use it to get access to Crypto APIs Endpoints related to blockchains and exchanges.

API Credential Usage Credits

Most plans include a daily limit or “hard stop” to the number of data calls that can be made and the results provided by Crypto APIs. This limit is tied directly to your API Key usage and number of credits purchased. Your daily credits will be re-loaded counting 24 hrs back from the initial request.

The daily credit limit is tracked based on API data calls & results provided with your key. Each credit is accounted for and incremented 1:1, with the exception of:

  1. Error responses are not included in this monthly limit.
  2. Paginated Endpoints: List based endpoints. Credit allocation per API credentials is done for every 50 data results returned, always rounded-up.
  3. Bundled/Batched API calls: Credit allocation per API credentials is done for every 50 data results returned, always rounded-up.

Standards & Conventions

This section represents used standards, conventions and object across all documents and API Endpoints, provided by Crypto APIs.

Endpoint Response Payload Format

All endpoints return results in JSON format and JSON/HTTPS binding for Ethereum based contracts, when the call is successfully executed.

Status object is always included for both successful calls and failures when possible. The Status object always includes the current time on the server when the call was executed as time-stamp, the number of API call credits this call utilized as credit count, and the number of milliseconds it took to process the request as elapsed. Any details about errors encountered can be found under the error_code and error_message.

Cryptocurrency, Exchanges and Fiat currency identifiers

All of the identifiers used are ISO compliant and used in accordance to the unique Crypto APIs ID.

  1. Cryptocurrencies may be identified using their unique exchange name (ex. Bitcoin) or through their asset ID (ex. BTC). You may get a list of all active assets from Crypto APIs by calling the endpoint /v1/assets.
  2. Exchanges supported by Crypto APIs may be identified using the unique exchange name (ex. Kraken) or through their exchange ID (ex. KRAKEN). You may get a list of all active exchange from Crypto APIs by calling the endpoint /v1/exchanges.
  3. All of the fiat currency options use the standard ISO 8601 currency codes (ex. USD for US Dollar or EUR for Euro). Unless otherwise stated, endpoints with fiat currency options support these major currency codes:
    Currency Code Currency
    AED United Arab Emirates Dirham
    ALL Albanian Lek
    ARY Peso
    ATS Authorship
    AUD Australian Dollar
    BAM Convertible Mark
    BEC Convertible Franc
    BGN Bulgarian Lev
    BHD Bahraini Dinar
    BOB Boliviano
    BOP Peso Boliviano
    BRC Cruzado
    BRE Cruzeiro
    BRL Brazilian Real
    BSD Bahamian Dollar
    BUK Burma
    CAD Canadian Dollar
    CHC WIR Franc
    CHF Swiss Franc
    CNX Peoples Bank Dollar
    CNY Yuan Renminbi
    CRC Costa Rican Colon
    CYP Cyprus Pound
    CZK Czech Koruna
    DEM Deutsche Mark
    DKK Danish Krone
    ESP Spanish Peseta
    ETB Ethiopian Birr
    EUR Euro
    GBP Pound Sterling
    GHS Ghana Cedi
    HKD Hong Kong Dollar
    HRK Croatian Kuna
    HUF Forint
    IDR Rupiah
    ILS New Israeli Sheqel
    INR Indian Rupee
    JPY Yen
    KRW Won
    LTT Talonas
    LUC Luxembourg Convertible Franc
    MAD Moroccan Dirham
    MTL Maltese Lira
    MUR Mauritius Rupee
    MVR Rufiyaa
    MXN Mexican Peso
    MYR Malaysian Ringgit
    NGN Naira
    NIC Cordoba
    NLG Netherlands Guilder
    NOK Norwegian Krone
    NZD New Zealand Dollar
    PEN Nuevo Sol
    PHP Philippine Peso
    PLN Zloty
    RON New Romanian Leu
    RUB Russian Ruble
    RUR Russian Ruble
    SBD Solomon Islands Dollar
    SDG Sudanese Pound
    SEK Swedish Krona
    SGD Singapore Dollar
    SLL Leone
    SUR Rouble
    SVC El Salvador Colon
    THB Baht
    TOP Top Coin
    TRY Turkish Lira
    TWD New Taiwan Dollar
    UAH Hryvnia
    USD US Dollar
    XAG Silver
    XAU Gold
    XBB Bond Markets Monetary Unit
    XBC Bond Markets Unit of Account 9
    XPD Petro Dollar
    XPT Platinum
    XRE Revolver Coin
    ZAR Rand

Date and Time Formats

For all required endpoints with time stamp, input and output time values used are UNIX standard based (eg. 1540220759 or translated 10/22/2018 @ 3:05pm (UTC)). If a time-zone isn’t specified, we default to UTC. All time stamps returned in JSON payloads are returned in UTC time and can be converted here for human eye readability.

The UNIX time stamp is a way to track time as a running total of seconds. This is very useful to computer systems for tracking and sorting dated information in dynamic and distributed applications both online and client side

Errors & Rate Limits

HTTPS Errors

HTTPS Errors are all request with response status code different than 200 (successful HTTP), must be considered as failure of a particular API call. You should expect additional JSON inside the body of the response with the error message encapsulated inside it as shown in the example.

We recommend, as best practice, to store all error messages somewhere along with request data for further manual review. We use the following error codes:

Error Code Description
400 (Bad Request) Something is wrong with your request, possibly due to invalid argument.
401 (Unauthorized) Lack of valid authentication credentials, your API key is wrong/invalid.
403 (Forbidden) The request was rejected due to a permission issue. Your API does not have enough privileges/credits to access this resource.
404 (No Data) You requested specific single item that we don’t have at this moment.
429 (Too Many Requests) Your API key rate limits have been exceeded.
500 (Internal Server Error) An unexpected server error was encountered, we are working on fixing this.

Rate Limits

Crypto API’s professional service is subject to API call rate limits, based on your subscription plan tier. If you are interested in custom subscription tier for higher limits, reach out to us.

If you exceed these limits, your requests will return an HTTPS Status Code 429.

The rate limits are on call per day, per hour, per minute & per second in correspondence to available credits. Your daily credits are accounted for 24 hrs from the initial call to our API-Gateway.

Error Codes

CryptoAPI responses may result with an internal error code and description.

Response Body

{
    "meta": {
        "error": {
            "code": 6001,
            "message": "Asset not found"
        }
    }
}

We use the following error codes:

General error codes
Error Code Description
1 General error: %s
16 Please provide a proper query parameter, refer to the documentation for more information
15 Password is too weak
16 Request method not supported: %s
17 Required request body is missing
18 Could not delete payment forwarding with uuid: %s
19 Wrong password
20 We are facing technical issues, please try again later
21 Transaction not found
22 Could not retrieve webhooks for this user
23 Could not delete webhook with id: %s
24 We are facing technical issues, please try again later
26 Block not found
27 We are facing technical issues, please try again later
28 Password cannot be null or empty
29 Address not found
30 Bad JSON formatting
31 Blockchain connection error: %s
32 Invalid authentication credentials
33 Invalid API Key
34 Authorization header is missing
35 Not enough privileges for the requested operation
36 We are facing technical issues, please try again later
37 We are facing technical issues, please try again later
38 Use HTTPS requests
39 Unsupported Media Type. Content-Type header should be 'application/json'.
40 Method must be one of: %s
41 URI not found. Check the documentation.
50 Wrong or missing blockchain network
60 This endpoint has not been enabled for your package plan. Please contact us if you need this or upgrade your plan.
61 Your package plan includes only % days historical data. Please contact us if you need more or upgrade your plan.
62 Insufficient credits
63 Request limit reached. Maximum %1$d requests per %2$d seconds.
200 Your request has been successfully executed.
400 Something is wrong with your request, possibly due to invalid argument.
401 Lack of valid authentication credentials, your API key is wrong/invalid.
403 The request was rejected due to a permission issue. Your API does not have enough privileges/credits to access this resource.
404 You requested specific single item that we don’t have at this moment.
429 Your API key rate limits have been exceeded.
500 An unexpected server error was encountered, we are working on fixing this.
Exchanges error codes
Error Code Description Additional info
6000 Exchange rate not found for the pair Exchange rate not found for the pair
6001 Asset not found There is no Asset that corresponds to the given name
6002 Invalid time format Timestamp value contains non-numeric symbols
6003 Exceeded limit of % records per request
6004 Unknown symbol
ETH error codes
Error Code Description Additional Info
3000 %s is not a valid Ethereum address
3001 Value is not provided
3002 Could not generate new address
3003 Could not generate new account
3004 fromAddress cannot be null or empty
3005 toAddress cannot be null or empty
3006 privateKey cannot be null or empty deploy smart contract and transaction create with privateKey
3007 There is no registry for address: %s When trying to send a tx with non-existing keystore file
3008 fromAddress cannot be equal to toAddress
3009 Sign.Signature failure
3010 There is already a registry for this address When making a payment forwarding(duplicate error)
3011 BigInt or BigDecimal conversion error when value is not a number
3012 Password is too weak... token transfer and payment forwarding
3013 signed_tx cannot be empty or null
3014 Ethereum VM errors (different messages) e.g. not enough eth; nonce error
3015 %s is not a valid Ethereum network
3016 byteCode cannot be null or empty
3017 Byte code is not in the correct format
3018 Could not sign the transaction
3019 Could not estimate gas price
3020 Could not estimate gas limit
3021 Webhook validator default messages when url or event is missing
3022 Not enough tokens
3023 Balance is not enough when sending tokens
3024 contract cannot be null or empty when sending tokens
3025 Check input data, no reference found to provided contract and fromAddress when sending tokens
3026 Invalid address or contract token balance
BTC error codes
Error Code Description
2000 Can not decode transaction
2001 Can not create transaction
2002 Can not sign transaction
2003 Can not send transaction
2004 txs must not be empty
2005 Transaction '%s' is invalid
2006 txHex must not be empty
2007 Address is not valid
2008 Block '%s' has '%d' transaction. Index '%d' out of range.
2009 Sum of input values is different then sum of output values
2010 Not enough balance in '%s' available '%.8f', but needed is '%.8f' (including fee)
2100 Field 'walletName' Error: %s
2101 addresses' contains invalid address(es): %s
2102 Wallet '%s' is Hierarchical Deterministic wallet, please check https://docs.cryptoapis.io/?http#btc-wallet-api for HD wallets
2103 Wallet '%s' is Normal wallet, please check https://docs.cryptoapis.io/?http#btc-wallet-api for Normal wallets
2104 addressCount must not be empty
2105 addressCount must be number value between 1 and 10
2106 walletName' must not be empty
2107 walletName' must be string
2108 walletName' is too long. Max size is 64 characters, actual is %d
2109 walletName' is too short. Min size is 3 characters, actual is %d
2110 Wallet '%s' already exists
2111 Field 'addresses' Error: %s
2112 addresses' must not be empty
2113 addresses' must be array
2114 addresses' contains duplicate address(es)
2115 Wallet '%s' does not exist
2116 Address '%s' can not be found in wallet '%s'
2117 password' must be string
2118 password' is too long. Max size is 64 characters, actual is %d
2119 password' is too weak. Min size is 10 characters, actual is %d
2120 Wallet can not be decrypted with this 'password'
2201 from' address must not be empty
2202 from' address must be string
2203 from' address is not valid
2204 to' address must not be empty
2205 to' address must be string
2206 to' address is not valid
2204 to' address must be different from 'from' address
2207 callback' url must not be empty
2208 callback' url must be string
2209 callback' url is not valid
2210 password' url must not be empty
2211 password' url must be string
2212 password' is too long. Max size is 64 characters, actual is %d
2213 password' is too weak. Min size is 10 characters, actual is %d
2214 wallet' name must not be empty
2215 wallet' name must be string
2216 wallet' name is too long. Max size is 64 characters, actual is %d
2217 wallet' name is too short. Min size is 3 characters, actual is %d
2217 wallet' can not be decrypted with this 'password'
2218 Payment Forwarding from address '%s' already created
2219 Address '%s' can not be found in wallet '%s'
2217 Payment Forwarding not found
2301 event' address must not be empty
2302 event' should be UNCONFIRMED_TX, NEW_BLOCK, CONFIRMED_TX or ADDRESS
2303 address' must not be empty
2304 address' must be string
2305 address' is not valid
2306 confirmations' must not be empty
2307 confirmations' must be number value between 1 and 100
2308 confirmations' is not valid
2309 transaction' must not be empty
2310 transaction' size must be exactly 64 characters
2311 transaction' is not valid
2312 url' must not be empty
2313 url' must be string
2314 url' is not valid
BCH error codes
Error Code Description
4000 Can not decode transaction
4001 Can not create transaction
4002 Can not sign transaction
4003 Can not send transaction
4004 txs must not be empty
4005 Transaction '%s' is invalid
4006 txHex must not be empty
4007 Address is not valid
4008 Block '%s' has '%d' transaction. Index '%d' out of range.
4009 Sum of input values is different then sum of output values
4010 Not enough balance in '%s' available '%.8f', but needed is '%.8f' (including fee)
4100 Field 'walletName' Error: %s
4101 addresses' contains invalid address(es): %s
4102 Wallet '%s' is Hierarchical Deterministic wallet, please check https://docs.cryptoapis.io/?http#bch-wallet-api for HD wallets
4103 Wallet '%s' is Normal wallet, please check https://docs.cryptoapis.io/?http#bch-wallet-api for Normal wallets
4104 addressCount must not be empty
4105 addressCount must be number value between 1 and 10
4106 walletName' must not be empty
4107 walletName' must be string
4108 walletName' is too long. Max size is 64 characters, actual is %d
4109 walletName' is too short. Min size is 3 characters, actual is %d
4110 Wallet '%s' already exists
4111 Field 'addresses' Error: %s
4112 addresses' must not be empty
4113 addresses' must be array
4114 addresses' contains duplicate address(es)
4115 Wallet '%s' does not exist
4116 Address '%s' can not be found in wallet '%s'
4117 password' must be string
4118 password' is too long. Max size is 64 characters, actual is %d
4119 password' is too weak. Min size is 10 characters, actual is %d
4120 Wallet can not be decrypted with this 'password'
4201 from' address must not be empty
4202 from' address must be string
4203 from' address is not valid
4204 to' address must not be empty
4205 to' address must be string
4206 to' address is not valid
4204 to' address must be different from 'from' address
4207 callback' url must not be empty
4208 callback' url must be string
4209 callback' url is not valid
4210 password' url must not be empty
4211 password' url must be string
4212 password' is too long. Max size is 64 characters, actual is %d
4213 password' is too weak. Min size is 10 characters, actual is %d
4214 wallet' name must not be empty
4215 wallet' name must be string
4216 wallet' name is too long. Max size is 64 characters, actual is %d
4217 wallet' name is too short. Min size is 3 characters, actual is %d
4217 wallet' can not be decrypted with this 'password'
4218 Payment Forwarding from address '%s' already created
4219 Address '%s' can not be found in wallet '%s'
4217 Payment Forwarding not found
4301 event' address must not be empty
4302 event' should be UNCONFIRMED_TX, NEW_BLOCK, CONFIRMED_TX or ADDRESS
4303 address' must not be empty
4304 address' must be string
4305 address' is not valid
4306 confirmations' must not be empty
4307 confirmations' must be number value between 1 and 100
4308 confirmations' is not valid
4309 transaction' must not be empty
4310 transaction' size must be exactly 64 characters
4311 transaction' is not valid
4312 url' must not be empty
4313 url' must be string
4314 url' is not valid
LTC error codes
Error Code Description
5000 Can not decode transaction
5001 Can not create transaction
5002 Can not sign transaction
5003 Can not send transaction
5004 txs must not be empty
5005 Transaction '%s' is invalid
5006 txHex must not be empty
5007 Address is not valid
5008 Block '%s' has '%d' transaction. Index '%d' out of range.
5009 Sum of input values is different then sum of output values
5010 Not enough balance in '%s' available '%.8f', but needed is '%.8f' (including fee)
5100 Field 'walletName' Error: %s
5101 addresses' contains invalid address(es): %s
5102 Wallet '%s' is Hierarchical Deterministic wallet, please check https://docs.cryptoapis.io/?http#ltc-wallet-api for HD wallets
5103 Wallet '%s' is Normal wallet, please check https://docs.cryptoapis.io/?http#ltc-wallet-api for Normal wallets
5104 addressCount must not be empty
5105 addressCount must be number value between 1 and 10
5106 walletName' must not be empty
5107 walletName' must be string
5108 walletName' is too long. Max size is 64 characters, actual is %d
5109 walletName' is too short. Min size is 3 characters, actual is %d
5110 Wallet '%s' already exists
5111 Field 'addresses' Error: %s
5112 addresses' must not be empty
5113 addresses' must be array
5114 addresses' contains duplicate address(es)
5115 Wallet '%s' does not exist
5116 Address '%s' can not be found in wallet '%s'
5117 password' must be string
5118 password' is too long. Max size is 64 characters, actual is %d
5119 password' is too weak. Min size is 10 characters, actual is %d
5120 Wallet can not be decrypted with this 'password'
5201 from' address must not be empty
5202 from' address must be string
5203 from' address is not valid
5204 to' address must not be empty
5205 to' address must be string
5206 to' address is not valid
5204 to' address must be different from 'from' address
5207 callback' url must not be empty
5208 callback' url must be string
5209 callback' url is not valid
5210 password' url must not be empty
5211 password' url must be string
5212 password' is too long. Max size is 64 characters, actual is %d
5213 password' is too weak. Min size is 10 characters, actual is %d
5214 wallet' name must not be empty
5215 wallet' name must be string
5216 wallet' name is too long. Max size is 64 characters, actual is %d
5217 wallet' name is too short. Min size is 3 characters, actual is %d
5217 wallet' can not be decrypted with this 'password'
5218 Payment Forwarding from address '%s' already created
5219 Address '%s' can not be found in wallet '%s'
5217 Payment Forwarding not found
5301 event' address must not be empty
5302 event' should be UNCONFIRMED_TX, NEW_BLOCK, CONFIRMED_TX or ADDRESS
5303 address' must not be empty
5304 address' must be string
5305 address' is not valid
5306 confirmations' must not be empty
5307 confirmations' must be number value between 1 and 100
5308 confirmations' is not valid
5309 transaction' must not be empty
5310 transaction' size must be exactly 64 characters
5311 transaction' is not valid
5312 url' must not be empty
5313 url' must be string
5314 url' is not valid

Endpoint Overview

Our professional API is divided into several main categories:

Category Description
Exchanges Endpoint call, which will return market data from crypto exchanges. For example, exchanges lists, trades & quotes details, exchange rates and market pair data.
Blockchains Endpoints that return data around cryptocurrencies, such as general information for the blockchain, transactions & addresses.

Crypto APIs provides a unique product for all its clients by unifying, as much as possible, the most common blockchain endpoint functionalities. We have made two mandatory parameters, which can be dynamic per blockchain: COIN & NETWORK.

The power of the product is exactly this a unified common path, where all you have to do is change the coin value and the network, so that you get the requested information from the blockchain. Visit our Blockchain--> Common section for details.

REST APIs

Crypto Market Data APIs

Crypto APIs provides a wide range of data driven API endpoints from 100+ exchange, which will allow you to get access to information in a Request – Reply Scheme or Subscribe – Publish communication model. You will be able to get information about current, latest & historical data, plus exchange rates.

Metadata

In this section, you will be able to get information about the exchanges supported by Crypto APIs.

List All Exchanges

Code samples


curl -X GET \
  'https://api.cryptoapis.io/v1/exchanges' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/exchanges HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/exchanges').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/exchanges",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/exchanges');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/exchanges")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/exchanges'
headers = {
  'Content-Type' : 'application/json',
  'X-API-Key' : 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/exchanges")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/exchanges")
}

Response Body

{
    "meta": {
        "totalCount": 100,
        "index": 0,
        "limit": 50,
        "results": 50
    },
    "payload": [
        {
            "exchangeId": "BITTREX",
            "name": "Bittrex",
            "website": "https://bittrex.com/",
            "_id": "5b4366dab98b280001540e16"
        },
        ....
        {
            "exchangeId": "BITFINEX",
            "name": "Bitfinex",
            "website": "https://www.bitfinex.com/",
            "_id": "5b4366dab98b280001540e18"
        }
    ]
}

Get a detailed list of all supported exchanges provided by our system.

HTTP Request

GET /v1/exchanges?skip={skip}&limit={limit}

URL Parameters
Variable Type Description
skip int The offset of items to start from. Useful for paginations. (e.g. skip=100 would show results from 101 item to 150)
limit int Amount of items to return (optional, default value is 50)
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria
Output Variables
Variable HTTP Request
_id Unique exchange identification string (UID)
exchangeId Our exchange identifier
website Exchange website address
name Display name of the exchange

List All Assets

Code samples


curl -X GET \
  'https://api.cryptoapis.io/v1/assets' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/assets HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/assets').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/assets",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/assets');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/assets")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/assets'
headers = {
  'Content-Type' : 'application/json',
  'X-API-Key' : 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/assets")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/assets")
}

Response Body

{
    "meta": {
        "totalCount": 100,
        "index": 0,
        "limit": 50,
        "results": 50
    },
    "payload": [
        {
            "assetId": "ETH",
            "originalSymbol": "ETH",
            "name": "Ethereum",
            "slug": "ethereum",
            "cryptoType": true,
            "supply": 103337722,
            "marketCap": 13895051350,
            "price": 134.46,
            "volume": 2871630447,
            "change": -3.37,
            "_id": "5b4366f596e7a1000166b3d4"
        },
        ....
        {
            "assetId": "USD",
            "originalSymbol": "USD",
            "name": "US Dollar",
            "cryptoType": false,
            "_id": "5b4366f596e7a1000166b3d5"
        }
    ]
}

Get detailed list of all associated assets.

HTTP Request

GET /v1/assets?skip={skip}&limit={limit}

URL Parameters
Variable Type Description
skip int The offset of items to start from. Useful for paginations. (e.g. skip=100 would show results from 101 item to 150)
limit int Amount of items to return (optional, default value is 50)
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria
Output Variables
Endpoint Name HTTP Request
_id Unique asset identification string (UID)
assetid Our asset identifier
name Display name of the asset
cryptoType Boolean value transported as integer; True for cryptocurrency assets, False otherwise.
originalSymbol Original asset name as listed originally by creator / issuer
slug lowercase and without whitespaces representation of the name of the asset
supply approximate total amount of coins in existence right now. Applicable only for currencies of type crypto
marketCap market capitalization in USD. Applicable only for currencies of type crypto
price latest weighted average trade price across markets in USD. Applicable only for currencies of type crypto
volume 24 hour trading volume in USD. Applicable only for currencies of type crypto
change 24 hour trading price percentage change. Applicable only for currencies of type crypto

List all symbols

Code samples


curl -X GET \
   'https://api.cryptoapis.io/v1/mappings' \
  -H 'Content-Type: authorization/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/mappings HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/mappings').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/mappings",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/mappings');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/mappings")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/mappings'
headers = {
  'Content-Type' : 'application/json',
  'X-API-Key' : 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/mappings")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeadeer("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/mappings")
}

Response Body

{
    "meta": {
        "totalCount": 100,
        "index": 0,
        "limit": 50,
        "results": 50
    },
    "payload": [
        {
            "exchangeId": "5b4366dab98b280001540e53",
            "exchangeSymbol": "ETH-EUR",
            "baseAsset": "5b4366f596e7a1000166b3d7",
            "quoteAsset": "5b4366f596e7a1000166b3d5",
            "tradeType": "SPOT",
            "_id": "5bfc325c9c40a100014db8ff"
        },
        ....
        {
            "exchangeId": "5b4366dab98b280001540e53",
            "exchangeSymbol": "BTG-PLN",
            "baseAsset": "5b4366f596e7a1000166b3f8",
            "quoteAsset": "5b4366f596e7a1000166b46d",
            "tradeType": "SPOT",
            "_id": "5b45b055401814000123ebf8"
        }
    ]
}

Get a detailed list of all symbol mappings.

HTTP Request

GET /v1/mappings?skip={skip}&limit={limit}

URL Parameters
Variable Type Description
skip int The offset of items to start from. Useful for paginations. (e.g. skip=100 would show results from 101 item to 150)
limit int Amount of items to return (optional, default value is 50)
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria
Output Variables
Variables Description
_id Unique symbol identification string (UID)
exchangeSymbol Our symbol identifier, see table below for format description.
exchangeId Our identifier (UID) of the exchange where symbol is traded.
tradeType Type of symbol (possible values are: SPOT, FUTURES or OPTION)
baseAsset FX Spot base asset identifier (UID), for derivatives it’s contact underlying (e.g. BTC for BTC/USD)
quoteAsset FX Spot quote asset identifier (UID), for derivatives it’s contract underlying (e.g. USD for BTC/USD)
Trade Type Details
Type Name Description
SPOT FX Spot Agreement to exchange one asset for another one (e.g. Buy BTC for USD)
FUTURES Futures contract FX Spot derivative contract where traders agree to trade fx spot at predetermined future time
OPTION Option contract FX Spot derivative contract where traders agree to trade right to require buy or sell of fx spot at agreed price on exercise date

Exchange Rates

Crypto APIs provides an API to help you professionally convert currencies, simply any business model. All of our exchange rates are calculated based on a 5 min. intervals.

Get Specific Rate

Code samples


curl -X GET \
  'https://api.cryptoapis.io/v1/exchange-rates/USD/BTC' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/exchange-rates/USD/BTC HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" , 
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/exchange-rates/USD/BTC').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/exchange-rates/USD/BTC",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/exchange-rates/USD/BTC');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/exchange-rates/USD/BTC")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/exchange-rates/USD/BTC'
headers = {
  'Content-Type' : 'application/json',
  'X-API-Key' : 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/exchange-rates/USD/BTC")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/exchange-rates/USD/BTC")
}

Response Body

{
    "payload": {
        "weightedAveragePrice": 0.00025199385136389241,
        "medianPrice": 0.00024906102275700436,
        "weightedMedianAveragePrice": 0,
        "timestamp": 1543839205,
        "baseAsset": "USD",
        "quoteAsset": "BTC"
    }
}

Get exchange rates between pair of requested assets pointing at a specific or current time.

HTTP Request

GET /v1/exchange-rates/{baseAssetId}/{quoteAssetId}?timestamp={timestamp}

URL Parameters
Variable Type Description
baseAssetId string FX Spot base asset identifier (UID), for derivatives it’s contact underlying (e.g. BTC for BTC/USD)
quoteAssetId string FX Spot quote asset identifier (UID), for derivatives it’s contract underlying (e.g. USD for BTC/USD)
timestamp int Time (in UNIX Timestamp) of the market data used to calculate exchange rate. Optional. Default value is current time.
Output Variables
Variables Description
baseAsset FX Spot base asset identifier, for derivatives it’s contact underlying (e.g. BTC for BTC/USD)
quoteAsset FX Spot quote asset identifier, for derivatives it’s contract underlying (e.g. USD for BTC/USD)
timestamp Time (in UNIX Timestamp) of the market data used to calculate exchange rate
weightedAveragePrice Exchange rate between assets calculated by weighted average of the last trades in every exchange for the last 24 hours by giving more weight to exchanges with higher volume
medianPrice Exchange rate between assets calculated by median of the last trades in every exchange for the last 24 hours
weightedMedianAveragePrice Exchange rate between assets calculated by median of the last trades in every exchange for the last 24 hours by giving more weight to exchanges with higher volume. Range of the prices is being adjusted by calculating percentage of wrong (extremely low or extremely high) prices

Get All Current Rates

Code samples


curl -X GET \
  'https://api.cryptoapis.io/v1/exchange-rates/USD' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/exchange-rates/USD HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" , 
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/exchange-rates/USD').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/exchange-rates/USD",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/exchange-rates/USD');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/exchange-rates/USD")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/exchange-rates/USD'
headers = {
  'Content-Type' : 'application/json',
  'X-API-Key' : 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/exchange-rates/USD")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/exchange-rates/USD")
}

Response Body

{
    "meta": {
        "totalCount": 34,
        "index": 0,
        "limit": 50,
        "results": 34
    },
    "payload": [
        {
            "baseAsset": "USD",
            "quoteAsset": "BTC",
            "medianPrice": 0.00024971208719927192,
            "weightedAveragePrice": 0.00025063981680473099,
            "weightedMedianAveragePrice": 0,
            "timestamp": 1543839501
        },
        ....
        {
            "baseAsset": "USD",
            "quoteAsset": "CNY",
            "price": 6.8903065749863579,
            "weightedAveragePrice": 6.8903065749863579,
            "weightedMedianAveragePrice": 0,
            "timestamp": 1543839501
        },
    ]
}

Get the current exchange rate between requested asset and all other assets.

HTTP Request

GET /v1/exchange-rates/{baseAssetId}?timestamp={timestamp}&skip={skip}&limit={limit}

URL Parameters
Variable Type Description
baseAssetId string FX Spot base asset identifier (UID), for derivatives it’s contact underlying (e.g. BTC for BTC/*)
timestamp int Time (in UNIX Timestamp) of the market data used to calculate exchange rate. Optional. Default value is current time.
skip int The offset of items to start from. Useful for paginations. (e.g. skip=100 would show results from 101 item to 150)
limit int Amount of items to return (optional, default value is 50)
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria
Output Variables
Variables Description
baseAsset FX Spot base asset identifier, for derivatives it’s contact underlying (e.g. BTC for BTC/USD)
quoteAsset FX Spot quote asset identifier, for derivatives it’s contract underlying (e.g. USD for BTC/USD)
timestamp Time (in UNIX Timestamp) of the market data used to calculate exchange rate
weightedAveragePrice Exchange rate between assets calculated by weighted average of the last trades in every exchange for the last 24 hours by giving more weight to exchanges with higher volume
medianPrice Exchange rate between assets calculated by median of the last trades in every exchange for the last 24 hours
weightedMedianAveragePrice Exchange rate between assets calculated by median of the last trades in every exchange for the last 24 hours by giving more weight to exchanges with higher volume. Range of the prices is being adjusted by calculating percentage of wrong (extremely low or extremely high) prices

OHLCV

The information provided from the API calls are related to downloading OHLCV (Open, High, Low, Close, Volume) time-series data. Each data point, within the particular time range, of this time-series represents several indicators calculated from transactions activity.

List all Periods

Code samples


curl -X GET \
  'https://api.cryptoapis.io/v1/ohlcv/periods' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/ohlcv/periods HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/ohlcv/periods').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/ohlcv/periods",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/ohlcv/periods');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/ohlcv/periods")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/ohlcv/periods'
headers = {
  'Content-Type' : 'application/json',
  'X-API-Key' : 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/ohlcv/periods")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/ohlcv/periods")
}

Response Body

{
    "meta": {
        "totalCount": 100,
        "index": 0,
        "limit": 50,
        "results": 50
    },
    "payload": [
        {
            "period": "1sec",
            "lengthInSeconds": 1,
            "lengthInMonths": null,
            "unitCount": 1,
            "unitName": "second",
            "displayName": "1 Second"
        },
        ....
        {
            "period": "6hrs",
            "lengthInSeconds": 21600,
            "lengthInMonths": null,
            "unitCount": 6,
            "unitName": "hour",
            "displayName": "6 Hours"
        }
    ]
}

Get full list of, supported by us, time periods available for requesting OHLCV data.

HTTP Request

GET /v1/ohlcv/periods

Available Time-series periods
Time Series Period Identifier
Second 1sec, 2sec, 3sec, 4sec, 5sec, 6sec, 10sec, 15sec, 20sec, 30sec
Minute 1min, 2min, 3min, 4min, 5min, 6min, 10min, 15min, 20min, 30min
Hour 1hrs, 2hrs, 3hrs, 4hrs, 6hrs, 8hrs, 12hrs
Day 1day, 2day, 3day, 5day, 7day, 10day
Month 1mth, 2mth, 3mth, 4mth, 6mth
Year 1yrs, 2yrs, 3yrs, 4yrs, 5yrs
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria
Output Variables
Variables Description
period Period Identifier used by Crypto APIs
lengthInSeconds Seconds part of period length
lengthInMonths Months part of period length
unitCount Period length in units
unitName Type of time-series used (second/minute/hour/day/year)
displayName Display name of period length

Latest Data

Code samples


curl -X GET \
  'https://api.cryptoapis.io/v1/ohlcv/latest/5b3a4d323d8cea0001653bb0?period=1day' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/ohlcv/latest/5b3a4d323d8cea0001653bb0?period=1day HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/ohlcv/latest/5b3a4d323d8cea0001653bb0?period=1day').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/ohlcv/latest/5b3a4d323d8cea0001653bb0?period=1day",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/ohlcv/latest/5b3a4d323d8cea0001653bb0?period=1day');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/ohlcv/latest/5b3a4d323d8cea0001653bb0?period=1day")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/ohlcv/latest/5b3a4d323d8cea0001653bb0?period=1day'
headers = {
  'Content-Type': 'application/json',
  'X-API-Key': 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/ohlcv/latest/5b3a4d323d8cea0001653bb0?period=1day")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/ohlcv/latest/5b3a4d323d8cea0001653bb0?period=1day")
}

Response Body

{
    "meta": {
        "totalCount": 35,
        "index": 0,
        "limit": 50,
        "results": 35
    },
    "payload": [
        {
            "exchange": "5b1ea9d21090c200146f7362",
            "eventType": "SPOT",
            "assetBase": "5b1ea92e584bf50020130621",
            "assetQuote": "5b1ea92e584bf50020130614",
            "timePeriodStart": 1534204800,
            "timePeriodEnd": 1534291200,
            "timeOpen": 1534204814,
            "timeClose": 1534250116,
            "priceOpen": 0.016135,
            "priceClose": 0.016392,
            "priceLow": 0.015909,
            "priceHigh": 0.016754999999999999,
            "volumeTraded": 376888.24000000011,
            "tradesCount": 8948,
            "_id": "5b754a7c0e23de00017958fd"
        },
        ....
        {
            "exchange": "5b1ea9d21090c200146f7362",
            "eventType": "SPOT",
            "assetBase": "5b1ea92e584bf50020130621",
            "assetQuote": "5b1ea92e584bf50020130614",
            "timePeriodStart": 1468800,
            "timePeriodEnd": 1555200,
            "timeOpen": 1533307,
            "timeClose": 1534147,
            "priceOpen": 0.017266,
            "priceClose": 0.015892,
            "priceLow": 0.014929,
            "priceHigh": 0.017687000000000001,
            "volumeTraded": 2858646.7699999646,
            "tradesCount": 80412,
            "_id": "5b6469df1cc71c0001468414"
        }
    ]
}

Get OHLCV latest time-series data for requested symbol and period, returned in time descending order.

HTTP Request

GET /v1/ohlcv/latest/{symbol_id}?period={period_id}&limit={limit}

URL Parameters
Variable Type Description
symbol_id string Symbol identifier (UID) used to filter response. (required)
period_id string Identifier of requested time period (required, e.g. 1hrs, 2mth etc.) (required)
limit int Amount of items to return (optional, default value is 50)
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria
Output Variables
Variables Description
exchange Our identifier (UID) of the exchange where symbol is traded.
eventType Type of symbol (possible values are: SPOT, FUTURES or OPTION)
assetBase FX Spot base asset identifier (UID), for derivatives it’s contact underlying (e.g. BTC for BTC/USD)
assetQuote FX Spot quote asset identifier (UID), for derivatives it’s contract underlying (e.g. USD for BTC/USD)
timePeriodStart Period starting time (range left inclusive)
timePeriodEnd Period ending time (range right exclusive)
timeOpen Time of first trade inside period range
timeClose Time of last trade inside period range
priceOpen First trade price inside period range
priceClose Last trade price inside period range
priceLow Lowest traded price inside period range
priceHigh Highest traded price inside period range
volumeTraded Cumulative base amount traded inside period range
tradesCount Amount of trades executed inside period range
_id Unique exchange identification string (UID)

Historical Data

Code samples


curl -X GET \
  'https://api.cryptoapis.io/v1/ohlcv/history/5b3a4d323d8cea0001653bb0?period=1day&timePeriodStart=1530000000&timePeriodEnd=1540876000' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/ohlcv/history/5b3a4d323d8cea0001653bb0?period=1day&timePeriodStart=1530000000&timePeriodEnd=1540876000 HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/ohlcv/history/5b3a4d323d8cea0001653bb0?period=1day&timePeriodStart=1530000000&timePeriodEnd=1540876000').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/ohlcv/history/5b3a4d323d8cea0001653bb0?period=1day&timePeriodStart=1530000000&timePeriodEnd=1540876000",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/ohlcv/history/5b3a4d323d8cea0001653bb0?period=1day&timePeriodStart=1530000000&timePeriodEnd=1540876000');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/ohlcv/history/5b3a4d323d8cea0001653bb0?period=1day&timePeriodStart=1530000000&timePeriodEnd=1540876000")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["Authorizaion"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/ohlcv/history/5b3a4d323d8cea0001653bb0?period=1day&timePeriodStart=1530000000&timePeriodEnd=1540876000'
headers = {
  'Content-Type': 'application/json',
  'X-API-Key': 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/ohlcv/history/5b3a4d323d8cea0001653bb0?period=1day&timePeriodStart=1530000000&timePeriodEnd=1540876000")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/ohlcv/history/5b3a4d323d8cea0001653bb0?period=1day&timePeriodStart=1530000000&timePeriodEnd=1540876000")
}

Response Body

{
    "meta": {
        "totalCount": 34,
        "index": 0,
        "limit": 50,
        "results": 34
    },
    "payload": [
        {
            "exchange": "5b1ea9d21090c200146f7362",
            "eventType": "SPOT",
            "assetBase": "5b1ea92e584bf50020130621",
            "assetQuote": "5b1ea92e584bf50020130614",
            "timePeriodStart": 1530489600,
            "timePeriodEnd": 1530576000,
            "timeOpen": 1530549336,
            "timeClose": 1530575925,
            "priceOpen": 0.018759000000000001,
            "priceClose": 0.018835999999999999,
            "priceLow": 0.018678,
            "priceHigh": 0.019154000000000001,
            "volumeTraded": 82432.489999999962,
            "tradesCount": 6245,
            "_id": "5b5b0aae188299000123db17"
        },
        ....
        {
            "exchange": "5b1ea9d21090c200146f7362",
            "eventType": "SPOT",
            "assetBase": "5b1ea92e584bf50020130621",
            "assetQuote": "5b1ea92e584bf50020130614",
            "timePeriodStart": 1534204800,
            "timePeriodEnd": 1534291200,
            "timeOpen": 1534204814,
            "timeClose": 1534250116,
            "priceOpen": 0.016135,
            "priceClose": 0.016392,
            "priceLow": 0.015909,
            "priceHigh": 0.016754999999999999,
            "volumeTraded": 376888.24000000011,
            "tradesCount": 8948,
            "_id": "5b754a7c0e23de00017958fd"
        }
    ]
}

Get OHLCV time-series data for requested symbol and period, returned in time ascending order.

HTTP Request

GET /v1/ohlcv/history/{symbol_id}?period={period_id}&timePeriodStart={time_start}&timePeriodEnd={time_end}&skip={skip}&limit={limit}

URL Parameters
Variable Type Description
symbol_id string Symbol identifier (UID) used to filter response. (required)
period_id string Identifier of requested time period (required, e.g. 1hrs, 2mth etc.) (required)
time_start timestamp Time period starting time in timestamp (required)
time_end timestamp Time period ending time in timestamp (optional, if not supplied then the data is returned to the end or when count of result elements reaches the limit)
skip int The offset of items to start from. Useful for paginations. (e.g. skip=100 would show results from 101 item to 150)
limit int Amount of items to return (optional, default value is 50)
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria
Output Variables
Variables Description
exchange Our identifier (UID) of the exchange where symbol is traded.
eventType Type of symbol (possible values are: SPOT, FUTURES or OPTION)
assetBase FX Spot base asset identifier (UID), for derivatives it’s contact underlying (e.g. BTC for BTC/USD)
assetQuote FX Spot quote asset identifier (UID), for derivatives it’s contract underlying (e.g. USD for BTC/USD)
timePeriodStart Period starting time (range left inclusive)
timePeriodEnd Period ending time (range right exclusive)
timeOpen Time of first trade inside period range
timeClose Time of last trade inside period range
priceOpen First trade price inside period range
priceClose Last trade price inside period range
priceLow Lowest traded price inside period range
priceHigh Highest traded price inside period range
volumeTraded Cumulative base amount traded inside period range
tradesCount Amount of trades executed inside period range
_id Unique exchange identification string (UID)

Trades

In this section, you will be able to get information about transaction data.

Output Varibles
Variable Description
exchangeId Our identifier (UID) of the exchange where symbol is traded.
tradeType Type of symbol (possible values are: SPOT, FUTURES or OPTION)
exchangeSequenceId Sequence number per pair (type, exchangeId) which is valid only for the lifespan of the connection.
eventTime Time of trade reported by exchange
baseAsset FX Spot base asset identifier (UID), for derivatives it’s contact underlying (e.g. BTC for BTC/USD)
quoteAsset FX Spot quote asset identifier (UID), for derivatives it’s contract underlying (e.g. USD for BTC/USD)
price Price of the transaction
amount Base asset amount traded in the transaction
direction Aggressor side of the transaction (BUY/SELL/BUY_ESTIMATED/SELL_ESTIMATED/UNKNOWN)
Direction of the transaction Description
Buy Exchange has reported that transaction aggressor was buying
Sell Exchange has reported that transaction aggressor was selling
Buy_Estimated Exchange has not reported transaction aggressor, we estimated that more likely it was buying
Sell_Estimated Exchange has not reported transaction aggressor, we estimated that more likely it was selling
Unknown Exchange has not reported transaction aggressor and we have not estimated who it was

Latest Data

Code samples


curl -X GET \
  'https://api.cryptoapis.io/v1/trades/latest' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/trades/latest HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/trades/latest').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/trades/latest",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/trades/latest');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/trades/latest")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/trades/latest'
headers = {
  'Content-Type': 'application/json',
  'X-API-Key': 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/trades/latest")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/trades/latest")
}

Response Body

{
    "meta": {
        "totalCount": 1813,
        "index": 0,
        "limit": 50,
        "results": 50
    },
    "payload": [
        {
            "exchangeId": "5b1ea8278111cc0001206314",
            "baseAsset": "5b1e9de8cf19ad00016095e2",
            "quoteAsset": "5b1e9de8cf19ad00016095e5",
            "eventTime": 1532955177,
            "exchangeSequenceId": "35209977",
            "tradeType": "SPOT",
            "price": 8168.9910900000004,
            "amount": 0.00089999999999999998,
            "direction": "SELL"
        },
        ....
        {
            "exchangeId": "5b1ea8278111cc00012062d8",
            "baseAsset": "5b1e9de9cf19ad0001609613",
            "quoteAsset": "5b1e9de8cf19ad00016095e3",
            "eventTime": 1532446280685,
            "exchangeSequenceId": "272319805",
            "tradeType": "SPOT",
            "price": 0.0013412999999999999,
            "amount": 52.420000000000002,
            "direction": "SELL"
        }
    ]
}

Get latest trades from all symbols up to 1 hour ago. Latest data is always returned in time descending order.

HTTP Request

GET /v1/trades/latest?limit={limit}

URL Parameters
Variable Type Description
limit int Amount of items to return (optional, default value is 50)
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria
Output Variables
Variables Description
exchangeId Our identifier (UID) of the exchange where symbol is traded.
tradeType Type of symbol (possible values are: SPOT, FUTURES or OPTION)
exchangeSequenceId Sequence number per pair (type, exchangeId) which is valid only for the lifespan of the connection.
eventTime Time of trade reported by exchange
baseAsset FX Spot base asset identifier (UID), for derivatives it’s contact underlying (e.g. BTC for BTC/USD)
quoteAsset FX Spot quote asset identifier (UID), for derivatives it’s contract underlying (e.g. USD for BTC/USD)
price Price of the transaction
amount Base asset amount traded in the transaction
direction Aggressor side of the transaction (BUY/SELL/BUY_ESTIMATED/SELL_ESTIMATED/UNKNOWN)

Latest Data by symbol

Code samples


curl -X GET \
  'https://api.cryptoapis.io/v1/trades/5b45b055401814000123ebf7/latest' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/trades/5b45b055401814000123ebf7/latest HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/trades/5b45b055401814000123ebf7/latest').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/trades/5bfc32a29c40a100014dc5f6/latest",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/trades/5bfc32a29c40a100014dc5f6/latest');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/trades/5bfc32a29c40a100014dc5f6/latest")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/trades/5bfc32a29c40a100014dc5f6/latest'
headers = {
  'Content-Type': 'application/json',
  'X-API-Key': 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/trades/5bfc32a29c40a100014dc5f6/latest")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/trades/5bfc32a29c40a100014dc5f6/latest")
}

Response Body

{
    "meta": {
        "totalCount": 15168,
        "index": 0,
        "limit": 50,
        "results": 50
    },
    "payload": [
        {
            "exchangeId": "5b1ea8278111cc0001206314",
            "baseAsset": "5b1e9de8cf19ad00016095e2",
            "quoteAsset": "5b1e9de8cf19ad00016095e5",
            "eventTime": 1532955177,
            "exchangeSequenceId": "35209977",
            "tradeType": "SPOT",
            "price": 8168.9910900000004,
            "amount": 0.00089999999999999998,
            "direction": "SELL"
        },
        ....
        {
            "exchangeId": "5b1ea8278111cc0001206314",
            "baseAsset": "5b1e9de8cf19ad00016095e2",
            "quoteAsset": "5b1e9de8cf19ad00016095e5",
            "eventTime": 1532446280685,
            "exchangeSequenceId": "272319805",
            "tradeType": "SPOT",
            "price": 0.0013412999999999999,
            "amount": 52.420000000000002,
            "direction": "SELL"
        }
    ]
}

Get latest trades from a specific symbol up to 1 hour ago. Latest data is always returned in time descending order.

HTTP Request

GET /v1/trades/{symbol_id}/latest?skip={skip}&limit={limit}

Symbol Parameters
Parameter Type Description
symbol_id string Symbol identifier used to filter response. (_id attribute from symbols endpoint)
URL Parameters
Variable Type Description
skip int The offset of items to start from. Useful for paginations. (e.g. skip=100 would show results from 101 item to 150)
limit int Amount of items to return (optional, default value is 50)
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria
Output Variables
Variables Description
exchangeId Our identifier (UID) of the exchange where symbol is traded.
tradeType Type of symbol (possible values are: SPOT, FUTURES or OPTION)
exchangeSequenceId Sequence number per pair (type, exchangeId) which is valid only for the lifespan of the connection.
eventTime Time of trade reported by exchange
baseAsset FX Spot base asset identifier (UID), for derivatives it’s contact underlying (e.g. BTC for BTC/USD)
quoteAsset FX Spot quote asset identifier (UID), for derivatives it’s contract underlying (e.g. USD for BTC/USD)
price Price of the transaction
amount Base asset amount traded in the transaction
direction Aggressor side of the transaction (BUY/SELL/BUY_ESTIMATED/SELL_ESTIMATED/UNKNOWN)

Historical Data

Code samples


curl -X GET \
  'https://api.cryptoapis.io/v1/trades/5b3a4d2a3d8cea0001653b91/history?timeStart=1526000000&timeEnd=1526593672000' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/trades/5b3a4d2a3d8cea0001653b91/history?timeStart=1526000000&timeEnd=1526593672000 HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/trades/5b3a4d2a3d8cea0001653b91/history?timeStart=1526000000&timeEnd=1526593672000').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/trades/5b3a4d2a3d8cea0001653b91/history?timeStart=1526000000&timeEnd=1526593672000",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/trades/5b3a4d2a3d8cea0001653b91/history?timeStart=1526000000&timeEnd=1526593672000');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/trades/5b3a4d2a3d8cea0001653b91/history?timeStart=1526000000&timeEnd=1526593672000")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/trades/5b3a4d2a3d8cea0001653b91/history?timeStart=1526000000&timeEnd=1526593672000'
headers = {
  'Content-Type': 'application/json',
  'X-API-Key': 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/trades/5b3a4d2a3d8cea0001653b91/history?timeStart=1526000000&timeEnd=1526593672000")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/trades/5b3a4d2a3d8cea0001653b91/history?timeStart=1526000000&timeEnd=1526593672000")
}

Response Body

{
    "meta": {
        "totalCount": 166419,
        "index": 0,
        "limit": 50,
        "results": 50
    },
    "payload": [
        {
            "exchangeId": "5b1ea9d21090c200146f73a5",
            "exchangeSequenceId": "2068932",
            "eventTime": 1526593672000,
            "baseAsset": "5b1ea92e584bf50020130696",
            "quoteAsset": "5b1ea92e584bf50020130612",
            "price": 0.00010399999999999999,
            "amount": 9.4859000099999999,
            "direction": "BUY",
            "tradeType": "SPOT"
        },
        ....
        {
            "exchangeId": "5b1ea9d21090c200146f73a5",
            "exchangeSequenceId": "2068932",
            "eventTime": 1526593672000,
            "baseAsset": "5b1ea92e584bf50020130696",
            "quoteAsset": "5b1ea92e584bf50020130612",
            "price": 0.00010399999999999999,
            "amount": 9.4859000099999999,
            "direction": "BUY",
            "tradeType": "SPOT"
        }
    ]
}

Get history transactions from specific symbol, returned in time ascending order. If no start & end time is defined when calling the endpoint, your data results will be provided 24 hours back, by default.

HTTP Request

GET /v1/trades/{symbol_id}/history?timeStart={time_start}&timeEnd={time_end}&skip={skip}&limit={limit}

Symbol Parameters
Parameter Type Description
symbol_id string Symbol identifier used to filter response.
URL Parameters
Variable Type Description
timeStart integer Unix Timestamp for the start of the requested period.
timeEnd integer Unix Timestamp for the end of the requested period. Has current time by default.
skip int The offset of items to start from. Useful for paginations. (e.g. skip=100 would show results from 101 item to 150)
limit int Amount of items to return (optional, default value is 50)
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria
Output Variables
Variables Description
exchangeId Our identifier (UID) of the exchange where symbol is traded.
tradeType Type of symbol (possible values are: SPOT, FUTURES or OPTION)
exchangeSequenceId Sequence number per pair (type, exchangeId) which is valid only for the lifespan of the connection.
eventTime Time of trade reported by exchange
baseAsset FX Spot base asset identifier (UID), for derivatives it’s contact underlying (e.g. BTC for BTC/USD)
quoteAsset FX Spot quote asset identifier (UID), for derivatives it’s contract underlying (e.g. USD for BTC/USD)
price Price of the transaction
amount Base asset amount traded in the transaction
direction Aggressor side of the transaction (BUY/SELL/BUY_ESTIMATED/SELL_ESTIMATED/UNKNOWN)

Quotes

This section describes calls related to quotes data, also known as quotes or passive level 1 data. It will allow you to get data for current, latest & historical information.

Output Varibles
Variable Description
exchangeId Our identifier (UID) of the exchange where symbol is traded.
tradeType Type of symbol (possible values are: SPOT, FUTURES or OPTION)
exchangeSequenceId Sequence number per pair (type, exchangeId) which is valid only for the lifespan of the connection.
eventTime Time of quote reported by exchange
baseAsset FX Spot base asset identifier (UID), for derivatives it’s contact underlying (e.g. BTC for BTC/USD)
quoteAsset FX Spot quote asset identifier (UID), for derivatives it’s contract underlying (e.g. USD for BTC/USD)
price Price of the transaction
amount Base asset amount traded in the transaction
direction Aggressor side of the transaction (ASKS/BIDS)

Latest Data

Code samples


curl -X GET \
  'https://api.cryptoapis.io/v1/quotes/latest' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/quotes/latest HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/quotes/latest').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/quotes/latest",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/quotes/latest');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/quotes/latest")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/quotes/latest'
headers = {
  'Content-Type': 'application/json',
  'X-API-Key': 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/quotes/latest")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/quotes/latest")
}

Response Body

{
    "meta": {
        "totalCount": 2182,
        "index": 0,
        "limit": 50,
        "results": 50
    },
    "payload": [
        {
            "exchangeSymbol": "LSK-BTC",
            "exchangeId": "5b4e11256ab304000a106942",
            "baseAsset": "5b1ea92e584bf5002013062e",
            "quoteAsset": "5b1ea92e584bf50020130612",
            "eventTime": 1543401244630,
            "tradeType": "SPOT",
            "price": 0.00035885000000000002,
            "amount": 56.588099999999997,
            "direction": "ASKS"
        },
        ....
        {
            "exchangeSymbol": "xrpbtc",
            "exchangeId": "5b1ea9d21090c200146f7386",
            "baseAsset": "5b1ea92e584bf50020130619",
            "quoteAsset": "5b1ea92e584bf50020130612",
            "eventTime": 1543401241912,
            "tradeType": "SPOT",
            "price": 0.000106,
            "amount": 1.2210000000000001,
            "direction": "ASKS"
        }
    ]
}

Get latest quote updates for up to 1 hour ago. Latest data is always returned in time descending order.

HTTP Request

GET /v1/quotes/latest?limit={limit}

URL Parameters
Variable Type Description
limit int Amount of items to return (optional, default value is 50)
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria
Output Variables
Variables Description
exchangeSymbol Symbol identifier custom for the exchange where trade took place.
exchangeId Our identifier (UID) of the exchange where symbol is traded.
tradeType Type of symbol (possible values are: SPOT, FUTURES or OPTION)
eventTime Time of quote reported by exchange
baseAsset FX Spot base asset identifier (UID), for derivatives it’s contact underlying (e.g. BTC for BTC/USD)
quoteAsset FX Spot quote asset identifier (UID), for derivatives it’s contract underlying (e.g. USD for BTC/USD)
direction Initiator side of the transaction (ASKS/BIDS)
price Price of the transaction
amount Base asset amount traded in the transaction

Historical Data

Code samples


curl -X GET \
  'https://api.cryptoapis.io/v1/quotes/5bfc325c9c40a100014db8ff/history?timeStart=1532955177&timeEnd=1556355177' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/quotes/5bfc325c9c40a100014db8ff/history?timeStart=1532955177&timeEnd=1556355177 HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/quotes/5bfc325c9c40a100014db8ff/history?timeStart=1532955177&timeEnd=1556355177').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/quotes/5bfc325c9c40a100014db8ff/history?timeStart=1532955177&timeEnd=1556355177",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/quotes/5bfc325c9c40a100014db8ff/history?timeStart=1532955177&timeEnd=1556355177');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/quotes/5bfc325c9c40a100014db8ff/history?timeStart=1532955177&timeEnd=1556355177")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/quotes/5bfc325c9c40a100014db8ff/history?timeStart=1532955177&timeEnd=1556355177'
headers = {
  'Content-Type': 'application/json',
  'X-API-Key': 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/quotes/5bfc325c9c40a100014db8ff/history?timeStart=1532955177&timeEnd=1556355177")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorizarion", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/quotes/5bfc325c9c40a100014db8ff/history?timeStart=1532955177&timeEnd=1556355177")
}

Response Body

{
    "meta": {
        "totalCount": 1,
        "index": 0,
        "limit": 50,
        "results": 1
    },
    "payload": [
        {
            "exchangeSymbol": "tLTCUSD",
            "exchangeId": "5b1ea8278111cc00012062d8",
            "price": 32.439999999999998,
            "tradeType": "SPOT",
            "baseAsset": "5b1e9de8cf19ad00016095e4",
            "quoteAsset": "5bb367d36eeda0000c3a1122",
            "direction": "ASKS",
            "amount": 239.964,
            "eventTime": 1543831655438
        }
    ]
}

Get historical quote updates within requested time range, returned in time descending order. If no start & end time are defined when calling the enpoint, your data results will be provided 24 hours back, by default.

HTTP Request

GET /v1/quotes/{symbol_id}/history?timeStart={time_start}&timeEnd={time_end}&skip={skip}&limit={limit}

Symbol Parameters
Parameter Type Description
symbol_id string Symbol identifier used to filter response.
URL Parameters
Variable Type Description
timeStart integer Unix Timestamp for the start of the requested period.
timeEnd integer Unix Timestamp for the end of the requested period. Has current time by default.
skip int The offset of items to start from. Useful for paginations. (e.g. skip=100 would show results from 101 item to 150)
limit int Amount of items to return (optional, default value is 50)
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria
Output Variables
Variables Description
exchangeSymbol Symbol identifier custom for the exchange where quote was created
exchangeId Our identifier (UID) of the exchange where symbol is traded.
tradeType Type of symbol (possible values are: SPOT, FUTURES or OPTION)
exchangeSequenceId Sequence number per pair (type, exchangeId) which is valid only for the lifespan of the connection.
eventTime Time of quote reported by exchange
baseAsset FX Spot base asset identifier (UID), for derivatives it’s contact underlying (e.g. BTC for BTC/USD)
quoteAsset FX Spot quote asset identifier (UID), for derivatives it’s contract underlying (e.g. USD for BTC/USD)
price BID/ASK-ed price
amount BID/ASK-ed amount
direction Aggressor side of the transaction (ASKS/BIDS)

Arbitrage

This section describes calls related to trading data (arbitrage, Private APIs, etc ...).

Code samples


curl -X GET \
  'https://api.cryptoapis.io/v1/arbitrage-rest' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET https://api.cryptoapis.io/v1/arbitrage-rest HTTP/1.1
Host: https://api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/arbitrage-rest').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/arbitrage-rest",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/arbitrage-rest');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/arbitrage-rest")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/arbitrage-rest'
headers = {
  'Content-Type': 'application/json',
  'X-API-Key': 'my-api-key'
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/arbitrage-rest")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/arbitrage-rest")
}

Response body

{
    "meta": {
        "totalCount": 17343,
        "index": 0,
        "limit": 50,
        "results": 50
    },
    "payload": [
        {
            "initExchange": "LBANK",
            "initBaseAsset": "BNB",
            "initQuoteAsset": "USDT",
            "initExchangeType": "SPOT",
            "initDirection": "BIDS",
            "initPrice": 17.5399,
            "initAmount": 4,
            "initFee": 0,
            "matchExchange": "BINANCE",
            "matchBaseAsset": "BNB",
            "matchQuoteAsset": "USDT",
            "matchExchangeType": "SPOT",
            "matchDirection": "ASKS",
            "matchPrice": 17.2763,
            "matchAmount": 40.42,
            "matchFee": 0,
            "priceDifference": 0.2670548346243715,
            "quoteAssetUSDPrice": 1.0131063528997402,
            "investmentUSD": 71.44789951998973,
            "profitWithoutFees": 1.068219338497486,
            "_id": "5cb087d101f465309fd1fa20",
            "baseAssetUSDPrice": 17.861974879997433,
            "matchQuoteAssetUSDPrice": 1.0131063528997402,
            "matchBaseAssetUSDPrice": 17.861974879997433,
            "matched": "LBANK-bnb_usdt-BIDS-17.5399-1555072946527",
            "grouped": false,
            "matchType": "negative"
        },
        ...
        {
            "initExchange": "YOBIT",
            "initBaseAsset": "LOC",
            "initQuoteAsset": "BTC",
            "initExchangeType": "SPOT",
            "initDirection": "ASKS",
            "initPrice": 9e-8,
            "initAmount": 16194514.60550616,
            "initFee": 0,
            "matchExchange": "FATBTC",
            "matchBaseAsset": "LOC",
            "matchQuoteAsset": "BTC",
            "matchExchangeType": "SPOT",
            "matchDirection": "BIDS",
            "matchPrice": 1e-7,
            "matchAmount": 20000,
            "matchFee": 0,
            "priceDifference": 0.00004991466126717627,
            "quoteAssetUSDPrice": 4991.466126717627,
            "investmentUSD": 16450.24110000122,
            "profitWithoutFees": 0.9982932253435254,
            "_id": "5cb0861701f465dd6dd1fa1f",
            "baseAssetUSDPrice": 0.822512055000061,
            "matchQuoteAssetUSDPrice": 4991.466126717627,
            "matchBaseAssetUSDPrice": 0.822512055000061,
            "matched": "YOBIT-loc_btc-ASKS-9e-8-1555072532702",
            "grouped": false,
            "matchType": "negative"
        }
    ]
}

Get latest quote updates for up to 1 hour ago. Latest data is always returned in time descending order.

HTTP Request

GET /v1/arbitrage-rest?skip={skip}&limit={limit}

URL Parameters
Variable Type Description
skip int The offset of items to start from. Useful for paginations. (e.g. skip=100 would show results from 101 item to 150)
limit int Amount of items to return (optional, default value is 50)
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria
Output Variables
Variables Description
initExchange Exchange name, where the initial quote took place
initBaseAsset Base asset name, where the initial quote took place
initQuoteAsset Quote asset name, where the initial quote took place
initExchangeType Exchange type, where the initial quote took place
initDirection Direction, where the initial quote took place
initPrice Base asset whole unit price in quote assets, where the initial quote took place
initAmount Amount of base asset, where the initial quote took place
initFee Exchange fee in USD needed for the trade, where the initial quote took place
matchExchange Exchange name, where the matching quote took place
matchBaseAsset Base asset name, where the matching quote took place
matchQuoteAsset Quote asset name, where the matching quote took place
matchExchangeType Exchange type, where the matching quote took place
matchDirection Direction, where the matching quote took place
matchPrice Base asset whole unit price in quote assets, where the matching quote took place
matchAmount Amount of base asset, where the matching quote took place
matchFee Exchange fee in USD needed for the trade, where the matching quote took place
priceDifference Difference between initial and matching price in USD
quoteAssetUSDPrice Quote asset whole unit price in USD when the matching happened, where the initial quote took place
investmentUSD Quote asset whole unit price in USD when the matching happened, where the initial quote took place
profitWithoutFees Profit in USD without the exchanges fees if the trade was made
baseAssetUSDPrice Base asset whole unit price in USD when the matching happened, where the initial quote took place
matchQuoteAssetUSDPrice Quote asset whole unit price in USD when the matching happened, where the matching quote took place
matchBaseAssetUSDPrice Base asset whole unit price in USD when the matching happened, where the matching quote took place
matched Unique string identifier of the initial quote
grouped If grouped is true the initial quote has been matched with other matching quotes in order to trade the maximum amount
matchType Can be one of: positive, negative, positive_correlation_base_quote, positive_correlation_quote_base, negative_correlation_base_base, negative_correlation_quote_quote

Blockchain as a Service APIs

Currently, Crypto APIs supports Bitcoin, Ethereum, Litecoin, Bitcoin Cash with more in the blockchains in the pipe-line, such as Dodgecoin, EOS, Stellar & Ripple.

Common

Here you will find the most common blockchain HTTP Requests, which is the power Crypto APIs professional solution.

Endpoint Name HTTP Request Description
Blockchain Chain Endpoint GET /v1/bc/${COIN}/${NETWORK}/info General information about a blockchain is available by GET-ing the base resource.
Blockchain Hash Endpoint GET /v1/bc/${COIN}/${NETWORK}/blocks/${BLOCK_HASH} Block Hash endpoint gives you detail information for particular block in the blockchain.
Blockchain Height Endpoint GET /v1/bc/${COIN}/${NETWORK}/blocks/${BLOCK_HEIGHT} Block Hash endpoint gives you detail information for particular block in the blockchain, including height.
Address Endpoint GET /v1/bc/${COIN}/${NETWORK}/address/${ADDRESS} Returns more information about an address’ transactions than the Address Balance Endpoint but doesn’t return full transaction information.
Generate Address Endpoint POST /v1/bc/${COIN}/${NETWORK}/address Generate Address endpoint allows you to generate private-public key-pairs along with an associated public address.
Add Address to Wallet Endpoint POST /v1/bc/${COIN}/${NETWORK}/wallets/${WALLET_NAME}/addresses This endpoint allows you to add public addresses to the $WALLET_NAME wallet, by POSTing a partially filled out Wallet object.
Generate Address in Wallet Endpoint POST /v1/bc/${COIN}/${NETWORK}/wallets/${WALLET_NAME}/addresses/generate Тhis endpoint allows you to generate a new address associated with the WALLET_NAME wallet. Note: Currently ETH is not included.
Remove Addresses from Wallet Endpoint DELETE /v1/bc/${COIN}/${NETWORK}/wallets/{WALLET_NAME}/address/${ADDRESS} This endpoint allows you to delete an $ADDRESS associated with the WALLET_NAME wallet. Note: Currently ETH is not included.
Delete Wallet Endpoint DELETE /v1/bc/${COIN}/${NETWORK}/wallets/${WALLET_NAME} This endpoint deletes the Wallet with WALLET_NAME. If successful, it will return an error message with no return object. Note: Currently ETH is not included.
Transaction Hash Endpoint GET /v1/bc/${COIN}/${NETWORK}/txs/${TX_HASH} The Transaction Hash Endpoint returns detailed information about a given transaction based on its hash.
Creating Transactions POST /v1/bc/${COIN}/${NETWORK}/txs/new Two-endpoint transaction creation tool, New.
Creating Transactions POST /v1/bc/${COIN}/${NETWORK}/txs/send Two-endpoint transaction creation tool, Send.

BTC

Blockchain API

Chain Endpoint

Code samples


curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/mainnet/info' \
    -H 'ContentType: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/mainnet/info HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/bc/btc/mainnet/info').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/info",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/info');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/info")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/bc/btc/mainnet/info'
headers = {
  "Content-Type": "application/json",
  "X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/info")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/bc/btc/mainnet/info")
}

Response Body

{
    "payload": {
        "difficulty": 7182852313938.317,
        "headers": 546904,
        "chain": "main",
        "chainWork": "000000000000000000000000000000000000000003b8fe71a1bf647effbc862f",
        "mediantime": 1540234846,
        "blocks": 546904,
        "bestBlockHash": "0000000000000000001c940339b65f3c1d85006041e9602bc9bda2c495e2ca82",
        "currency": "BTC",
        "transactions": 342149347,
        "verificationProgress": 0.9999964749471614
    }
}
Info

General information about a blockchain is available by GET-ing the base resource.

HTTP Request

GET /v1/bc/btc/${NETWORK}/info

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)

The returned object contains a litany of information about the blockchain, including its height, the time/hash of the latest block, and more.

Block Hash Endpoint

Code samples


curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/0000000000000000001ca87bd09c2fc80a0ef3966c6473553b118583e0a73381' \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/mainnet/blocks/0000000000000000001ca87bd09c2fc80a0ef3966c6473553b118583e0a73381 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/0000000000000000001ca87bd09c2fc80a0ef3966c6473553b118583e0a73381').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/blocks/0000000000000000001ca87bd09c2fc80a0ef3966c6473553b118583e0a73381",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/0000000000000000001ca87bd09c2fc80a0ef3966c6473553b118583e0a73381');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/0000000000000000001ca87bd09c2fc80a0ef3966c6473553b118583e0a73381")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/0000000000000000001ca87bd09c2fc80a0ef3966c6473553b118583e0a73381'
headers = {
  "Content-Type": "application/json",
  "X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/0000000000000000001ca87bd09c2fc80a0ef3966c6473553b118583e0a73381")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/0000000000000000001ca87bd09c2fc80a0ef3966c6473553b118583e0a73381")
}

Response Body

{
    "payload": {
        "hash": "00000000000000000009917a263a01b80d3cbe6e69b562a29d62de9170551be8",
        "strippedsize": 909570,
        "size": 1264413,
        "weight": 3993123,
        "height": 564349,
        "version": 536870912,
        "versionHex": "20000000",
        "merkleroot": "95439d11e918c9fd9a901dcf22203d60f538d660ae74efb7cb566825420fd3b7",
        "time": "2019-02-23 17:33:30 UTC",
        "mediantime": "2019-02-23 16:53:23 UTC",
        "nonce": 117587101,
        "bits": "172e6f88",
        "difficulty": 6061518831027.271,
        "chainwork": "00000000000000000000000000000000000000000532b1d8837e5d34f183a10a",
        "previousblockhash": "0000000000000000002b4efdd796d0288213b7d2f2849ec95e9be9a9a722e5e6",
        "nextblockhash": "0000000000000000002aa120a6e7200a6a726f15b793b41868acf2a7b24f1850",
        "transactions": 3004,
        "tx":[
            "347d96855d41b77f1e23048fff11c18e9fe699ee69b0b402338f34189734e0a2",
            ...
            "6bb1b2dc66d2dde53aebcebb8ecef19a69f77322dab2fdbc8e6088bfbda13649"
        ],
        "confirmations": 0,
        "timestamp": 1550943210
    }
}
Info

Block Hash endpoint gives you detail information for particular block in the blockchain

HTTP Request

GET /v1/bc/btc/${NETWORK}/blocks/${BLOCK_HASH}

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)
BLOCK_HASH ------- Hash of the block in blockchain

BLOCK_HASH is a string representing the hash of the block you’re interested in querying, for example:

0000000000000000001ca87bd09c2fc80a0ef3966c6473553b118583e0a73381

The returned object contains information about the block in JSON format, including its height, the number of transactions in it, transaction hashes listed in the canonical order in which they appear in the block, and more.

Block Height Endpoint

Code samples


curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/546903' \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/mainnet/blocks/546903 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/546903').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/blocks/546903",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/546903');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/546903")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/546903'
headers = {
  "Content-Type": "application/json",
  "X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/546903")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/546903")
}

Response Body

{
  "payload": {
      "hash": "00000000000000000009917a263a01b80d3cbe6e69b562a29d62de9170551be8",
      "strippedsize": 909570,
      "size": 1264413,
      "weight": 3993123,
      "height": 564349,
      "version": 536870912,
      "versionHex": "20000000",
      "merkleroot": "95439d11e918c9fd9a901dcf22203d60f538d660ae74efb7cb566825420fd3b7",
      "time": "2019-02-23 17:33:30 UTC",
      "mediantime": "2019-02-23 16:53:23 UTC",
      "nonce": 117587101,
      "bits": "172e6f88",
      "difficulty": 6061518831027.271,
      "chainwork": "00000000000000000000000000000000000000000532b1d8837e5d34f183a10a",
      "previousblockhash": "0000000000000000002b4efdd796d0288213b7d2f2849ec95e9be9a9a722e5e6",
      "nextblockhash": "0000000000000000002aa120a6e7200a6a726f15b793b41868acf2a7b24f1850",
      "transactions": 3004,
      "tx":[
          "347d96855d41b77f1e23048fff11c18e9fe699ee69b0b402338f34189734e0a2",
          ...
        "6bb1b2dc66d2dde53aebcebb8ecef19a69f77322dab2fdbc8e6088bfbda13649"
      ],
      "confirmations": 0,
      "timestamp": 1550943210
  }
}

Info

Block Height endpoint gives you detail information for particular block in the blockchain

HTTP Request

GET /v1/bc/btc/${NETWORK}/blocks/${BLOCK_HEIGHT}

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)
BLOCK_HEIGHT ------- Height of the block in blockchain

BLOCK_HEIGHT is a integer representing the height of the block you’re interested in querying, for example:

546903

The returned object contains information about the block in JSON format, including its height, the number of transactions in it, transaction hashes listed in the canonical order in which they appear in the block, and more.

Latest Block Endpoint

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/latest \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/mainnet/blocks/latest HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/latest",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "port": "8021",
  "path": [
    "v1",
    "bc",
    "btc",
    "mainnet",
    "blocks",
    "latest"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/latest');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/latest")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,btc,mainnet,blocks,latest", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/latest")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/latest"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
  "payload": {
      "hash": "0000000000000000001ca87bd09c2fc80a0ef3966c6473553b118583e0a73381",
      "strippedsize": 956276,
      "size": 1124359,
      "weight": 3993187,
      "height": 546903,
      "version": 536870912,
      "versionHex": "20000000",
      "merkleroot": "c60a59ea073b3fbe6426da111da042f75a76435b0d0ee05e177749052cfc5e6b",
      "time": "2018-10-22 19:46:31 UTC",
      "mediantime": "2018-10-22 18:50:11 UTC",
      "nonce": 3498325829,
      "bits": "17272fbd",
      "difficulty": 7182852313938.317,
      "chainwork": "000000000000000000000000000000000000000003b8f7e937daa747f14ee0a8",
      "previousblockhash": "00000000000000000014b10d64dd3e60b038233ccca693b13ce9f1ee6afc26f9",
      "nextblockhash": "0000000000000000001c940339b65f3c1d85006041e9602bc9bda2c495e2ca82",
      "transactions": 949,
      "tx": [
          "89067219fdf8343024cc9f0f4d9016ac7b8e131d19fa05bff1cc08b06bed500d",
          ...
          "7beefdba268eb412dddd7bd422fa4916731dd2e9d1be9666962d7d50202e8316"
      ],
      "confirmations": 17446,
      "timestamp": 1540237591
  }
}
Info

Latest Block Endpoint gives you detail information for the latest block in the blockchain

HTTP Request

GET /v1/bc/btc/${NETWORK}/blocks/latest

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. mainnet or testnet)

The returned object contains information about the latest block in JSON format, including its height, the number of transactions in it and more.

Address API

Crypto APIs Address API allows you to look up information about public addresses on the blockchain, generate single-use, low-value key pairs with corresponding addresses, help generate multisig addresses, and collect multiple addresses into a single shortcut for address viewing, all based on the coin/chain resource you’ve selected for your endpoints.

If you’re new to blockchains, you can think of public addresses as similar to bank account numbers in a traditional ledger. The biggest differences:

Address Endpoint

Code samples


curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/mainnet/address/1DBrYbe5U7LGDcHA5tiLCxivZ7JZAGqGhJ' \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/mainnet/address/1DBrYbe5U7LGDcHA5tiLCxivZ7JZAGqGhJ HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/bc/btc/mainnet/address/1DBrYbe5U7LGDcHA5tiLCxivZ7JZAGqGhJ').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/address/1DBrYbe5U7LGDcHA5tiLCxivZ7JZAGqGhJ",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/address/1DBrYbe5U7LGDcHA5tiLCxivZ7JZAGqGhJ');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/address/1DBrYbe5U7LGDcHA5tiLCxivZ7JZAGqGhJ")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/bc/btc/mainnet/address/1DBrYbe5U7LGDcHA5tiLCxivZ7JZAGqGhJ'
headers = {
  "Content-Type": "application/json",
  "X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/address/1DBrYbe5U7LGDcHA5tiLCxivZ7JZAGqGhJ")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/bc/btc/mainnet/address/1DBrYbe5U7LGDcHA5tiLCxivZ7JZAGqGhJ")
}

Response Body

{
  "payload": {
      "address": "1DBrYbe5U7LGDcHA5tiLCxivZ7JZAGqGhJ",
      "totalSpent": "50",
      "totalReceived": "50",
      "balance": "0",
      "txi": 1,
      "txo": 1,
      "txsCount": 2,
      "addresses": [
          "1DBrYbe5U7LGDcHA5tiLCxivZ7JZAGqGhJ"
      ]
  }
}
Info

The default Address Endpoint strikes a general information about addresses.

HTTP Request

GET /v1/bc/btc/${NETWORK}/address/${ADDRESS}

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)
ADDRESS ------- Address in blockchain

ADDRESS is a string representing the public address (or wallet/HD wallet name) you’re interested in querying, for example:

1DBrYbe5U7LGDcHA5tiLCxivZ7JZAGqGhJ

or

mfd1JDV824jpfQkmhYaXtAZGULndSFYudT,mqvMWHkgYGkigx3wiZVhJVDbJhsEkkeKqM,n3WfwHYPuuiiyNK5oJ69Beq4qa2sdHniTV

The second type address is a multisignature address. Since multisignature addresses may be treated as common addresses the following query for the same results is possible:

GET /v1/bc/btc/testnet/address/mfd1JDV824jpfQkmhYaXtAZGULndSFYudT,mqvMWHkgYGkigx3wiZVhJVDbJhsEkkeKqM,n3WfwHYPuuiiyNK5oJ69Beq4qa2sdHniTV

{
  "payload": {
        "address": "mfd1JDV824jpfQkmhYaXtAZGULndSFYudT,mqvMWHkgYGkigx3wiZVhJVDbJhsEkkeKqM,n3WfwHYPuuiiyNK5oJ69Beq4qa2sdHniTV",
        "totalSpent": "0.0001",
        "totalReceived": "0.0001",
        "balance": "0",
        "txi": 1,
        "txo": 1,
        "txsCount": 2,
        "addresses": [
            "mfd1JDV824jpfQkmhYaXtAZGULndSFYudT",
            "mqvMWHkgYGkigx3wiZVhJVDbJhsEkkeKqM",
            "n3WfwHYPuuiiyNK5oJ69Beq4qa2sdHniTV"
        ]
  }
}

The returned object contains information about the address, including its balance in bitcoins and the number of transactions associated with it. The endpoint omits any detailed transaction information, but if that isn’t required by your application, then it’s the fastest and preferred way to get public address information.

Multisig Address Endpoint

Code samples


curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/testnet/address/mho4jHBcrNCncKt38trJahXakuaBnS7LK5/multisig' \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/testnet/address/mho4jHBcrNCncKt38trJahXakuaBnS7LK5/multisig HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/bc/btc/testnet/address/mho4jHBcrNCncKt38trJahXakuaBnS7LK5/multisig').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/testnet/address/mho4jHBcrNCncKt38trJahXakuaBnS7LK5/multisig",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/testnet/address/mho4jHBcrNCncKt38trJahXakuaBnS7LK5/multisig');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/testnet/address/mho4jHBcrNCncKt38trJahXakuaBnS7LK5/multisig")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/bc/btc/testnet/address/mho4jHBcrNCncKt38trJahXakuaBnS7LK5/multisig'
headers = {
  "Content-Type": "application/json",
  "X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/testnet/address/mho4jHBcrNCncKt38trJahXakuaBnS7LK5/multisig")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/bc/btc/testnet/address/mho4jHBcrNCncKt38trJahXakuaBnS7LK5/multisig")
}

Response Body

{
    "payload": [
        {
            "address": "mho4jHBcrNCncKt38trJahXakuaBnS7LK5,mzNwee7papMuTrw6hBwKncVNBeg4oAJy4r",
            "totalSpent": "0.0001",
            "totalReceived": "0.0002",
            "balance": "0.0001",
            "txi": 1,
            "txo": 2,
            "txsCount": 2,
            "addresses": [
                "mho4jHBcrNCncKt38trJahXakuaBnS7LK5",
                "mzNwee7papMuTrw6hBwKncVNBeg4oAJy4r"
            ]
        },
        {
            "address": "mho4jHBcrNCncKt38trJahXakuaBnS7LK5,mpyqeHi88H46FsFanEJu1cPE7sPuUgwbCL",
            "totalSpent": "0.0001",
            "totalReceived": "0.0002",
            "balance": "0.0001",
            "txi": 1,
            "txo": 2,
            "txsCount": 2,
            "addresses": [
                "mho4jHBcrNCncKt38trJahXakuaBnS7LK5",
                "mpyqeHi88H46FsFanEJu1cPE7sPuUgwbCL"
            ]
        },
        ...
        {
            "address": "mho4jHBcrNCncKt38trJahXakuaBnS7LK5,mrSRivjq9L9d2cnoeYGZr1qPUuAbS8YLqD",
            "totalSpent": "0.0001",
            "totalReceived": "0.0002",
            "balance": "0.0001",
            "txi": 1,
            "txo": 2,
            "txsCount": 2,
            "addresses": [
                "mho4jHBcrNCncKt38trJahXakuaBnS7LK5",
                "mrSRivjq9L9d2cnoeYGZr1qPUuAbS8YLqD"
            ]
        }
    ],
    "meta": {
        "totalCount": 31,
        "limit": 50,
        "results": 31
  }
}
Info

The Multisig Address Endpoint strikes a general information about a single address that is involved in multisignature addresses.

HTTP Request

GET /v1/bc/btc/${NETWORK}/address/${ADDRESS}/multisig

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)
ADDRESS ------- Address in blockchain
LIMIT ------- Limit results
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria

ADDRESS is a string representing the public address (or wallet/HD wallet name) you’re interested in querying, for example:

mho4jHBcrNCncKt38trJahXakuaBnS7LK5

The returned object returns a list of multisignature addresses in which the queried address is involved in, including balance in bitcoins and the number of transactions associated with it, and more.

Generate Address Endpoint

Code samples


curl -X POST 'https://api.cryptoapis.io/v1/bc/btc/mainnet/address' \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


POST /v1/bc/btc/mainnet/address HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.post('https://api.cryptoapis.io/v1/bc/btc/mainnet/address')
  .then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/address",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/address');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/address")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/bc/btc/mainnet/address'
headers = {
  "Content-Type": "application/json",
  "X-API-Key": "my-api-key"
}
response = requests.post(url, headers=headers, data={})


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/address")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Post("https://api.cryptoapis.io/v1/bc/btc/mainnet/address")
}

Response Body

{
  "payload": {
      "privateKey": "18da04769fe3c2087ac770351231de97efc3e710544c42a03403c42fe238da85",
      "publicKey": "03af90e5ddde840eea6db1b80f90adc44031d182c838d983b458dd92a21f93ada2",
      "address": "12zCbo4dXBqtsbU6FZgsovdDR93t1zQirb",
      "wif": "Kx424rXfrRMyuYhTtJEkQeHe4AtQVe7noV5DJ5qn32XJWgwwVFQm"
  }
}
Info

The Generate Address endpoint allows you to generate private-public key-pairs along with an associated public address. No information is required with this POST request.

HTTP Request

POST /v1/bc/btc/${NETWORK}/address

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or testnet)

The returned object contains a private key in hex-encoded and wif-encoded format, a public key, and a public address.

Address Transactions Endpoint

Code samples


curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/testnet/address/mtFYoSowT3i649wnBDYjCjewenh8AuofQb/transactions' \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/testnet/address/mtFYoSowT3i649wnBDYjCjewenh8AuofQb/transactions HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/bc/btc/testnet/address/mtFYoSowT3i649wnBDYjCjewenh8AuofQb/transactions').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/testnet/address/mtFYoSowT3i649wnBDYjCjewenh8AuofQb/transactions",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/testnet/address/mtFYoSowT3i649wnBDYjCjewenh8AuofQb/transactions');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/testnet/address/mtFYoSowT3i649wnBDYjCjewenh8AuofQb/transactions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/bc/btc/testnet/address/mtFYoSowT3i649wnBDYjCjewenh8AuofQb/transactions'
headers = {
  "Content-Type": "application/json",
  "X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/testnet/address/mtFYoSowT3i649wnBDYjCjewenh8AuofQb/transactions")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/bc/btc/testnet/address/mtFYoSowT3i649wnBDYjCjewenh8AuofQb/transactions")
}

Response Body

{
    "payload": [
        {
            "txid": "af176117c26241433946ec967433bbf34e8297446a64553f827c52314eea96a7",
            "hash": "af176117c26241433946ec967433bbf34e8297446a64553f827c52314eea96a7",
            "index": 19,
            "version": 2,
            "size": 587,
            "vsize": 587,
            "locktime": 0,
            "time": "2019-02-25 12:04:54 UTC",
            "blockhash": "00000000000001a8489e34bd83b180bf6f030fe9ccf57d4ef5fb9713ff05741c",
            "blockheight": 1481535,
            "blocktime": "2019-02-25 12:04:54 UTC",
            "timestamp": 1551096294,
            "confirmations": 27,
            "txins": [
                {
                    "txout": "02c4c9c002e2da17d9edb0144a876d7bf92be0afdb2373a4d1d25f96fee5c826",
                    "vout": 1,
                    "amount": "0.00075333",
                    "addresses": [
                        "mtFYoSowT3i649wnBDYjCjewenh8AuofQb"
                    ],
                    "script": {
                        "asm": "3044022072ffc0d6ba2acbf11de33d7bf2723d667a166eeadad1920d98732ce29593e5310220605de47003debe7580ee85b3c877f04b311b391ee3381bb0a0c71ed43c023c06[ALL] 02275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469",
                        "hex": "473044022072ffc0d6ba2acbf11de33d7bf2723d667a166eeadad1920d98732ce29593e5310220605de47003debe7580ee85b3c877f04b311b391ee3381bb0a0c71ed43c023c06012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469"
                    },
                    "votype": "pubkeyhash"
                },
                ...
                {
                    "txout": "02c4c9c002e2da17d9edb0144a876d7bf92be0afdb2373a4d1d25f96fee5c826",
                    "vout": 2,
                    "amount": "0.00071338",
                    "addresses": [
                        "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9"
                    ],
                    "script": {
                        "asm": "304402200c6e7995f478b629472c86fba4493b403a9fb1822813d2d2ac6d613f45d520fc022036ee5dbedcae9bcd9d86cea34999b0c0d081f340d33aa696a63f151ae3022f8c[ALL] 0378883486db7490326ac593c968312a980e0166f152bcb88b18a5dd823c5c5b1f",
                        "hex": "47304402200c6e7995f478b629472c86fba4493b403a9fb1822813d2d2ac6d613f45d520fc022036ee5dbedcae9bcd9d86cea34999b0c0d081f340d33aa696a63f151ae3022f8c01210378883486db7490326ac593c968312a980e0166f152bcb88b18a5dd823c5c5b1f"
                    },
                    "votype": "pubkeyhash"
                }
            ],
            "txouts": [
                {
                    "amount": "0.00018",
                    "type": "pubkeyhash",
                    "spent": false,
                    "addresses": [
                        "mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz"
                    ],
                    "script": {
                        "asm": "OP_DUP OP_HASH160 45bfa6143f69be3475e17724397f1146a60a81f3 OP_EQUALVERIFY OP_CHECKSIG",
                        "hex": "76a91445bfa6143f69be3475e17724397f1146a60a81f388ac",
                        "reqsigs": 1
                    }
                },
                ...
                {
                    "amount": "0.00059909",
                    "type": "pubkeyhash",
                    "spent": false,
                    "addresses": [
                        "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9"
                    ],
                    "script": {
                        "asm": "OP_DUP OP_HASH160 7b9a627a184897f10d31d73d87c2eea191d8f501 OP_EQUALVERIFY OP_CHECKSIG",
                        "hex": "76a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac",
                        "reqsigs": 1
                    }
                }
            ]
        },
        {
            "txid": "02c4c9c002e2da17d9edb0144a876d7bf92be0afdb2373a4d1d25f96fee5c826",
            "hash": "02c4c9c002e2da17d9edb0144a876d7bf92be0afdb2373a4d1d25f96fee5c826",
            "index": 3,
            "version": 2,
            "size": 406,
            "vsize": 406,
            "locktime": 0,
            "time": "2019-02-25 11:47:50 UTC",
            "blockhash": "000000000000019cb1dbf81c08d53b106bbb2f00952102ba5287505b19a9281c",
            "blockheight": 1481533,
            "blocktime": "2019-02-25 11:47:50 UTC",
            "timestamp": 1551095270,
            "confirmations": 29,
            "txins": [
                {
                    "txout": "ba559f7866d714328165f95b446268458a179b06f680ed788146db76614977cd",
                    "vout": 1,
                    "amount": "0.00161544",
                    "addresses": [
                        "mtFYoSowT3i649wnBDYjCjewenh8AuofQb"
                    ],
                    "script": {
                        "asm": "304402202c0a4c2edf30feb367d358f537aa0ffcf620c38d82c6a8735652c7329430fd11022051d549a4955884c3cff92c5236b3adfd739a45b365bf436fc870375d659c026b[ALL] 02275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469",
                        "hex": "47304402202c0a4c2edf30feb367d358f537aa0ffcf620c38d82c6a8735652c7329430fd11022051d549a4955884c3cff92c5236b3adfd739a45b365bf436fc870375d659c026b012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469"
                    },
                    "votype": "pubkeyhash"
                },
                {
                    "txout": "ba559f7866d714328165f95b446268458a179b06f680ed788146db76614977cd",
                    "vout": 2,
                    "amount": "0.00092537",
                    "addresses": [
                        "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9"
                    ],
                    "script": {
                        "asm": "304402205ce86d13e347c3dc9d02b88c77ad0c30364947f36e6a3f0acb14e9647776d2c2022058686057784ab1c617a8671a2b2f00f50b389c578ea98632583487c58f68bd7b[ALL] 0378883486db7490326ac593c968312a980e0166f152bcb88b18a5dd823c5c5b1f",
                        "hex": "47304402205ce86d13e347c3dc9d02b88c77ad0c30364947f36e6a3f0acb14e9647776d2c2022058686057784ab1c617a8671a2b2f00f50b389c578ea98632583487c58f68bd7b01210378883486db7490326ac593c968312a980e0166f152bcb88b18a5dd823c5c5b1f"
                    },
                    "votype": "pubkeyhash"
                }
            ],
            "txouts": [
                {
                    "amount": "0.00024",
                    "type": "pubkeyhash",
                    "spent": false,
                    "addresses": [
                        "mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz"
                    ],
                    "script": {
                        "asm": "OP_DUP OP_HASH160 45bfa6143f69be3475e17724397f1146a60a81f3 OP_EQUALVERIFY OP_CHECKSIG",
                        "hex": "76a91445bfa6143f69be3475e17724397f1146a60a81f388ac",
                        "reqsigs": 1
                    }
                },
                ...
                {
                    "amount": "0.00071338",
                    "type": "pubkeyhash",
                    "spent": true,
                    "addresses": [
                        "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9"
                    ],
                    "script": {
                        "asm": "OP_DUP OP_HASH160 7b9a627a184897f10d31d73d87c2eea191d8f501 OP_EQUALVERIFY OP_CHECKSIG",
                        "hex": "76a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac",
                        "reqsigs": 1
                    }
                }
            ]
        }
    ],
    "meta": {
        "totalCount": 23,
        "index": 0,
        "limit": 50,
        "results": 23
    }
}
Info

The Address Transactions Endpoint returns all information available about a particular address, including an array of complete transactions.

HTTP Request

GET /v1/bc/btc/${NETWORK}/address/${ADDRESS}/transactions?index=0&limit=50

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)
ADDRESS ------- Address in blockchain
index 0 First index of returned txs
limit 50 Sets the number of returned txs
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria

The default values of the query parameters index and limit are as follows: 0 and 50. ADDRESS is a string representing the public address you’re interested in querying, for example:

mtFYoSowT3i649wnBDYjCjewenh8AuofQb

The returned object contains information about the address, including the number of transactions associated with it, and the corresponding full transaction records in descending order by blocktime.

Wallet API

Hierarchical Deterministic (HD) Wallets

We also offer support for HD Wallets, which make it easy to manage multiple addresses under a single name. All HD wallet addresses are derived from a single seed. Please see BIP32 for more background on HD wallets.

HD Wallets can be created, deleted, and have new addresses generated. However, unlike normal Wallets, addresses cannot be removed.

When creating a wallet, one can optionally include one or more “subchain” indexes. These subchains can later be referenced when generating new addresses or sending txs. If none are provided in wallet creation, the wallet will derive & use addresses straight from the given extended pubkey. If no index is given when using the wallet with other APIs, it defaults to using the wallet’s first (sub) chain.

In BIP32 notation, the wallet layout is m/0, m/1, … and m/i/0, m/i/1, … for each subchain i if the wallet has subchains. For example, the path of the fourth address generated is m/3 for a non-subchain wallet. The path of the fourth address at subchain index two is m/2/3. Note that this is different from the default BIP32 wallet layout.

If you want to use BIP32 default wallet layout you can submit the extended public key of m/0’ (which can only be derived from your master private key) with subchain indexes = [0, 1]. Subchain index 0 represents the external chain (of account 0) and will discover all k keypairs that look like: m/0’/0/k. Subchain index 1 represents the internal chain (of account 0) and will discover all k keypairs in m/0’/1/k.

If you want to use BIP 44 layout (for BTC), you can submit the extended public key of m/44’/0’/0’. (which can only be derived from your master private key) with subchain indexes = [0, 1]. Subchain index 0 represents the external chain (of account 0) and will discover all k keypairs in m/44’/0’/0’/0/k. Subchain index 1 represents the internal chain (of account 0) and will discover all k keypairs in m/44’/0’/0’/1/k.

If an address ahead of current addresses listed in an HD Wallet receives a transaction, it will be added, along with any addresses between the new address and the last used one.

Using Wallets

Both HD Wallets and normal Wallets can be leveraged by the Address API, just by using their $NAME instead of $ADDRESS. They can also be used with Events and with the Transaction API. In general, using a wallet instead of an address in an API will have the effect of batching the set of addresses contained in the wallet

The following code examples should be considered serially; that is to say, the results will appear as if each API call were done sequentially. Also, $NAME is a string representing the name of your wallet, for example:

alice

As you’ll see in the examples, if you’re using HD Wallets, take care to use the appropriate resource (e.g. /wallets/hd instead of /wallets ).

Create Wallet Endpoint

Code samples


#### normal wallet
curl -X POST \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/ \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key' \
  -d '{
    "walletName" : "demowallet",
    "addresses": ["1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA", "1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5", "1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH"]
}'

#### hd wallet
curl -X POST \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/ \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key' \
  -d '{
    "walletName" : "demohdwallet",
    "addressCount" : 5,
    "password" : "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32"
}'


#### normal wallet
POST /v1/bc/btc/mainnet/wallets HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
    "walletName" : "demowallet",
    "addresses" : ["1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA", "1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5", "1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH"]
}

#### hd wallet
POST /v1/bc/btc/mainnet/wallets/hd HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
    "walletName" : "demohdwallet",
    "addressCount" : 5,
    "password" : "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32"
}


// normal wallet
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"walletName\" : \"demowallet\",\n\t\"addresses\" : [\"1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA\", \"1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5\", \"1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH\"]\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

// hd wallet
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"walletName\" : \"demohdwallet\",\n\t\"addressCount\" : 5,\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


// normal wallet
var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/wallets",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({
  walletName: 'demowallet',
  addresses: 
   ["1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA", "1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5", "1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH"] }));
req.end();

// hd wallet
var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/wallets/hd",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({
  walletName: 'demohdwallet',
  addressCount: 5,
  password: '8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32' }));
req.end();


<?php

// normal wallet
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
    "walletName" : "demowallet",
    "addresses" : ["1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA", "1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5", "1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH"]
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

// hd wallet

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
    "walletName" : "demohdwallet",
    "addressCount" : 5,
    "password" : "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}


?>

#### normal wallet
require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"walletName\" : \"demowallet\",\n\t\"addresses\" : [\"1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA\", \"1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5\", \"1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH\"]\n}"

response = http.request(request)
puts response.read_body

#### hd wallet
require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"walletName\" : \"demohdwallet\",\n\t\"addressCount\" : 5,\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}"

response = http.request(request)
puts response.read_body


#### normal wallet
import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n\t\"walletName\" : \"demowallet\",\n\t\"addresses\" : [\"1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA\", \"1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5\", \"1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH\"]\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "/v1/bc/btc/mainnet/wallets", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))

#### hd wallet
import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n\t\"walletName\" : \"demohdwallet\",\n\t\"addressCount\" : 5,\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "/v1/bc/btc/mainnet/wallets/hd", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


// normal wallet
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\\n\t\"walletName\" : \"demowallet\",\n\t\"addresses\" : [\"1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA\", \"1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5\", \"1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH\"]\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();

// hd wallet
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"walletName\" : \"demohdwallet\",\n\t\"addressCount\" : 5,\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


// notmal wallet
package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets"

    payload := strings.NewReader("{\n\t\"walletName\" : \"demowallet\",\n\t\"addresses\" : [\"1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA\", \"1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5\", \"1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH\"]\n}")

    req, _ := http.NewRequest("POST", url, payload)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

// hd wallet
package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd"

    payload := strings.NewReader("{\n\t\"walletName\" : \"demohdwallet\",\n\t\"addressCount\" : 5,\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}")

    req, _ := http.NewRequest("POST", url, payload)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body

// normal wallet
{
  "payload": {
      "addresses": [
        "1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA", 
        "1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5", 
        "1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH"],
      "walletName": "demowallet",
      "hd": false
  }
}
// hd wallet
{
  "payload": {
      "addresses": [
          {
              "path": "M/0H/0/0",
              "address": "1M9H2qRkNAvjpBbaAknZBWYia7YKb3sskq"
          },
          {
              "path": "M/0H/0/1",
              "address": "1MXoSgaYLt2F9JRguHPbTiNmtw4UijLSvD"
          },
          {
              "path": "M/0H/0/2",
              "address": "1L5ZEe9e2d8bkCAzrub2AFjUNbGNtZNqEg"
          },
          {
              "path": "M/0H/0/3",
              "address": "15XL2G1eTbGT6xY7YrgsL1RtqvYnib8V56"
          },
          {
              "path": "M/0H/0/4",
              "address": "1BpWypWFVJPMHaSuL5oozAc8Zpe9FTiPcw"
          }
      ],
      "walletName": "demohdwallet",
      "hd": true
  }
}
HTTP Request

normal wallet

POST /v1/bc/btc/${NETWORK}/wallets

hd wallet

POST /v1/bc/btc/${NETWORK}/wallets/hd

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. mainnet or mainnet)
WALLET_NAME ------- Wallet name
ADDRESSES ------- Array of addresses that will be added to wallet
ADDRESS_COUNT ------- Number of addresses that should be generated in the new wallet
PASSWORD ------- Wallet password
Request Wallet Object

{ "walletName" : ${WALLET_NAME}, "addresses" : ${ADDRESSES} }

Request HD Wallet Object

{ "walletName" : ${WALLET_NAME}, "addressCount" : ${ADDRESS_COUNT}, "password" : ${PASSWORD} }

This endpoint allows you to create a new wallet, by POSTing a partially filled out Wallet or HDWallet object, depending on the endpoint.

For normal wallets, at minimum, you must include WALLET_NAME attribute and at least one public address in the ADDRESSES array.

For HD wallets, at minimum, you must include WALLET_NAME, the ADDRESS_COUNT and the PASSWORD attributes.

If successful, it will return the same Wallet or HDWallet object you requested, appended with your user token.

List Wallets Endpoint

Code samples


#### normal wallet
curl -X GET \
  https://api.cryptoapis.io/v1/bc/btc/testnet/wallets \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'

#### hd wallet
curl -X GET \
  https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/hd \
  -H 'Content-Type: application/json'
  -H 'X-API-Key: my-api-key'


#### normal wallet
GET /v1/bc/btc/testnet/wallets HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

#### hd wallet
GET /v1/bc/btc/testnet/wallets/hd HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


// normal wallet
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/testnet/wallets",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

// hd wallet
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/hd",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


// normal wallet
var http = require("http");

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/testnet/wallets",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();

// hd wallet
var http = require("http");

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/testnet/wallets/hd",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

// normal wallet
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/testnet/wallets');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

// hd wallet

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/hd');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}


####noraml wallet
require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/testnet/wallets")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body

#### hd wallet
require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/hd")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


#### normal wallet
import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  "Content-Type": "application/json",
  "X-API-Key", "my-api-key"
}

conn.request("GET", "/v1/bc/btc/testnet/wallets", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))

#### hd wallet
import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  "Content-Type": "application/json",
  "X-API-Key", "my-api-key"
}

conn.request("GET", "/v1/bc/btc/testnet/wallets/hd", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


// normal wallet
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/testnet/wallets")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();

// hd wallet
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/hd")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


// notmal wallet
package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/testnet/wallets"

    req, _ := http.NewRequest("GET", url, nil)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

// hd wallet
package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/hd"

    req, _ := http.NewRequest("GET", url, nil)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body

// normal wallet
{
  "payload":  [
          "demowallet",
          "newwallet",
          "specialwallet"
  ],
  "meta": {
      "totalCount": 3,
      "results": 3
  }
}

// hd wallet
{
  "payload": [
          "newhdwallet",
          "specialhdwallet"
  ],
  "meta": {
      "totalCount": 2,
      "results": 2
  }
}
HTTP Request

normal wallet

GET /v1/bc/btc/${NETWORK}/wallets

hd wallet

GET /v1/bc/btc/${NETWORK}/wallets/hd

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)

This endpoint returns a string array ($NAMEARRAY) of active wallet names (both normal ор HD) under the token you queried. You can then query detailed information on individual wallets (via their names) by leveraging the Get Wallet Endpoint.

Get Wallet Endpoint

Code samples


#### normal wallet
curl -X GET \
  https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/demowallet \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'

#### hd wallet
curl -X GET \
  https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/hd/demohdwallet \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


#### normal wallet
GET /v1/bc/btc/testnet/wallets/demowallet HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

#### hd wallet
GET /v1/bc/btc/testnet/wallets/hd/demohdwallet HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


// normal wallet
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/demowallet",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

// hd wallet
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/hd/demohdwallet",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


// normal wallet
var http = require("http");

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/testnet/wallets/demowallet",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();

// hd wallet
var http = require("http");

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/testnet/wallets/hd/demohdwallet",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

// normal wallet
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/demowallet');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

// hd wallet
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/hd/demohdwallet');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>



####noraml wallet
require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/demowallet")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body

#### hd wallet
require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/hd/demohdwallet")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


#### normal wallet
import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  "Content-Type": "application/json",
  "X-API-Key", "my-api-key"
}

conn.request("GET", "/v1/bc/btc/testnet/wallets/demowallet", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))

#### hd wallet
import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  "Content-Type": "application/json",
  "X-API-Key", "my-api-key"
}

conn.request("GET", "/v1/bc/btc/testnet/wallets/hd/demohdwallet", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


// normal wallet
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/demowallet")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();

// hd wallet
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/hd/demohdwallet")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


// notmal wallet
package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/demowallet"

    req, _ := http.NewRequest("GET", url, nil)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

// hd wallet
package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/testnet/wallets/hd/demohdwallet"

    req, _ := http.NewRequest("GET", url, nil)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body

// normal wallet
{
  "payload": {
      "addresses": [
        "1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA", 
        "1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5", 
        "1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH"],
      "walletName": "demowallet",
      "hd": false
  }
}

// hd wallet
{
  "payload": {
      "addresses": [
          {
              "path": "M/0H/0/0",
              "address": "1M9H2qRkNAvjpBbaAknZBWYia7YKb3sskq"
          },
          {
              "path": "M/0H/0/1",
              "address": "1MXoSgaYLt2F9JRguHPbTiNmtw4UijLSvD"
          },
          {
              "path": "M/0H/0/2",
              "address": "1L5ZEe9e2d8bkCAzrub2AFjUNbGNtZNqEg"
          },
          {
              "path": "M/0H/0/3",
              "address": "15XL2G1eTbGT6xY7YrgsL1RtqvYnib8V56"
          },
          {
              "path": "M/0H/0/4",
              "address": "1BpWypWFVJPMHaSuL5oozAc8Zpe9FTiPcw"
          }
      ],
      "walletName": "demohdwallet",
      "hd": true
  }
}

HTTP Request

normal wallet

GET /v1/bc/btc/${NETWORK}/wallets/${WALLET_NAME}

hd wallet

GET /v1/bc/btc/${NETWORK}/wallets/hd/${WALLET_NAME}

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)
WALLET_NAME ------- Wallet name

This endpoint returns a Wallet or HDWallet based on its WALLET_NAME.

Add Addresses to Wallet Endpoint

Code samples


curl -X POST \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/addresses \
  -H 'authorization: my-api-key' \
  -H 'content-type: application/json' \
  -d '{
	"addresses" : ["1Eeu3eC2b35LWtjXeRMJMSfrDnfDEjNwW6", "13ZiD6gSv75aNKdRyoUN39R3oSZEPML7er"]
}'


POST /v1/bc/btc/mainnet/wallets/demowallet/addresses HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
	"addresses" : ["1Eeu3eC2b35LWtjXeRMJMSfrDnfDEjNwW6", "13ZiD6gSv75aNKdRyoUN39R3oSZEPML7er"]
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/addresses",
  "method": "POST",
  "headers": {
    "content-type": "application/json",
    "authorization": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"addresses\" : [\"1Eeu3eC2b35LWtjXeRMJMSfrDnfDEjNwW6\", \"13ZiD6gSv75aNKdRyoUN39R3oSZEPML7er\"]\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "port": null,
  "path": "/v1/bc/btc/mainnet/wallets/demowallet/addresses",
  "headers": {
    "content-type": "application/json",
    "authorization": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ addresses: 
   [ '1Eeu3eC2b35LWtjXeRMJMSfrDnfDEjNwW6',
     '13ZiD6gSv75aNKdRyoUN39R3oSZEPML7er' ] }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/addresses');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'authorization' => 'my-api-key',
  'content-type' => 'application/json'
));

$request->setBody('{
	"addresses" : ["1Eeu3eC2b35LWtjXeRMJMSfrDnfDEjNwW6", "13ZiD6gSv75aNKdRyoUN39R3oSZEPML7er"]
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>



require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/addresses")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'my-api-key'
request.body = "{\n\t\"addresses\" : [\"1Eeu3eC2b35LWtjXeRMJMSfrDnfDEjNwW6\", \"13ZiD6gSv75aNKdRyoUN39R3oSZEPML7er\"]\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("api.cryptoapis.io")

payload = "{\n\t\"addresses\" : [\"1Eeu3eC2b35LWtjXeRMJMSfrDnfDEjNwW6\", \"13ZiD6gSv75aNKdRyoUN39R3oSZEPML7er\"]\n}"

headers = {
    'content-type': "application/json",
    'authorization': "my-api-key"
    }

conn.request("POST", "/v1/bc/btc/mainnet/wallets/demowallet/addresses", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"addresses\" : [\"1Eeu3eC2b35LWtjXeRMJMSfrDnfDEjNwW6\", \"13ZiD6gSv75aNKdRyoUN39R3oSZEPML7er\"]\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/addresses")
  .post(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/addresses"

	payload := strings.NewReader("{\n\t\"addresses\" : [\"1Eeu3eC2b35LWtjXeRMJMSfrDnfDEjNwW6\", \"13ZiD6gSv75aNKdRyoUN39R3oSZEPML7er\"]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")
	req.Header.Add("authorization", "my-api-key")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Response Body

{
  "payload": {
      "addresses": [
          "1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA",
          "1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5",
          "1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH",
          "1Ho72xi1JDv7inZ7BrLivJShSkcwARtP2R"
      ],
      "walletName": "wallet",
      "hd": false
  }
}
HTTP Request

POST /v1/bc/btc/${NETWORK}/wallets/${WALLET_NAME}/addresses

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)
WALLET_NAME ------- Wallet name
Request Wallet Object

{ "addresses" : ${ADDRESSES} }

This endpoint allows you to add public addresses to the $WALLET_NAME wallet, by POSTing a partially filled out Wallet object. You only need to include the additional addresses in a new addresses array in the object. If successful, it will return the newly modified Wallet, including an up-to-date, complete listing of addresses.

Generate Address in Wallet Endpoint

Code samples


#### normal wallet
curl -X POST \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/addresses/generate \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'

#### hd wallet
curl -X POST \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/demohdwallet/addresses/generate \
  -H 'content-type: application/json' \
  -H 'authorization: my-api-key' \
  -d '{
	"addressCount": 3,
	"password": "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32"
}'


#### normal wallet
POST /v1/bc/btc/mainnet/wallets/demowallet/addresses/generate HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

#### hd wallet
POST /v1/bc/btc/mainnet/wallets/hd/demohdwallet/addresses/generate HTTP/1.1
Host: api.cryptoapis.io
X-API-Key: my-api-key
Content-Type: application/json

{
	"addressCount": 3,
	"password": "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32"
}


// normal wallet
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/addresses/generate",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

// hd wallet
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/demohdwallet/addresses/generate",
  "method": "POST",
  "headers": {
    "authorization": "my-api-key",
    "content-type": "application/json"
  },
  "processData": false,
  "data": "{\n\t\"addressCount\": 3,\n\t\"password\": \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


// normal wallet
var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/wallets/demowallet/addresses/generate",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();

// hd wallet
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "port": null,
  "path": "/v1/bc/btc/mainnet/wallets/hd/demohdwallet/addresses/generate",
  "headers": {
    "authorization": "my-api-key",
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ addressCount: 3, password: '8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32' }));
req.end();

<?php

// noraml wallet
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/addresses/generate');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

// hd wallet
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/demohdwallet/addresses/generate');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'content-type' => 'application/json',
  'authorization' => 'my-api-key'
));

$request->setBody('{
	"addressCount": 3,
	"password": "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


#### noraml wallet
require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/addresses/generate")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body

#### hd wallet
require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/demohdwallet/addresses/generate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["authorization"] = 'my-api-key'
request["content-type"] = 'application/json'
request.body = "{\n\t\"addressCount\": 3,\n\t\"password\": \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}"

response = http.request(request)
puts response.read_body


#### normal wallet
import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "/v1/bc/btc/mainnet/wallets/demowallet/addresses/generate", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))

#### hd wallet
import http.client

conn = http.client.HTTPSConnection("api.cryptoapis.io")

payload = "{\n\t\"addressCount\": 3,\n\t\"password\": \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}"

headers = {
    'authorization': "my-api-key",
    'content-type': "application/json"
    }

conn.request("POST", "/v1/bc/btc/mainnet/wallets/hd/demohdwallet/addresses/generate", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


// normal wallet
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/addresses/generate")
  .post(null)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();

// hd wallet
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"addressCount\": 3,\n\t\"password\": \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/demohdwallet/addresses/generate")
  .post(body)
  .addHeader("authorization", "my-api-key")
  .addHeader("content-type", "application/json")
  .build();

Response response = client.newCall(request).execute();


// normal wallet
package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/addresses/generate"

    req, _ := http.NewRequest("POST", url, nil)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

// hd wallet
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/demohdwallet/addresses/generate"

	payload := strings.NewReader("{\n\t\"addressCount\": 3,\n\t\"password\": \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("authorization", "my-api-key")
	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Response Body

// normal wallet
{
  "payload": {
      "wallet_info": {
          "walletName": "demowallet",
          "addresses": [
              "1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA",
              "1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5",
              "1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH",
              "1Ho72xi1JDv7inZ7BrLivJShSkcwARtP2R"
          ],
          "hd": false,
      },
      "address_info": {
          "privateKey": "99d1ffc2264f57479e948405d97b50a09e2a197d4c7b9d4271fd6d0cc722f4f3",
          "address": "1Ho72xi1JDv7inZ7BrLivJShSkcwARtP2R",
          "publicKey": "03f2ff3a306245a78066636b2f3587dcddecbbcca2db0ab1ec2cbc257069853dde",
          "wif": "L2NiZnxNptPpZBNXYARaFV6vLonvZMNRp1hGYACbyzYxtYLmbGoZ",
      }
  }
}
// hd wallet
{
  "payload": {
      "addresses": [
          {
              "address": "122vgxpcubtve59mrMcqbpKAUMAK297KgK",
              "path": "M/0H/0/0"
          },
          {
              "address": "1AzDHE4YxngtgpcVekQpJZupcmKkXhwSRT",
              "path": "M/0H/0/1"
          },
          {
              "address": "17eaeKLqY7vNfyeE1yQ9WNJ6ZWLHdx2kmK",
              "path": "M/0H/0/2"
          },
          {
              "address": "1B8DBKwUZPQ5m2GmKxAnH4GaVLMNXmDEks",
              "path": "M/0H/0/3"
          },
          {
              "address": "1MrLV9fnq93Gdqg6uDDioZSDjKgnf866Ne",
              "path": "M/0H/0/4"
          },
          {
              "address": "1JQwoe3vFKNPA19MWwYL7jasuh9rwjznMz",
              "path": "M/0H/0/5"
          }
      ],
      "walletName": "demohdwallet",
      "hd": true
  }
}

HTTP Request

normal wallet

POST /v1/bc/btc/${NETWORK}/wallets/${WALLET_NAME}/addresses/generate

hd wallet

POST /v1/bc/btc/${NETWORK}/wallets/hd/${WALLET_NAME}/addresses/generate

Query Parameters
Parameter Default Description
NETWORK ------- Newtork name (e.g. testnet or mainnet)
WALLET_NAME ------- Wallet name
Request HD Wallet Object

{ "addressCount" : ${ADDRESS_COUNT}, "password" : ${ENCRYPTED_PASSWORD} } This endpoint allows you to generate a new address associated with the WALLET_NAME wallet, similar to the Generate Address Endpoint. If successful, it will returned the newly modified Wallet.

Remove Addresses from Wallet Endpoint

curl -X DELETE \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/address/1Ho72xi1JDv7inZ7BrLivJShSkcwARtP2R \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


DELETE /v1/bc/btc/mainnet/wallets/demowallet/address/1Ho72xi1JDv7inZ7BrLivJShSkcwARtP2R HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/address/1Ho72xi1JDv7inZ7BrLivJShSkcwARtP2R",
  "method": "DELETE",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "DELETE",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/wallets/demowallet/address/1Ho72xi1JDv7inZ7BrLivJShSkcwARtP2R",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/address/1Ho72xi1JDv7inZ7BrLivJShSkcwARtP2R');
$request->setMethod(HTTP_METH_DELETE);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>



require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/address/1Ho72xi1JDv7inZ7BrLivJShSkcwARtP2R")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  "Content-Type": "application/json",
  "X-API-Key", "my-api-key"
}

conn.request("DELETE", "/v1/bc/btc/mainnet/wallets/demowallet/address/1Ho72xi1JDv7inZ7BrLivJShSkcwARtP2R", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/address/1Ho72xi1JDv7inZ7BrLivJShSkcwARtP2R")
  .delete(null)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet/address/1Ho72xi1JDv7inZ7BrLivJShSkcwARtP2R"

    req, _ := http.NewRequest("DELETE", url, nil)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body

{
  "payload": {
      "message": "address 1Ho72xi1JDv7inZ7BrLivJShSkcwARtP2R was successfully deleted!"
  }
}
HTTP Request

DELETE /v1/bc/btc/${NETWORK}/wallets/${WALLET_NAME}/address/${ADDRESS}

Query Parameters
Parameter Default Description
NETWORK ------- Newtork name (e.g. testnet or mainnet)
WALLET_NAME ------- Wallet name
ADDRESS ------- Address which should be deleted

This endpoint allows you to delete an $ADDRESS associated with the WALLET_NAME wallet.

Delete Wallet Endpoint

#### normal wallet
curl -X DELETE \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'

#### hd wallet
curl -X DELETE \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/demohdwallet \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


#### normal wallet
DELETE /v1/bc/btc/mainnet/wallets/demowallet HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

#### hd wallet
DELETE /v1/bc/btc/mainnet/wallets/hd/demohdwallet HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


// normal wallet
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet",
  "method": "DELETE",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

//hd wallet
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/demohdwallet",
  "method": "DELETE",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


// normal wallet
var http = require("http");

var options = {
  "method": "DELETE",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/wallets/demowallet",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();

// hd wallet
var http = require("http");

var options = {
  "method": "DELETE",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/wallets/hd/demohdwallet",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

// normal wallet
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet');
$request->setMethod(HTTP_METH_DELETE);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

// hd wallet
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/demohdwallet');
$request->setMethod(HTTP_METH_DELETE);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>



#### normal wallet
require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


#### hd wallet
require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/demohdwallet")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


#### normal wallet
import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  "Content-Type": "application/json",
  "X-API-Key", "my-api-key"
}

conn.request("DELETE", "/v1/bc/btc/mainnet/wallets/demowallet", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))

#### hd wallet
import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("DELETE", "/v1/bc/btc/mainnet/wallets/hd/demohdwallet", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))



// normal wallet
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet")
  .delete(null)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();

// hd wallet
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/demohdwallet")
  .delete(null)
  .addHeader("content-type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


// normal wallet
package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/demowallet"

    req, _ := http.NewRequest("DELETE", url, nil)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.Defaubtclient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

// hd wallet
package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/wallets/hd/demohdwallet"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("content-type", "application/json")
	req.Header.Add("cache-control", "no-cache")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Response Body

{
  "payload": {
      "message": "Wallet demowallet was successfully deleted!"
  }
}

{
  "payload": {
      "message": "Wallet demohdwallet was successfully deleted!"
  }
}
HTTP Request

normal wallet

DELETE /v1/bc/btc/${NETWORK}/wallets/${WALLET_NAME}

hd wallet

DELETE /v1/bc/btc/${NETWORK}/wallets/hd/${WALLET_NAME}

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. mainnet or testnet)
WALLET_NAME ------- Wallet name

This endpoint deletes the Wallet or HD Wallet with WALLET_NAME. If successful, it will return an error message with no return object.

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. mainnet or testnet)
WALLET_NAME ------- Wallet name
ADDRESS ------- Address which should be deleted

Transaction API

Crypto APIs Transaction API allows you to look up information about unconfirmed transactions, query transactions based on hash, create and propagate your own transactions, including multisignature transactions, and embed data on the blockchain—all based on the coin/chain resource you’ve selected for your endpoints.

If you’re new to blockchains, the idea of transactions is relatively self-explanatory. Here’s what’s going on underneath the hood: a transaction takes previous “unspent transaction outputs” (also known as UTXOs) as “transaction inputs” and creates new “locking scripts” on those inputs such that they are “sent” to new addresses (to become new UTXOs). While most of these public addresses are reference points for single private keys that can “unlock” the newly created UTXOs, occasionally they are sent to more exotic addresses through pay-to-script-hash, typically multisignature addresses.

Generally speaking, UTXOs are generated from previous transactions (except for Coinbase inputs).

Transactions Txid Endpoint

Code samples


curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/txid/5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/mainnet/txs/txid/5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/txid/5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/txs/txid/5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/txid/5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/txid/5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/txid/5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2'
headers = {
  "Content-Type": "application/json",
  "X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/txid/5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/txid/5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2")
}

Response Body

{
  "payload": {
      "txid": "5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2",
      "hash": "5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2",
      "index": 1,
      "version": 1,
      "size": 158,
      "vsize": 158,
      "locktime": 0,
      "time": "2010-09-16 05:03:47 UTC",
      "blockhash": "000000000043a8c0fd1d6f726790caa2a406010d19efd2780db27bdbbd93baf6",
      "blockheight": 80000,
      "blocktime": "2010-09-16 05:03:47 UTC",
      "timestamp": 1284613427,
      "confirmations": 484349,
      "txins": [
          {
              "txout": "f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6",
              "vout": 0,
              "amount": "50.00000000",
              "addresses": [
                  "1JBSCVF6VM6QjFZyTnbpLjoCJTQEqVbepG"
              ],
              "script": {
                  "asm": "304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d1090db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b2415[ALL]",
                  "hex": "48304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d1090db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501"
              },
              "votype": "pubkey"
          }
      ],
      "txouts": [
          {
              "amount": "50.00000000",
              "type": "pubkeyhash",
              "spent": true,
              "addresses": [
                  "16ro3Jptwo4asSevZnsRX6vfRS24TGE6uK"
              ],
              "script": {
                  "asm": "OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549d OP_EQUALVERIFY OP_CHECKSIG",
                  "hex": "76a914404371705fa9bd789a2fcd52d2c580b65d35549d88ac",
                  "reqsigs": 1
              }
          }
      ]
  }
}
Info

The Transaction Txid Endpoint returns detailed information about a given transaction based on its id.

HTTP Request

GET /v1/bc/btc/${NETWORK}/txs/txid/${TXID}

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)
TXID ------- Id of the transaction in blockchain

TXID is a string representing the id of the block you’re interested in querying, for example:

5a4ebf66822b0b2d56bd9dc64ece0bc38ee7844a23ff1d7320a88c5fdb2ad3e2

The returned object contains information about the transaction in JSON format, including its block information, the total amount transacted with it (in bitcoins), the inputs and outputs, and more.

Transactions Block Endpoint

Code samples


curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/block/00000000000000000008b7233b8abb1519d0a1bc6579e209955539c303f3e6b1' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/mainnet/txs/block/00000000000000000008b7233b8abb1519d0a1bc6579e209955539c303f3e6b1 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


$.ajaxSetup({
  headers:{
    "Content-Type": "application/json" ,
    "X-API-Key": "my-api-key"
  }
});

$.get('https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/block/00000000000000000008b7233b8abb1519d0a1bc6579e209955539c303f3e6b1').then(function(d) {console.log(d)});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/txs/block/00000000000000000008b7233b8abb1519d0a1bc6579e209955539c303f3e6b1",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/block/00000000000000000008b7233b8abb1519d0a1bc6579e209955539c303f3e6b1');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/block/00000000000000000008b7233b8abb1519d0a1bc6579e209955539c303f3e6b1")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body


import requests
url = 'https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/block/00000000000000000008b7233b8abb1519d0a1bc6579e209955539c303f3e6b1'
headers = {
  "Content-Type": "application/json",
  "X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/block/00000000000000000008b7233b8abb1519d0a1bc6579e209955539c303f3e6b1")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


import (
  "gopkg.in/resty.v0"
)

func main()
{
    resp, err := resty.R().
      SetHeader("Content-Type", "application/json").
      SetHeader("X-API-Key", "my-api-key").
      Get("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/block/00000000000000000008b7233b8abb1519d0a1bc6579e209955539c303f3e6b1")
}

Response Body

{
    "payload": [
            {
              "txid": "8bb6329aac853def9f99161e584145eade14e3f6499e74e03e14b30c3650f8f7",
              "hash": "0bb7409e661a0c2785b4c9e716e92148e6f2bdae32013773c2220308193a3bfe",
              "index": 0,
              "version": 1,
              "size": 5167,
              "vsize": 5140,
              "locktime": 0,
              "time": "2018-10-07 03:13:38 UTC",
              "blockhash": "00000000000000000008b7233b8abb1519d0a1bc6579e209955539c303f3e6b1",
              "blockheight": 544704,
              "blocktime": "2018-10-07 03:13:38 UTC",
              "timestamp": 1538882018,
              "txins": [
                  {
                      "coinbase": "03c04f080004cc79b95b042af18a0d0cfaac655d6f050000000000000a636b706f6f6c0c2f636b706f6f6c2e6f72672f"
                  }
              ],
              "txouts": [
                  {
                      "amount": "3.63760569",
                      "type": "scripthash",
                      "spent": true,
                      "addresses": [
                          "32LA7cmsj35LH7cK1MjvwyoLEmYpuWAD9k"
                      ],
                      "script": {
                          "asm": "OP_HASH160 07063a601afa20bedc42930fab7b02bc02f3f58b OP_EQUAL",
                          "hex": "a91407063a601afa20bedc42930fab7b02bc02f3f58b87",
                          "reqsigs": 1
                      }
                  },
                  ...
                  {
                      "amount": "0.00000000",
                      "type": "nulldata",
                      "spent": true,
                      "script": {
                          "asm": "OP_RETURN aa21a9ed1a18b5f23c9f15697a96677281e9dfd369ad33b67e9d2a4b6b525311d586245c",
                          "hex": "6a24aa21a9ed1a18b5f23c9f15697a96677281e9dfd369ad33b67e9d2a4b6b525311d586245c"
                      }
                  }
              ]
            }
  ],
  "meta": {
      "totalCount": 56,
      "index": 0,
      "limit": 50,
      "results": 50
  }
}
Info

The Transaction Index by Block Endpoint returns detailed information about a list of transactions. The endpoint is useable both with block height and block hash. index and limit query parameters might also be used, as their default values are, as follows: 0, 1. Therefore, if none is specified the returned object will be the first transaction (the coinbase transaction) included in the block.

HTTP Request

GET /v1/bc/btc/${NETWORK}/txs/block/${BLOCK}?index=0&limit=1

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)
BLOCK ------- Block height or block hash in blockchain
index 0 index to start from
limit 1 number of transactions to be returned
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria

BLOCK is a string or an integer representing the hash or the height of the block you’re interested in querying, for example:

00000000000000000008b7233b8abb1519d0a1bc6579e209955539c303f3e6b1

or

544704

The returned object contains information about the transaction in JSON format, including its block information, the total amount transacted with it (in bitcoins), the inputs and outputs, and more.

Unconfirmed Transactions Endpoint

Code samples


curl -X POST 'https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/unconfirmed' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/mainnet/txs HTTP/1.1
Host: api.cryptoapis.io
X-API-Key: my-api-key
Content-Type: application/json


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/unconfirmed",
  "method": "GET",
  "headers": {
    "authorization": "my-api-key",
    "content-type": "application/json"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("https");

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "port": null,
  "path": "/v1/bc/btc/mainnet/txs",
  "headers": {
    "authorization": "my-api-key",
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/unconfirmed');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'content-type' => 'application/json',
  'authorization' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/unconfirmed")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import requests

url = "https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/unconfirmed"

headers = {
    'content-type': "application/json",
    'authorization': "my-api-key"
    }

response = requests.request("GET", url, headers=headers)

print(response.text)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/unconfirmed")
  .get()
  .addHeader("authorization", "my-api-key")
  .addHeader("content-type", "application/json")
  .build();

Response response = client.newCall(request).execute();


package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/unconfirmed"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("authorization", "my-api-key")
	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Response Body

{
    "payload": [
            {
                "txid": "e54b1d0a9f946a488cadaa948ac7fc570fe5fcbe7ee3b0449c973021d3a303d5",
                "hash": "e54b1d0a9f946a488cadaa948ac7fc570fe5fcbe7ee3b0449c973021d3a303d5",
                "version": 2,
                "size": 191,
                "vsize": 191,
                "locktime": 1481958,
                "time": "2019-02-27 12:11:18 UTC",
                "timestamp": 1551269478,
                "txins": [
                    {
                        "txout": "6ba5421b3db08039c6c08cbac43eb4e9d79bb3e58f4d9e1dc36fbf446f8c5b45",
                        "vout": 0,
                        "amount": "4.03748536",
                        "addresses": [
                            "msPLQLf2MdSKm1psLMXwGdTSzpFwJzDEYv"
                        ],
                        "script": {
                            "asm": "30440220675913704ff2b07217b6a04eac977593aafdd0e1f66c44c8bd56c969c5499130022013c660b2b75747d774fb781161b9bd22e553028490acce83e28c182d358666b7[ALL] 0214e7d2765c60b92d010b5b72680b03ddebef783ebf5bad004bad6273ee1e6833",
                            "hex": "4730440220675913704ff2b07217b6a04eac977593aafdd0e1f66c44c8bd56c969c5499130022013c660b2b75747d774fb781161b9bd22e553028490acce83e28c182d358666b701210214e7d2765c60b92d010b5b72680b03ddebef783ebf5bad004bad6273ee1e6833"
                        },
                        "votype": "pubkeyhash"
                    }
                ],
                "txouts": [
                    {
                        "amount": "4.03748344",
                        "type": "pubkeyhash",
                        "spent": false,
                        "addresses": [
                            "mvE9nxwUnP7bxJmNVw5NWki7tu8u3AHW6K"
                        ],
                        "script": {
                            "asm": "OP_DUP OP_HASH160 a15c69f1cb00562b6379de144faf9c75e8f305f4 OP_EQUALVERIFY OP_CHECKSIG",
                            "hex": "76a914a15c69f1cb00562b6379de144faf9c75e8f305f488ac",
                            "reqsigs": 1
                        }
                    }
                ]
            },
            {
                "txid": "237615a7a1222990599d9a154b99d9c2fa7106eea8f0c313d8045e461a593b88",
                "hash": "237615a7a1222990599d9a154b99d9c2fa7106eea8f0c313d8045e461a593b88",
                "version": 1,
                "size": 192,
                "vsize": 192,
                "locktime": 0,
                "time": "2019-02-27 12:11:15 UTC",
                "timestamp": 1551269475,
                "txins": [
                    {
                        "txout": "cd8a29eddbcc58c704a075fe23e05ea094abd19160605b05f701b7568da6a49d",
                        "vout": 1,
                        "amount": "0.12241585",
                        "addresses": [
                            "ms1TnG8UQGstnWHtoPfcj8HDivhPStrZj3"
                        ],
                        "script": {
                            "asm": "3045022100e9f80af7f7d27137d13f51f091a0242c5c7bf95843e66e4aefe401b0a8df28f402201246db81055e6d0a5e27aebbf217865e2fa11a09110ba9aca2d7af9510bff495[ALL] 03eb9806e12f77ab01ae8280073dfd7f61f9f8a99e1292ff82de7ac37b6d959693",
                            "hex": "483045022100e9f80af7f7d27137d13f51f091a0242c5c7bf95843e66e4aefe401b0a8df28f402201246db81055e6d0a5e27aebbf217865e2fa11a09110ba9aca2d7af9510bff495012103eb9806e12f77ab01ae8280073dfd7f61f9f8a99e1292ff82de7ac37b6d959693"
                        },
                        "votype": "pubkeyhash"
                    }
                ],
                "txouts": [
                    {
                        "amount": "0.12236885",
                        "type": "pubkeyhash",
                        "spent": false,
                        "addresses": [
                            "mpfb93q3hN8Cw5SqxTHBuqfUS6pZTtMNAs"
                        ],
                        "script": {
                            "asm": "OP_DUP OP_HASH160 645b3758b9ee9879a65b8cf92cd0fc2b07fb693d OP_EQUALVERIFY OP_CHECKSIG",
                            "hex": "76a914645b3758b9ee9879a65b8cf92cd0fc2b07fb693d88ac",
                            "reqsigs": 1
                        }
                    }
                ]
            },
            ...
    ],
    "meta": {
        "totalCount": 106,
        "index": 0,
        "limit": 50,
        "results": 106
    }
}
Info

The Unconfirmed Transactions Endpoint returns an array of the latest transactions relayed by nodes in a blockchain that haven’t been included in any blocks.

HTTP Request

GET /v1/bc/btc/${NETWORK}/txs/unconfirmed?index=0&limit=100

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)
index 0 skip parameter
limit ------- Sets the number of returned txs
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria

The returned object is an array of transactions that haven’t been included in blocks, arranged in reverse chronological order (latest is first, then older transactions follow).

Decode Raw Transactions Endpoint

Code samples


curl -X POST \
 https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/decode \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key' \
  -d '{
    "hex": "0200000005c1ab663c05cc557f522d55d42734eb3fe7bfacf3737cba5102233b312b0c95590000000000ffffffffbfd5dc9ac3129f2a9788d0ab2c201861790d66ce147bf6ebe8ee44019b69ed790100000000ffffffff2837839555246cc3f0f9374f73030341d641f3beae71eeafb2461f8ba8daa1d40000000000ffffffffbe23166dca2f0b9a24d9704e5e6ecfe3e57265cda29468e68c19644d24e1f1c70000000000ffffffff41994176b4bb3f00bb128a982b907e0a3b139ac02d90253c61815dea3d16f98d0000000000ffffffff0140420f00000000001976a9141a96349a5025735fe18f3e783098e471edbad83388ac00000000"
}'


POST /v1/bc/btc/mainnet/txs/decode HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
    "hex": "0200000005c1ab663c05cc557f522d55d42734eb3fe7bfacf3737cba5102233b312b0c95590000000000ffffffffbfd5dc9ac3129f2a9788d0ab2c201861790d66ce147bf6ebe8ee44019b69ed790100000000ffffffff2837839555246cc3f0f9374f73030341d641f3beae71eeafb2461f8ba8daa1d40000000000ffffffffbe23166dca2f0b9a24d9704e5e6ecfe3e57265cda29468e68c19644d24e1f1c70000000000ffffffff41994176b4bb3f00bb128a982b907e0a3b139ac02d90253c61815dea3d16f98d0000000000ffffffff0140420f00000000001976a9141a96349a5025735fe18f3e783098e471edbad83388ac00000000"
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/decode",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"hex\": \"0200000005c1ab663c05cc557f522d55d42734eb3fe7bfacf3737cba5102233b312b0c95590000000000ffffffffbfd5dc9ac3129f2a9788d0ab2c201861790d66ce147bf6ebe8ee44019b69ed790100000000ffffffff2837839555246cc3f0f9374f73030341d641f3beae71eeafb2461f8ba8daa1d40000000000ffffffffbe23166dca2f0b9a24d9704e5e6ecfe3e57265cda29468e68c19644d24e1f1c70000000000ffffffff41994176b4bb3f00bb128a982b907e0a3b139ac02d90253c61815dea3d16f98d0000000000ffffffff0140420f00000000001976a9141a96349a5025735fe18f3e783098e471edbad83388ac00000000\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/txs/decode",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ hex: '0200000005c1ab663c05cc557f522d55d42734eb3fe7bfacf3737cba5102233b312b0c95590000000000ffffffffbfd5dc9ac3129f2a9788d0ab2c201861790d66ce147bf6ebe8ee44019b69ed790100000000ffffffff2837839555246cc3f0f9374f73030341d641f3beae71eeafb2461f8ba8daa1d40000000000ffffffffbe23166dca2f0b9a24d9704e5e6ecfe3e57265cda29468e68c19644d24e1f1c70000000000ffffffff41994176b4bb3f00bb128a982b907e0a3b139ac02d90253c61815dea3d16f98d0000000000ffffffff0140420f00000000001976a9141a96349a5025735fe18f3e783098e471edbad83388ac00000000' }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/decode');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
    "hex": "0200000005c1ab663c05cc557f522d55d42734eb3fe7bfacf3737cba5102233b312b0c95590000000000ffffffffbfd5dc9ac3129f2a9788d0ab2c201861790d66ce147bf6ebe8ee44019b69ed790100000000ffffffff2837839555246cc3f0f9374f73030341d641f3beae71eeafb2461f8ba8daa1d40000000000ffffffffbe23166dca2f0b9a24d9704e5e6ecfe3e57265cda29468e68c19644d24e1f1c70000000000ffffffff41994176b4bb3f00bb128a982b907e0a3b139ac02d90253c61815dea3d16f98d0000000000ffffffff0140420f00000000001976a9141a96349a5025735fe18f3e783098e471edbad83388ac00000000"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/decode")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"hex\": \"0200000005c1ab663c05cc557f522d55d42734eb3fe7bfacf3737cba5102233b312b0c95590000000000ffffffffbfd5dc9ac3129f2a9788d0ab2c201861790d66ce147bf6ebe8ee44019b69ed790100000000ffffffff2837839555246cc3f0f9374f73030341d641f3beae71eeafb2461f8ba8daa1d40000000000ffffffffbe23166dca2f0b9a24d9704e5e6ecfe3e57265cda29468e68c19644d24e1f1c70000000000ffffffff41994176b4bb3f00bb128a982b907e0a3b139ac02d90253c61815dea3d16f98d0000000000ffffffff0140420f00000000001976a9141a96349a5025735fe18f3e783098e471edbad83388ac00000000\"\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n\t\"hex\": \"0200000005c1ab663c05cc557f522d55d42734eb3fe7bfacf3737cba5102233b312b0c95590000000000ffffffffbfd5dc9ac3129f2a9788d0ab2c201861790d66ce147bf6ebe8ee44019b69ed790100000000ffffffff2837839555246cc3f0f9374f73030341d641f3beae71eeafb2461f8ba8daa1d40000000000ffffffffbe23166dca2f0b9a24d9704e5e6ecfe3e57265cda29468e68c19644d24e1f1c70000000000ffffffff41994176b4bb3f00bb128a982b907e0a3b139ac02d90253c61815dea3d16f98d0000000000ffffffff0140420f00000000001976a9141a96349a5025735fe18f3e783098e471edbad83388ac00000000\"\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "/v1/bc/btc/mainnet/txs/decode", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"hex\": \"0200000005c1ab663c05cc557f522d55d42734eb3fe7bfacf3737cba5102233b312b0c95590000000000ffffffffbfd5dc9ac3129f2a9788d0ab2c201861790d66ce147bf6ebe8ee44019b69ed790100000000ffffffff2837839555246cc3f0f9374f73030341d641f3beae71eeafb2461f8ba8daa1d40000000000ffffffffbe23166dca2f0b9a24d9704e5e6ecfe3e57265cda29468e68c19644d24e1f1c70000000000ffffffff41994176b4bb3f00bb128a982b907e0a3b139ac02d90253c61815dea3d16f98d0000000000ffffffff0140420f00000000001976a9141a96349a5025735fe18f3e783098e471edbad83388ac00000000\"\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/decode")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/decode"

    payload := strings.NewReader("{\n\t\"hex\": \"0200000005c1ab663c05cc557f522d55d42734eb3fe7bfacf3737cba5102233b312b0c95590000000000ffffffffbfd5dc9ac3129f2a9788d0ab2c201861790d66ce147bf6ebe8ee44019b69ed790100000000ffffffff2837839555246cc3f0f9374f73030341d641f3beae71eeafb2461f8ba8daa1d40000000000ffffffffbe23166dca2f0b9a24d9704e5e6ecfe3e57265cda29468e68c19644d24e1f1c70000000000ffffffff41994176b4bb3f00bb128a982b907e0a3b139ac02d90253c61815dea3d16f98d0000000000ffffffff0140420f00000000001976a9141a96349a5025735fe18f3e783098e471edbad83388ac00000000\"\n}")

    req, _ := http.NewRequest("POST", url, payload)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body

{
  "payload": {
      "txid": "9e45e9998d376a3f59043d1c81cfc698af92f3e9fd5d8e4a0fa0ec66729b40de",
      "hash": "9e45e9998d376a3f59043d1c81cfc698af92f3e9fd5d8e4a0fa0ec66729b40de",
      "size": 249,
      "vsize": 249,
      "version": 2,
      "locktime": 0,
      "vin": [
          {
              "txid": "59950c2b313b230251ba7c73f3acbfe73feb3427d4552d527f55cc053c66abc1",
              "sequence": 4294967295,
              "vout": 0,
              "scriptSig": {}
          },
          {
              "txid": "79ed699b0144eee8ebf67b14ce660d796118202cabd088972a9f12c39adcd5bf",
              "sequence": 4294967295,
              "vout": 1,
              "scriptSig": {}
          },
          {
              "txid": "d4a1daa88b1f46b2afee71aebef341d6410303734f37f9f0c36c245595833728",
              "sequence": 4294967295,
              "vout": 0,
              "scriptSig": {}
          },
          {
              "txid": "c7f1e1244d64198ce66894a2cd6572e5e3cf6e5e4e70d9249a0b2fca6d1623be",
              "sequence": 4294967295,
              "vout": 0,
              "scriptSig": {}
          },
          {
              "txid": "8df9163dea5d81613c25902dc09a133b0a7e902b988a12bb003fbbb476419941",
              "sequence": 4294967295,
              "vout": 0,
              "scriptSig": {}
          }
      ],
      "vout": [
          {
              "value": "0.01",
              "n": 0,
              "scriptPubKey": {
                  "asm": "OP_DUP OP_HASH160 1a96349a5025735fe18f3e783098e471edbad833 OP_EQUALVERIFY OP_CHECKSIG",
                  "hex": "76a9141a96349a5025735fe18f3e783098e471edbad83388ac",
                  "reqSigs": 1,
                  "type": "pubkeyhash",
                  "addresses": [
                      "13RaWSweWrGHPKNaRCRu14HtsCUgKNbLUp"
                  ]
              }
          }
      ]
  }
}
Info

We also offer the ability to decode raw transactions without sending propagating them to the network; perhaps you want to double-check another client library or confirm that another service is sending proper transactions.

HTTP Request

POST /v1/bc/btc/${NETWORK}/txs/decode

Request Object

{ "hex": "${HEX}" }

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. mainnet or mainnet)
HEX ------- hex of raw transaction

$HEX is a hex-encoded raw representation of your transaction, for example:

0200000005c1ab663c05cc557f522d55d42734eb3fe7bfacf3737cba5102233b312b0c95590000000000ffffffffbfd5dc9ac3129f2a9788d0ab2c201861790d66ce147bf6ebe8ee44019b69ed790100000000ffffffff2837839555246cc3f0f9374f73030341d641f3beae71eeafb2461f8ba8daa1d40000000000ffffffffbe23166dca2f0b9a24d9704e5e6ecfe3e57265cda29468e68c19644d24e1f1c70000000000ffffffff41994176b4bb3f00bb128a982b907e0a3b139ac02d90253c61815dea3d16f98d0000000000ffffffff0140420f00000000001976a9141a96349a5025735fe18f3e783098e471edbad83388ac00000000

If it succeeds, you’ll receive your decoded TX object.

Creating Transactions Endpoint
Info

Using Crypto APIs, you can push transactions to blockchains one of two ways:

Use our two-endpoint process outlined below, wherein we generate a TXSkeleton based on your input address, output address, and value to transfer. In either case, for security reasons, we never take possession of your private keys. We do use private keys with our Microtransaction API, but they are for low-value transactions and we discard them immediately from our servers’ memory.

New Transaction Endpoint

Code samples


curl -X POST \
  https://api.cryptoapis.io/v1/bc/btc/testnet/txs/create \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key' \
  -d '{
    "inputs": [{
        "address": "mtFYoSowT3i649wnBDYjCjewenh8AuofQb",
        "value": 0.0004
    }, {
        "address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
        "value": 0.0004
    }],
    "outputs": [{
        "address": "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9",
        "value": 0.0018
    }],
    
    "fee":  {
    	"address" : "mtFYoSowT3i649wnBDYjCjewenh8AuofQb",
        "value": 0.00023141
    }
}'

POST /v1/bc/btc/testnet/txs/create HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
    "inputs": [{
        "address": "mtFYoSowT3i649wnBDYjCjewenh8AuofQb",
        "value": 0.0004
    }, {
        "address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
        "value": 0.0004
    }],
    "outputs": [{
        "address": "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9",
        "value": 0.0018
    }],
    
    "fee":  {
    	"address" : "mtFYoSowT3i649wnBDYjCjewenh8AuofQb",
        "value": 0.00023141
    }
}

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/testnet/txs/create",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n    \"inputs\": [{\n        \"address\": \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n        \"value\": 0.0004\n    }, {\n        \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n        \"value\": 0.0004\n    }],\n    \"outputs\": [{\n        \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n        \"value\": 0.0018\n    }],\n    \n    \"fee\":  {\n    \t\"address\" : \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n        \"value\": 0.00023141\n    }\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/txs/new",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ inputs: 
   [ { address: 'mtFYoSowT3i649wnBDYjCjewenh8AuofQb', value: 0.0004 },
     { address: 'mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1', value: 0.0004 } ],
  outputs: [ { address: 'mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9', value: 0.0018 } ],
  fee: 
   { address: 'mtFYoSowT3i649wnBDYjCjewenh8AuofQb',
     value: 0.00023141 } }));
req.end();

<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/testnet/txs/create');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
    "inputs": [{
        "address": "mtFYoSowT3i649wnBDYjCjewenh8AuofQb",
        "value": 0.0004
    }, {
        "address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
        "value": 0.0004
    }],
    "outputs": [{
        "address": "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9",
        "value": 0.0018
    }],
    
    "fee":  {
    	"address" : "mtFYoSowT3i649wnBDYjCjewenh8AuofQb",
        "value": 0.00023141
    }
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/testnet/txs/create")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n    \"inputs\": [{\n        \"address\": \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n        \"value\": 0.0004\n    }, {\n        \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n        \"value\": 0.0004\n    }],\n    \"outputs\": [{\n        \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n        \"value\": 0.0018\n    }],\n    \n    \"fee\":  {\n    \t\"address\" : \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n        \"value\": 0.00023141\n    }\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n    \"inputs\": [{\n        \"address\": \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n        \"value\": 0.0004\n    }, {\n        \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n        \"value\": 0.0004\n    }],\n    \"outputs\": [{\n        \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n        \"value\": 0.0018\n    }],\n    \n    \"fee\":  {\n    \t\"address\" : \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n        \"value\": 0.00023141\n    }\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "/v1/bc/btc/testnet/txs/create, payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"inputs\": [{\n        \"address\": \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n        \"value\": 0.0004\n    }, {\n        \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n        \"value\": 0.0004\n    }],\n    \"outputs\": [{\n        \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n        \"value\": 0.0018\n    }],\n    \n    \"fee\":  {\n    \t\"address\" : \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n        \"value\": 0.00023141\n    }\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/testnet/txs/create")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/testnet/txs/create"

    payload := strings.NewReader("{\n    \"inputs\": [{\n        \"address\": \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n        \"value\": 0.0004\n    }, {\n        \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n        \"value\": 0.0004\n    }],\n    \"outputs\": [{\n        \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n        \"value\": 0.0018\n    }],\n    \n    \"fee\":  {\n    \t\"address\" : \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n        \"value\": 0.00023141\n    }\n}")

    req, _ := http.NewRequest("POST", url, payload)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "hex": "0200000002fba29356aed5f478c9a3ca49937e1574e7437b90f1c5e68cf2806c8d25b598e20000000000ffffffff224693e22c8c442ed336c0ad0f9d7e0c20d960eeef9224e28d8c9dd198ca27480000000000ffffffff0332400f00000000001976a914b20ecbedbb8c648e263487d40ab234cecefd34d588ac80da2d09000000001976a9141a96349a5025735fe18f3e783098e471edbad83388acb2929800000000001976a9140c63413d9b2c5d7333e2dfec21c6efa27cf8bbe888ac00000000"
      }
}

To use Crypto APIs two-endpoint transaction creation tool, first you need to provide the input address(es), output address, and value to transfer (in bitcoin). Provide this in a partially-filled out TX request object.

HTTP Request

POST /v1/bc/btc/${NETWORK}/txs/create

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. mainnet or mainnet)

As you can see from the code example, you only need to provide a single public address within the addresses array of both the input and output of your TX request object. You also need to fill in the value with the amount you’d like to transfer from one address to another.

While this particular usage will differ between client libraries, the result is the same: the addresses within your wallet will be used as the inputs, as if all of them had been placed within the addresses array.

As a return object, you’ll receive a JSON containing a slightly-more complete TX alongside data you need to sign in the tosign array. You’ll need this object for the next steps of the transaction creation process

Validating the Data to Sign

For the extra cautious, you can protect yourself from a potential malicious attack on Crypto APIs by validating the data we’re asking you to sign. Unfortunately, it’s impossible to do so directly, as pre-signed signature data is hashed twice using SHA256. To get around this, set the includeToSignTx URL flag to true. The optional tosign_tx array will be returned within the JSON, which you can use in the following way:

Sign Transactions Endpoint

Code samples


curl -X POST \
  https://api.cryptoapis.io/v1/bc/btc/testnet/txs/sign \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key' \
  -d '{
    "hex":"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000",
    "wifs" : [
              "cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud"
    ]
}'

POST /v1/bc/btc/testnet/txs/sign HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
    "hex":"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000",
    "wifs" : [
              "cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud"
    ]
}

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/testnet/txs/sign",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n    \"hex\":\"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n    \"wifs\" : [\n              \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\"\n    ]\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/txs/sign",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ hex: '020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000',
  wifs: [ 'cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud' ] }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/testnet/txs/sign');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
    "hex":"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000",
    "wifs" : [
              "cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud"
    ]
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/testnet/txs/sign")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n    \"hex\":\"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n    \"wifs\" : [\n              \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\"\n    ]\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n    \"hex\":\"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n    \"wifs\" : [\n              \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\"\n    ]\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "/v1/bc/btc/testnet/txs/sign", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"hex\":\"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n    \"wifs\" : [\n              \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\"\n    ]\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/testnet/txs/sign")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/testnet/txs/sign"

	  payload := strings.NewReader("{\n    \"hex\":\"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n    \"wifs\" : [\n              \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\"\n    ]\n}")

    req, _ := http.NewRequest("POST", url, payload)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))
}

Response Body

{
    "payload": {
        "hex": "020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd981000000006a47304402202769801183cd50eb2bd6c316a55add49fa4c0fd7216b523f394b97fe410b582d02205c76f4009b38b82a20f88b5f6af45f09220ba43d7e1c2064fa74807ddb299d7f012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be0010000006a47304402204a24a1de4b4e552d1f53121825d139b1d1739d149df5a01d2ead760b865635c2022047a9b8f4d29dac29e9eacff6aea67249dcf716d576a00dbe24cf92c34a272909012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be0020000006a473044022057a3fa58744fffebcb8a1bea4a99bd61049678d4ee9250c5f66ea17198ebd97a022078abef9098838d06e9a51099ce010f0dc74c6b1284de03a929bcdabab8fd4cd40121039299b5f32a4834e27662397b7ade9cacdd9cd7243b83c039c22da3c6dc0b28c7ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000",
        "complete": true
    }
}
Info

The Sign Transactions Endpoint allows users to sign a raw transaction.

HTTP Request

POST /v1/bc/btc/${NETWORK}/txs/sign

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)

The returned object is a hexadecimal string that represents the signed transaction. This hexadecimal is used by the Send Transactions Endpoint in order to broadcast the transaction into the Bitcoin blockchain.

Send Transactions Endpoint

Code samples


curl -X POST \
  https://api.cryptoapis.io/v1/bc/btc/testnet/txs/send/ \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key' \
  -d '{
    "hex" : "02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000"
  }'

POST /v1/bc/btc/testnet/txs/send HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
    "hex" : RequestMethod"02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000"
}

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/testnet/txs/send",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"hex\" : \"02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/txs/send",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ hex: '02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000' }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/testnet/txs/send');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
    "hex" : "02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/testnet/txs/send")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"hex\" : \"02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000\"\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n\t\"hex\" : \"02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000\"\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "/v1/bc/btc/testnet/txs/send", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"hex\" : \"02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000\"\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/testnet/txs/send")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/testnet/txs/send"

    payload := strings.NewReader("{\n\t\"hex\" : \"02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000\"\n}")

    req, _ := http.NewRequest("POST", url, payload)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body

{
  "payload": {
      "txid": "dd033f3d0639f9ed7fdcef5966d931e833f13364cdf7c742af0ea5f04806bc62"
  }
}

Transaction Send Endpoint allows users to broadcast the signed transaction to the Bitcoin blockchain.

HTTP Request

POST /v1/bc/btc/${NETWORK}/txs/send

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. mainnet or testnet)

If broadcasting is successful, you’ll receive a JSON with the hash of the unconfirmed transaction.

New Transaction Endpoint

Code samples

curl -X POST \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/new \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key' \
  -d '{
	"createTx": { 
			"inputs": [{
			"address": "mtFYoSowT3i649wnBDYjCjewenh8AuofQb",
			"value": 0.00009
		}, {
			"address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
			"value": 0.00004
		}, {
			"address": "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9",
			"value": 0.00005
		}],
		"outputs": [{
			"address": "mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
			"value": 0.00018
		}],
		
		"fee":  {
			"address": "mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
			"value": 0.00023141
		}
	}, 
	 "wifs" : [
            "cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX", "cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud", "cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ"
    ]
}'
POST /v1/bc/btc/mainnet/txs/new HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
    "createTx": { 
            "inputs": [{
            "address": "mtFYoSowT3i649wnBDYjCjewenh8AuofQb",
            "value": 0.00009
        }, {
            "address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
            "value": 0.00004
        }, {
            "address": "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9",
            "value": 0.00005
        }],
        "outputs": [{
            "address": "mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
            "value": 0.00018
        }],
        
        "fee":  {
            "address": "mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
            "value": 0.00023141
        }
    }, 
        "wifs" : [
            "cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX", "cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud", "cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ"
    ]
}

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/new",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"createTx\": { \n\t\t\t\"inputs\": [{\n\t\t\t\"address\": \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n\t\t\t\"value\": 0.00009\n\t\t}, {\n\t\t\t\"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n\t\t\t\"value\": 0.00004\n\t\t}, {\n\t\t\t\"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n\t\t\t\"value\": 0.00005\n\t\t}],\n\t\t\"outputs\": [{\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00018\n\t\t}],\n\t\t\n\t\t\"fee\":  {\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00023141\n\t\t}\n\t}, \n\t \"wifs\" : [\n            \"cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX\", \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\", \"cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ\"\n    ]\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/txs/new",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ createTx: 
   { inputs: 
      [ { address: 'mtFYoSowT3i649wnBDYjCjewenh8AuofQb',
          value: 0.00009 },
        { address: 'mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1',
          value: 0.00004 },
        { address: 'mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9',
          value: 0.00005 } ],
     outputs: 
      [ { address: 'mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz',
          value: 0.00018 } ],
     fee: 
      { address: 'mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz',
        value: 0.00023141 } },
  wifs: 
   [ 'cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX',
     'cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud',
     'cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ' ] }));
req.end();

<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/new');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
	"createTx": { 
			"inputs": [{
			"address": "mtFYoSowT3i649wnBDYjCjewenh8AuofQb",
			"value": 0.00009
		}, {
			"address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
			"value": 0.00004
		}, {
			"address": "mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9",
			"value": 0.00005
		}],
		"outputs": [{
			"address": "mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
			"value": 0.00018
		}],
		
		"fee":  {
			"address": "mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
			"value": 0.00023141
		}
	}, 
	 "wifs" : [
            "cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX", "cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud", "cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ"
    ]
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/new")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"createTx\": { \n\t\t\t\"inputs\": [{\n\t\t\t\"address\": \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n\t\t\t\"value\": 0.00009\n\t\t}, {\n\t\t\t\"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n\t\t\t\"value\": 0.00004\n\t\t}, {\n\t\t\t\"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n\t\t\t\"value\": 0.00005\n\t\t}],\n\t\t\"outputs\": [{\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00018\n\t\t}],\n\t\t\n\t\t\"fee\":  {\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00023141\n\t\t}\n\t}, \n\t \"wifs\" : [\n            \"cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX\", \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\", \"cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ\"\n    ]\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n\t\"createTx\": { \n\t\t\t\"inputs\": [{\n\t\t\t\"address\": \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n\t\t\t\"value\": 0.00009\n\t\t}, {\n\t\t\t\"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n\t\t\t\"value\": 0.00004\n\t\t}, {\n\t\t\t\"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n\t\t\t\"value\": 0.00005\n\t\t}],\n\t\t\"outputs\": [{\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00018\n\t\t}],\n\t\t\n\t\t\"fee\":  {\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00023141\n\t\t}\n\t}, \n\t \"wifs\" : [\n            \"cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX\", \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\", \"cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ\"\n    ]\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "/v1/bc/btc/mainnet/txs/new", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"createTx\": { \n\t\t\t\"inputs\": [{\n\t\t\t\"address\": \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n\t\t\t\"value\": 0.00009\n\t\t}, {\n\t\t\t\"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n\t\t\t\"value\": 0.00004\n\t\t}, {\n\t\t\t\"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n\t\t\t\"value\": 0.00005\n\t\t}],\n\t\t\"outputs\": [{\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00018\n\t\t}],\n\t\t\n\t\t\"fee\":  {\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00023141\n\t\t}\n\t}, \n\t \"wifs\" : [\n            \"cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX\", \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\", \"cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ\"\n    ]\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/new")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();
package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/new"

 	payload := strings.NewReader("{\n\t\"createTx\": { \n\t\t\t\"inputs\": [{\n\t\t\t\"address\": \"mtFYoSowT3i649wnBDYjCjewenh8AuofQb\",\n\t\t\t\"value\": 0.00009\n\t\t}, {\n\t\t\t\"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n\t\t\t\"value\": 0.00004\n\t\t}, {\n\t\t\t\"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n\t\t\t\"value\": 0.00005\n\t\t}],\n\t\t\"outputs\": [{\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00018\n\t\t}],\n\t\t\n\t\t\"fee\":  {\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00023141\n\t\t}\n\t}, \n\t \"wifs\" : [\n            \"cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX\", \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\", \"cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ\"\n    ]\n}")

    req, _ := http.NewRequest("POST", url, payload)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))
}

Response Body

{
  "payload": {
      "txid":"81d98bb1d434077c800bdcfa66f7b49e07479219ed794e498b97fd021abad393"
  }
}

The New Transaction Endpoint combines the other three endpoints: Create, Sign and Send Endpoints. Users should provide the inputs and outputs fields with the corresponding data, as well as the fee and the wifs(private ECDSA keys) of the addresses. Therefore, the endpoint creates, signs and broadcasts the new transaction to the Bitcoin Blockchain. For more information, see the examples.

HTTP Request

POST /v1/bc/btc/${NETWORK}/txs/new

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. mainnet or mainnet)
New Transaction Using HDWallet Endpoint

Code samples

curl -X POST \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/hdwallet \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key' \
  -d '{
        "walletName": "demohdwallet",
        "password" : "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32",
        "outputs": [{
            "address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
            "value": 0.004
        }],
        "fee":  {
            "value": 0.00023141
        },
        "locktime": 0
    }'
POST /v1/bc/btc/mainnet/txs/hdwallet HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
    "walletName": "demohdwallet",
    "password" : "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32",
    "outputs": [{
        "address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
        "value": 0.004
    }],
    "fee":  {
        "value": 0.00023141
    },
    "locktime": 0
}

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/hdwallet",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"walletName\": \"demohdwallet\",\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\t\"outputs\": [{\n\t\t\"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n\t\t\"value\": 0.004\n\t}],\n\t\n\t\"fee\":  {\n\t\t\"value\": 0.00023141\n\t},\n\t\"locktime\": 0\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/txs/hdwallet",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ walletName: 'demohdwallet',
  password: '8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32',
  outputs: [ { address: 'mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1', value: 0.004 } ],
  fee: { value: 0.00023141 },
  locktime: 0 }));
req.end();

<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/hdwallet');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
	"walletName": "demohdwallet",
	"password" : "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32",
	"outputs": [{
		"address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
		"value": 0.004
	}],
	
	"fee":  {
		"value": 0.00023141
	},
	"locktime": 0
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/hdwallet")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"walletName\": \"demohdwallet\",\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\t\"outputs\": [{\n\t\t\"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n\t\t\"value\": 0.004\n\t}],\n\t\n\t\"fee\":  {\n\t\t\"value\": 0.00023141\n\t},\n\t\"locktime\": 0\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n\t\"walletName\": \"demohdwallet\",\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\t\"outputs\": [{\n\t\t\"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n\t\t\"value\": 0.004\n\t}],\n\t\n\t\"fee\":  {\n\t\t\"value\": 0.00023141\n\t},\n\t\"locktime\": 0\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "/v1/bc/btc/mainnet/txs/hdwallet", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"walletName\": \"demohdwallet\",\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\t\"outputs\": [{\n\t\t\"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n\t\t\"value\": 0.004\n\t}],\n\t\n\t\"fee\":  {\n\t\t\"value\": 0.00023141\n\t},\n\t\"locktime\": 0\n}");

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/hdwallet")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();
package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/hdwallet"

	payload := strings.NewReader("{\n\t\"walletName\": \"demohdwallet\",\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\t\"outputs\": [{\n\t\t\"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n\t\t\"value\": 0.004\n\t}],\n\t\n\t\"fee\":  {\n\t\t\"value\": 0.00023141\n\t},\n\t\"locktime\": 0\n}")

    req, _ := http.NewRequest("POST", url, payload)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))
}

Response Body

{
    "payload": {
        "txid": "20aa774b7f439ae5d5bb4dd0101362c4011f68bbdaef59b5ae5e3eba39b973bc"
    }
}

New Transaction Using HDWallet Endpoint provides the possibility to create, sign and send new transactions using your HDWallet. The mandatory fields are: walletName, password, outputs and fee (see example). There are a few optional fields, such as: inputs, fee address and locktime. If input addresses are not included, then the system will automatically choose addresses from the wallet. However, if included, a list of addresses from the wallet and the values should be specified. Fee address is optional and if is specified the fee will be proportionally distributed among the input addresses. Locktime is an integer and has a default value of zero. Use locktime if a transaction should be delayed to a specific time.

HTTP Request

POST /v1/bc/btc/${NETWORK}/txs/hdwallet

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. mainnet or mainnet)

See the example where the complete JSON object request (mandatory* and optional fields inlcuded) is shown.

The complete JSON object request

{
	"walletName*": "walletName",
	"password*" : "passowrd",
	"inputs":[{
		"address":"n...",
		"value":0.1
	},{
		"address":"n...",
		"value":0.3
	}],
	"outputs*": [{
		"address": "m...",
		"value": 0.4
	}],
	
	"fee":  {
        "address": "n...",
		"value*": 0.0002314
	},
	"locktime": 0
}
Transactions Fee Endpoint

Code samples


curl -X POST 'https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/fee' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/mainnet/txs HTTP/1.1
Host: api.cryptoapis.io
X-API-Key: my-api-key
Content-Type: application/json


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/fee",
  "method": "GET",
  "headers": {
    "authorization": "my-api-key",
    "content-type": "application/json"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("https");

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "port": null,
  "path": "/v1/bc/btc/mainnet/txs",
  "headers": {
    "authorization": "my-api-key",
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/fee');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'content-type' => 'application/json',
  'authorization' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/fee")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import requests

url = "https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/fee"

headers = {
    'content-type': "application/json",
    'authorization': "my-api-key"
    }

response = requests.request("GET", url, headers=headers)

print(response.text)


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/fee")
  .get()
  .addHeader("authorization", "my-api-key")
  .addHeader("content-type", "application/json")
  .build();

Response response = client.newCall(request).execute();


package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/txs/fee"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("authorization", "my-api-key")
	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "min": "0.00000129",
        "max": "0.08474670",
        "average": "0.00029540",
        "average_bytes": "540",
        "recommended": "0.00025245",
        "unit": "btc"
    }
}
Info

Transactions Fee Endpoint gives information about the fees for all transactions included in the last 70 blocks. min shows the lowest fee, max is the highest and average - the average fee. recommended is the fee that we consider as the one that corresponds to a cheap and fast execution. However, it is only a suggestion and should be used at users' sole discretion. average_bytes represents the average size of the transactions in bytes and is used for the calculations of the recommended fee price. All fees are in btc.

HTTP Request

GET /v1/bc/btc/${NETWORK}/txs/fee

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. testnet or mainnet)

Payment Forwarding

One of the well-known benefits of cryptocurrency is the ability to allow users to partake in online commerce without necessarily requiring extensive setup barriers, like registering new accounts. In that spirit, our Payment Forwarding API is the easiest way to accept—and consolidate—payments securely without forcing your users to create accounts and jump through unnecessary loops. It’s also a generic way to automatically transfer value from one address to another.

A way to generate payment-specific addresses for which funds will automatically transfer to a main merchant address. Great for automatic merchandise (whether physical or virtual) processing.

We do not take a fee on payment forwarding, other than the required miner fee; payments are free. However, as part of your own services, you can include a fee (either fixed or a percentage) that will also be automatically transfered to your own address in the same transaction. Fee-based business models are thus easily achieved, and moreover, easily auditable via the blockchain.

Create Payment Endpoint

Code samples


curl -X POST \
  https://api.cryptoapis.io/v1/bc/btc/testnet/payments \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key' \
  -d '{
    "wallet": "demohdwallet",
    "callback": "http://myaddress.com/paymet_forwarding_hook",
    "from": "n3qkBXM2xufzcJvwEjGzHDYTRWLFNJ9Vmx",
    "to": "mr3nDS1RSLzJryatXm9uDU6XCodWi3mLoa",
    "password": "SECRET123456",
    "confirmations": 2,
    "fee": 0.00022827
}'


POST /v1/bc/btc/testnet/payments HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
    "wallet": "demohdwallet",
    "callback": "http://myaddress.com/paymet_forwarding_hook",
    "from": "n3qkBXM2xufzcJvwEjGzHDYTRWLFNJ9Vmx",
    "to": "mr3nDS1RSLzJryatXm9uDU6XCodWi3mLoa",
    "password" : "SECRET123456",
    "confirmations": 2,
    "fee": 0.00022827
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/testnet/payments",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n    \"wallet\": \"demohdwallet\",\n    \"callback\": \"http://myaddress.com/paymet_forwarding_hook\",\n    \"from\": \"n3qkBXM2xufzcJvwEjGzHDYTRWLFNJ9Vmx\",\n    \"to\": \"mr3nDS1RSLzJryatXm9uDU6XCodWi3mLoa\",\n    \"password\" : \"SECRET123456\",\n    \"confirmations\": 2,\n \"fee\": 0.00022827\n}\n"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "https://api.cryptoapis.io/v1/bc/btc/testnet/payments",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ wallet: 'demohdwallet',
  callback: 'http://myaddress.com/paymet_forwarding_hook',
  from: 'n3qkBXM2xufzcJvwEjGzHDYTRWLFNJ9Vmx',
  to: 'mr3nDS1RSLzJryatXm9uDU6XCodWi3mLoa',
  password: 'SECRET123456',
  confirmations: 2,
  fee: 0.00022827 }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/testnet/payments');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
    "wallet": "demohdwallet",
    "callback": "http://myaddress.com/paymet_forwarding_hook",
    "from": "n3qkBXM2xufzcJvwEjGzHDYTRWLFNJ9Vmx",
    "to": "mr3nDS1RSLzJryatXm9uDU6XCodWi3mLoa",
    "password" : "SECRET123456",
    "confirmations": 2,
    "fee": 0.00022827
}
');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/testnet/payments")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n    \"wallet\": \"demohdwallet\",\n    \"callback\": \"http://myaddress.com/paymet_forwarding_hook\",\n    \"from\": \"n3qkBXM2xufzcJvwEjGzHDYTRWLFNJ9Vmx\",\n    \"to\": \"mr3nDS1RSLzJryatXm9uDU6XCodWi3mLoa\",\n    \"password\" : \"SECRET123456\",\n    \"confirmations\": 2,\n \"fee\": 0.00022827\n}\n"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n    \"wallet\": \"demohdwallet\",\n    \"callback\": \"http://myaddress.com/paymet_forwarding_hook\",\n    \"from\": \"n3qkBXM2xufzcJvwEjGzHDYTRWLFNJ9Vmx\",\n    \"to\": \"mr3nDS1RSLzJryatXm9uDU6XCodWi3mLoa\",\n    \"password\" : \"SECRET123456\",\n    \"confirmations\": 2,\n \"fee\": 0.00022827\n}\n"

headers = {
    'Content-Type': "application/json",
    'X-API-Key': 'my-api-key'
    }

conn.request("POST", "/v1/bc/btc/testnet/payments", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"wallet\": \"demohdwallet\",\n    \"callback\": \"http://myaddress.com/paymet_forwarding_hook\",\n    \"from\": \"n3qkBXM2xufzcJvwEjGzHDYTRWLFNJ9Vmx\",\n    \"to\": \"mr3nDS1RSLzJryatXm9uDU6XCodWi3mLoa\",\n    \"password\" : \"SECRET123456\",\n    \"confirmations\": 2,\n \"fee\": 0.00022827\n}\n");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/testnet/payments")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/testnet/payments"

	  payload := strings.NewReader("{\n    \"wallet\": \"demohdwallet\",\n    \"callback\": \"http://myaddress.com/paymet_forwarding_hook\",\n    \"from\": \"n3qkBXM2xufzcJvwEjGzHDYTRWLFNJ9Vmx\",\n    \"to\": \"mr3nDS1RSLzJryatXm9uDU6XCodWi3mLoa\",\n    \"password\" : \"SECRET123456\",\n    \"confirmations\": 2,\n \"fee\": 0.00022827\n}\n")

    req, _ := http.NewRequest("POST", url, payload)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body

{
  "payload": {
      "from": "n3qkBXM2xufzcJvwEjGzHDYTRWLFNJ9Vmx",
      "to": "mr3nDS1RSLzJryatXm9uDU6XCodWi3mLoa",
      "callback": "http://myaddress.com/paymet_forwarding_hook",
      "wallet": "demohdwallet",
      "uuid": "e034c540-c688-4902-8872-013cc5ce6a30",
      "confirmations": 2,
      "fee": 0.00022827
  }
}
Info

First, to create an payment forwarding address, you need to POST a partially filled PaymentForward object to the payment creation endpoint. You need to include the following data:

When payment forwarding is triggered then you are going to receive notification on url when you created new payment forwarding.

HTTP Request

POST /v1/bc/btc/${NETWORK}/payments

Request Object

{
"from": "${FROM_ADDRESS}",
"to": "${TO_ADDRESS}",
"callback": "${CALLBACK_URL}",
"wallet": ${HD_WALLET_NAME},
"password": ${WALLET_PASSWORD}
"confirmations": ${CONFIRMATIONS}
"fee": ${FEE}
}

After executing the forwarding payment a message will be sent to the specified callback(url), similar to the following:

{
    "currency": "BTC",
    "network": "testnet",
    "type": "PAYMENT_FORWARDING",
    "uuid": "19b220ec-eb3c-4ac9-af3b-ed37269b9448",
    "transaction": "95d88fb742c96378cc30185601088acf97ff5a3dc32399ca0800b4fa171013bc",
    "url" : "http://myaddress.com/paymet_forwarding_hook",
    "status": "DONE",
    "message": "Payment forwarding was successful!"
}

There are total of four payment statuses: DONE, FAILED, PENDING and OUT_OF_BALANCE.

For some reasons the payment forwarding may fail.

{
  "payload": {
      "currency": "BTC",
      "network": "testnet",
      "uuid": "19b220ec-eb3c-4ac9-af3b-ed37269b9448",
      "type": "PAYMENT_FORWARDING",
      "url" : "http://myaddress.com/paymet_forwarding_hook",
      "status": "FAILED",
  }
}

If status is FAILED it means that this forwarding will be executed when the next block is mined.

Payments might be pending:

{
  "payload": {
      "currency": "BTC",
      "network": "testnet",
      "uuid": "19b220ec-eb3c-4ac9-af3b-ed37269b9448",
      "type": "PAYMENT_FORWARDING",
      "url" : "http://myaddress.com/paymet_forwarding_hook",
      "status": "PENDING",
  }
}

When next block is mined an attempt for executing this payment will be made. If the value from the transaction that triggers the payment forwarding is spent before the execution of the payment is done, a message will be sent to the specified url:

{
    "currency": "BTC",
    "network": "testnet",
    "uuid": "19b220ec-eb3c-4ac9-af3b-ed37269b9448",
    "type": "PAYMENT_FORWARDING",
    "url" : "http://myaddress.com/paymet_forwarding_hook",
    "status": "OUT_OF_BALANCE",
    "message": "Payment forwarding was not successful! Reason: Balance is not enough!"
}

When status is set to OUT_OF_BALANCE other attempts for executing the payment will not be made.

Query Parameters
Parameter Default Description
NETWORK - Newtork name (e.g. testnet or mainnet)
FROM_ADDRESS - destination bitcoin address
TO_ADDRESS - target bitcoin address
CALLBACK_URL - callback url addres that will be called after forwarding is processed
WALLET_NAME - wallet created by current USER_ID
WALLET_PASSWORD - wallet password
CONFIRMATIONS - after how many confirmations to execute the payment forwarding
FEE (Optional) - what fee should be paid for the transaction (in BTC)
List Payment Endpoint

Code samples


curl -X GET \
  https://api.cryptoapis.io/v1/bc/btc/testnet/payments \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/testnet/payments HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/testnet/payments",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/testnet/payments",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/testnet/payments');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/testnet/payments")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
    'Content-Type': "application/json" ,
    'X-API-Key': "my-api-key"
}

conn.request("GET", "/v1/bc/btc/testnet/payments", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/testnet/payments")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/testnet/payments"

    req, _ := http.NewRequest("GET", url, nil)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body


{
  "payload": [
        {
            "from": "mgbrYCKAssc6cBnb15HkhjEJn5nY8raAhz",
            "to": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
            "callback": "http://myaddress.com/paymet_forwarding_hook",
            "wallet": "demohdwallet",
            "uuid": "8930fdf4-5664-49c4-a51e-15c5edf5eb8f",
            "confirmations": 0
        },
        {
            "from": "mudZF8cTSiSLFCmwTNmpvmLUKogTw2CgVY",
            "to": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
            "callback": "http://myaddress.com/paymet_forwarding_hook",
            "wallet": "demohdwallet",
            "uuid": "c1dba6dd-67e6-4970-90c5-23dc389c4bcb",
            "confirmations": 0
        },
        {
            "from": "mvhThy8jXfYxTFW9XkFLnww9AXzhfkNsan",
            "to": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
            "callback": "http://myaddress.com/paymet_forwarding_hook",
            "wallet": "demohdwallet",
            "uuid": "721a90d2-af27-4ecb-b790-4ddfb090f2b8",
            "confirmations": 3
        }
    ],
  "meta": {
      "totalCount": 4,
      "results": 4
  }
}
Info

To list your currently active payment forwarding addresses, you can use this endpoint.

HTTP Request

GET /v1/bc/btc/${NETWORK}/payments

Query Parameters
Parameter Default Description
NETWORK - Newtork name (e.g. testnet or mainnet)

This returns the full array of your currently active payment forwarding addresses.

List of Past Forward Payments By Users

Code samples


curl -X GET \
  https://api.cryptoapis.io/v1/bc/btc/testnet/payments/history \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/testnet/payments/history HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/testnet/payments/history",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/testnet/payments/history",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/testnet/payments/history');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/testnet/payments/history")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
    'Content-Type': "application/json" ,
    'X-API-Key': "my-api-key"
}

conn.request("GET", "/v1/bc/btc/testnet/payments/history", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/testnet/payments/history")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/testnet/payments/history"

    req, _ := http.NewRequest("GET", url, nil)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body

{
  "payload": [
        {
            "status": "DONE",
            "uuid": "5f0f275f-6360-47ed-9f29-0a5d68bc9584",
            "block_height": 1486198,
            "txid": "9f908420e3cd0b939711a809cf7028e4914a0474f61d75438ad8e20cc72da82f",
            "payment_uuid": "c1dba6dd-67e6-4970-90c5-23dc389c4bcb"
        },
        {
            "status": "DONE",
            "uuid": "721a90d2-af27-4ecb-b790-4ddfb090f2b8",
            "block_height": 1486173,
            "txid": "1d6136e2357c000811f9352f8db29990e884e9cb3ecf64543120c7962bfc1d68",
            "payment_uuid": "721a90d2-af27-4ecb-b790-4ddfb090f2b8"
        },
        {
            "status": "DONE",
            "uuid": "859774b8-fba9-4d41-a4a5-a180c92b14ac",
            "block_height": 1486181,
            "txid": "afb238aa0d0b8d17b30cf63965c5621f1f1c08b94c005c6e5ba812971b68a00a",
            "payment_uuid": "c1dba6dd-67e6-4970-90c5-23dc389c4bcb"
        }
  ],
  "meta": {
      "totalCount": 15,
      "limit": 50,
      "results": 15
  }
}
Info

To list your currently active payment forwarding addresses, you can use this endpoint.

HTTP Request

GET /v1/bc/btc/${NETWORK}/payments/history

Query Parameters
Parameter Default Description
NETWORK - Newtork name (e.g. testnet or mainnet)

If the request is successful, you’ll receive a JSON (see the response body) and an HTTP Status Code 200.

Delete Payment Endpoint

Code samples


curl -X DELETE \
  https://api.cryptoapis.io/v1/bc/btc/testnet/payments/f0e80c20-434b-4195-a1e4-e3cdfd8585f3 \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


DELETE /v1/bc/btc/testnet/payments/f0e80c20-434b-4195-a1e4-e3cdfd8585f3 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/testnet/payments/f0e80c20-434b-4195-a1e4-e3cdfd8585f3",
  "method": "DELETE",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "DELETE",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/testnet/payments/f0e80c20-434b-4195-a1e4-e3cdfd8585f3",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/testnet/payments/f0e80c20-434b-4195-a1e4-e3cdfd8585f3');
$request->setMethod(HTTP_METH_DELETE);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/testnet/payments/f0e80c20-434b-4195-a1e4-e3cdfd8585f3")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
    'Content-Type': "application/json" ,
    'Authoization': "my-api-key"
}

conn.request("DELETE", "/v1/bc/btc/testnet/payments/f0e80c20-434b-4195-a1e4-e3cdfd8585f3", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/testnet/payments/f0e80c20-434b-4195-a1e4-e3cdfd8585f3")
  .delete(null)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/testnet/payments/f0e80c20-434b-4195-a1e4-e3cdfd8585f3"

    req, _ := http.NewRequest("DELETE", url, nil)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body


{
  "payload": {
      "message": "Payment Forwarding with uuid f0e80c20-434b-4195-a1e4-e3cdfd8585f3 was successfully deleted"
  }
}

Info

When you’re done with a payment forwarding address, you can delete it via its uuid.

HTTP Request

DELETE /v1/bc/btc/${NETWORK}/payments/${PAYMENT_UUID}

Query Parameters
Parameter Default Description
NETWORK - Newtork name (e.g. testnet or mainnet)
PAYMENT_UUID - Generated UUID when payment forwarding was created

PAYMENT_UUID is a string representing the payment forwarding request you want to delete, for example:

399d0923-e920-48ee-8928-2051cbfbc369

Webhook Notification

Blockchains are highly transactional systems. Many usage patterns require knowing when an event occurs: i.e., when a transaction is included into a block, or when an unconfirmed transaction is relayed through the network. Instead of requiring you to continuously poll resources, we provide push APIs to facilitate those use cases, and support both WebSockets and WebHooks.

Which Should I Use?

WebSockets are typically used in client applications when a server is not already running: e.g., a web page displaying the most recent transactions or a wallet app updating its UI when a transaction has been confirmed. Websockets are less reliable in longer interactions (> 1 hour) because they require a connection to stay open.

WebHooks are the most reliable way to get event notifications but requires running a server to receive the callbacks. We automatically retry HTTP requests 5 times.

A WebHook request expects a response with status code 200 (OK) or it will retry the request.

Types of Events
Info

We support a number of different event types, and you can filter your notification requests depending on how you structure your Event request object.

Event Description
NEW_BLOCK Triggered for every new block added to the blockchain you’ve selected as your base resource. The payload is a Block.
CONFIRMED_TX Triggered for every new transaction making it into a new block; in other words, for every first transaction confirmation. This is equivalent to listening to the new-block event and fetching each transaction in the new Block. The payload is a confirmed transaction.
ADDRESS Triggered any time an address appears in a transaction in a new block added to the blockchain or into the unconfirmed queue and waiting to be mined
Create New Block WebHook Endpoint
Using a partially filled out Event, you can create a WebHook using this resource.

Code samples


curl -X POST \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key' \
  -d '{
    "event" : "NEW_BLOCK",
    "url" : "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5"
}'


POST /v1/bc/btc/mainnet/hooks HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
    "event" : "NEW_BLOCK",
    "url" : "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5"
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"event\" : \"NEW_BLOCK\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/hooks",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ event: 'NEW_BLOCK',
  url: 'http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5' }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
    "event" : "NEW_BLOCK",
    "url" : "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"event\" : \"NEW_BLOCK\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\"\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n\t\"event\" : \"NEW_BLOCK\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\"\n}"

headers = {
    'Content-Type': "application/json",
    'X-API-Key': "Bearer my-genrated-token"
}

conn.request("POST", "/v1/bc/btc/mainnet/hooks", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"event\" : \"NEW_BLOCK\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\"\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks"

    payload := strings.NewReader("{\n\t\"event\" : \"NEW_BLOCK\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\"\n}")

    req, _ := http.NewRequest("POST", url, payload)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "Bearer my-generated-toke")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body


{
  "payload": {
    "id": "d0bd12a4-fdda-4ee3-a3a2-0c4782497871",
    "event": "NEW_BLOCK",
    "url": "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5"
  }
}
HTTP Request

POST /v1/bc/btc/${NETWORK}/hooks HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

Request Object

{ "event": "NEW_BLOCK", "url":{CALLBACK_URL} }

The message to be sent to the specified url will be similar to the following:

{
	"currency": "BTC",
  "network": "mainnet",
  "url": "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5",
  "type": "NEW_BLOCK",
  "blockHeight": 570008,
  "blockHash": "00000000000000000029a327e7d6f2ba04d126019744e4b513ab0f7d4b00c361"
}
Query Parameters
Parameter Default Description
NETWORK - Newtork name (e.g. testnet or mainnet)
EVENT - Webhook Event
CALLBACK_URL - webhook callback url
Create Confirmed Transaction WebHook Endpoint

Code samples


curl -X POST \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key' \
  -d '{
    "event" : "CONFIRMED_TX",
    "url" : "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5",
    "transaction": "850039bf081ad580aba73217752647e640929624e11e71d21011511e48a98e04",
    "confirmations": 3
}'


POST /v1/bc/btc/mainnet/hooks HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
    "event" : "CONFIRMED_TX",
    "url" : "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5",
    "transaction": "850039bf081ad580aba73217752647e640929624e11e71d21011511e48a98e04",
    "confirmations": 3
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"event\" : \"CONFIRMED_TX\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\",\n\t\"transaction\": \"850039bf081ad580aba73217752647e640929624e11e71d21011511e48a98e04\",\n\t\"confirmations\": 3\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/hooks",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ event: 'CONFIRMED_TX',
  url: 'http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5',
  transaction: '850039bf081ad580aba73217752647e640929624e11e71d21011511e48a98e04',
  confirmations: 3 }));
req.end();



<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
    "event" : "CONFIRMED_TX",
    "url" : "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5",
    "transaction": "850039bf081ad580aba73217752647e640929624e11e71d21011511e48a98e04",
    "confirmations": 3
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"event\" : \"CONFIRMED_TX\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\",\n\t\"transaction\": \"850039bf081ad580aba73217752647e640929624e11e71d21011511e48a98e04\",\n\t\"confirmations\": 3\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n\t\"event\" : \"CONFIRMED_TX\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\",\n\t\"transaction\": \"850039bf081ad580aba73217752647e640929624e11e71d21011511e48a98e04\",\n\t\"confirmations\": 3\n}"

headers = {
    'Content-Type': "application/json",
    'X-API-Key': "Bearer my-genrated-token"
}

conn.request("POST", "/v1/bc/btc/mainnet/hooks", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"event\" : \"CONFIRMED_TX\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\",\n\t\"transaction\": \"850039bf081ad580aba73217752647e640929624e11e71d21011511e48a98e04\",\n\t\"confirmations\": 3\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks"

    payload := strings.NewReader("{\n\t\"event\" : \"CONFIRMED_TX\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\",\n\t\"transaction\": \"850039bf081ad580aba73217752647e640929624e11e71d21011511e48a98e04\",\n\t\"confirmations\": 3\n}")

    req, _ := http.NewRequest("POST", url, payload)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "Bearer my-generated-toke")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body

{
  "payload": {
      "uuid": "3027a4d9-1a3e-478a-ab35-08f48679b238",
      "event": "CONFIRMED_TX",
      "confirmations": 3,
      "transaction": "850039bf081ad580aba73217752647e640929624e11e71d21011511e48a98e04",
      "url": "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5"
  }
}

Using a partially filled out Event, you can create a WebHook using this resource.

HTTP Request

POST /v1/bc/btc/${NETWORK}/hooks

Request Object

{ "event": "CONFIRMED_TX", "url":{CALLBACK_URL}, "transaction" : ${TRANSACTION}}, "confirmations" : ${CONFIRMATIONS} }

The message to be sent to the specified url will be similar to the following:

{
    "blockHeight": 569847,
    "blockHash": "000000000000000000039dc2f1ab48a072d5d3fdc8d8a9cf7b726e894133d904",
    "currency": "BTC",
    "network": "mainnet",
    "url": "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5",
    "type": "CONFIRMED_TX",
    "tx": "850039bf081ad580aba73217752647e640929624e11e71d21011511e48a98e04",
    "confirmations": 3
}
Query Parameters
Parameter Default Description
NETWORK - Newtork name (e.g. testnet or mainnet)
EVENT - Webhook Event
CALLBACK_URL - webhook callback url
TRANSACTION - Transaction hash
CONFIRMATIONS - receive webhook after a specified number of confirmations

Confirmations can be any number between 0 and 20. Set to 0 means that webhooks will be sent immediately after the block that includes transactions with the specified address is mined. However, since there is the possibility of blockchain block re-write, we suggest that users set the confirmations at least to 3 (webhooks will be sent 3 blocks after the targeted block).

Create Address Transaction WebHook Endpoint

Code samples


curl -X POST \
  'https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key' \
  -d '{
    "event" : "ADDRESS",
    "url" : "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5",
    "address": "15XyNC88pujwuuur8DCsXBCfEhJJMzHayU", 
  	"confirmations" : 6
}'


POST /v1/bc/btc/mainnet/hooks HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
    "event" : "ADDRESS",
    "url" : "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5",
    "address": "15XyNC88pujwuuur8DCsXBCfEhJJMzHayU", 
  	"confirmations" : 6
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"event\" : \"ADDRESS\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\",\n\t\"address\": \"15XyNC88pujwuuur8DCsXBCfEhJJMzHayU\",\n\t\"confirmations\" : 6\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/hooks",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ event: 'ADDRESS',
  url: 'http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5',
  address: '15XyNC88pujwuuur8DCsXBCfEhJJMzHayU',
  confirmations: 6 }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
    "event" : "ADDRESS",
    "url" : "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5",
    "address": "15XyNC88pujwuuur8DCsXBCfEhJJMzHayU", 
  	"confirmations" : 6
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"event\" : \"ADDRESS\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\",\n\t\"address\": \"15XyNC88pujwuuur8DCsXBCfEhJJMzHayU\",\n\t\"confirmations\" : 6\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n\t\"event\" : \"ADDRESS\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\",\n\t\"address\": \"15XyNC88pujwuuur8DCsXBCfEhJJMzHayU\",\n\t\"confirmations\" : 6\n}"

headers = {
    'Content-Type': "application/json",
    'X-API-Key': "my-api-key"
}

conn.request("POST", "/v1/bc/btc/mainnet/hooks", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"event\" : \"ADDRESS\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\",\n\t\"address\": \"15XyNC88pujwuuur8DCsXBCfEhJJMzHayU\",\n\t\"confirmations\" : 6\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks"

    payload := strings.NewReader("{\n\t\"event\" : \"ADDRESS\",\n\t\"url\" : \"http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5\",\n\t\"address\": \"15XyNC88pujwuuur8DCsXBCfEhJJMzHayU\",\n\t\"confirmations\" : 6\n}")

    req, _ := http.NewRequest("POST", url, payload)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body

{
  "payload": {
      "uuid": "3027a4d9-1a3e-478a-ab35-08f48679b238",
      "event": "ADDRESS",
      "confirmations" : 6,
      "address": "15XyNC88pujwuuur8DCsXBCfEhJJMzHayU",
      "url": "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5"
  }
}

Using a partially filled out Event, you can create a WebHook using this resource.

HTTP Request

POST /v1/bc/btc/${NETWORK}/hooks

Request Object

{ "event": "ADDRESS", "url":{CALLBACK_URL}, "address" : ${ADDRESS}, "confirmations" : ${CONFIRMATIONS} } The message to be sent to the specified url will be similar to the following:

{
   "currency": "BTC",
   "network": "mainnet",
   "url": "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5",
   "type": "ADDRESS",
   "blockHeight": 570011,
   "blockHash": "00000000000000000025d7fba236834647b864380aa08afaccd72bdb56af5554",
   "confirmations": 0,
   "address": "bc1qjl8uwezzlech723lpnyuza0h2cdkvxvh54v3dn",
   "txid": "ac2e1a495977d773a304d251e55579c862592819167b41e5bfb1a8360c23dd6a"
}

If the address is included in a transaction in the unconfirmed queue waiting to be mined the following message will be sent:

{
   "currency": "BTC",
   "network": "mainnet",
   "url": "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5",
   "type": "ADDRESS",
   "blockHeight": -1,
   "unconfirmed": true,
   "address": "bc1qjl8uwezzlech723lpnyuza0h2cdkvxvh54v3dn",
   "txid": "dfe3ca89e8ce658a6d527ef81d1ad1f4601dc6dc8a1856d9598cfc6d1c7e5f86"
}
Query Parameters
Parameter Default Description
NETWORK - Newtork name (e.g. testnet or mainnet)
EVENT - Webhook Event
CALLBACK_URL - webhook callback url
ADDRESS - btc address
CONFIRMATIONS - receive webhook after a specified number of confirmations

Confirmations can be any number between 0 and 20. Set to 0 means that webhooks will be sent immediately after the block that includes transactions with the specified address is mined. However, since there is the possibility of blockchain block re-write, we suggest that users set the confirmations at least to 3 (webhooks will be sent 3 blocks after the targeted block).

List WebHooks Endpoint

Code samples


curl -X GET \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


GET /v1/bc/btc/mainnet/hooks HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/hooks",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
    'Content-Type': "application/json' ,
    'X-API-Key': 'my-api-key'
}

conn.request("GET", "/v1/bc/btc/mainnet/hooks", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks"

    req, _ := http.NewRequest("GET", url, nil)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body

{
  "payload": [
      {
          "uuid": "ed82b0cc-8818-401b-9322-640a4727ffd0",
          "event": "ADDRESS",
          "confirmations": 3,
          "address": "15XyNC88pujwuuur8DCsXBCfEhJJMzHayU",
          "url": "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5"
      },
      {
          "uuid": "3c893843-41f1-4a79-84ab-c84c992c81db",
          "event": "NEW_BLOCK",
          "url": "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5"
      },
      {
          "uuid": "3027a4d9-1a3e-478a-ab35-08f48679b238",
          "event": "CONFIRMED_TX",
          "transaction": "850039bf081ad580aba73217752647e640929624e11e71d21011511e48a98e04",
          "confirmations": 3,
          "url": "http://www.mocky.io/v2/5b0d4b5f3100006e009d55f5"
      }
  ],
  "meta": {
      "totalCount": 3,
      "results": 3
  }
}

Using this resource you can list all web hooks that you have created.

HTTP Request

GET /v1/bc/btc/${NETWORK}/hooks

Query Parameters
Parameter Default Description
NETWORK - Newtork name (e.g. testnet or mainnet)
Delete WebHook Endpoint

Code samples


curl -X DELETE \
  https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks/3c893843-41f1-4a79-84ab-c84c992c81db \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: my-api-key'


DELETE /v1/bc/btc/mainnet/hooks/3c893843-41f1-4a79-84ab-c84c992c81db HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks/3c893843-41f1-4a79-84ab-c84c992c81db",
  "method": "DELETE",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "DELETE",
  "hostname": "api.cryptoapis.io",
  "path": "/v1/bc/btc/mainnet/hooks/3c893843-41f1-4a79-84ab-c84c992c81db",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks/3c893843-41f1-4a79-84ab-c84c992c81db');
$request->setMethod(HTTP_METH_DELETE);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks/3c893843-41f1-4a79-84ab-c84c992c81db")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
    'Content-Type': "application/json' ,
    'X-API-Key': 'my-api-key'
}

conn.request("DELETE", "/v1/bc/btc/mainnet/hooks/3c893843-41f1-4a79-84ab-c84c992c81db", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks/3c893843-41f1-4a79-84ab-c84c992c81db")
  .delete(null)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://api.cryptoapis.io/v1/bc/btc/mainnet/hooks/3c893843-41f1-4a79-84ab-c84c992c81db"

    req, _ := http.NewRequest("DELETE", url, nil)

    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", "my-api-key")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}

Response Body

{
  "payload": {
      "message": "Webhook with id: 3c893843-41f1-4a79-84ab-c84c992c81db was successfully deleted!"
  }
}

You can delete a WebHook by WEBHOOK_ID using this resource.

HTTP Request

DELETE /v1/bc/btc/${NETWORK}/hooks/${WEBHOOK_ID}

Query Parameters
Parameter Default Description
NETWORK - Newtork name (e.g. testnet or mainnet)
WEBHOOK_ID - Webhook id

ETH

Blockchain API

Some of Ethereum’s main points:

Chain Endpoint

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/rinkeby/info \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/rinkeby/info HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/info",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "rinkeby",
    "info"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/info');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/info")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,rinkeby,info", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/info")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/info"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")
  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "chain": "rinkeby",
        "height": 4190581,
        "difficulty": "7713546",
        "bestBlockHash": "0x42e6e4c11bebf7343720aaf7bcc1f9edeae25f82e57efa2aca14db6ffe95a730",
        "txs_count": 31708815,
        "synced": true
    }
}
Info

General information about a blockchain is available by GET-ing the base resource.

HTTP Request

GET /v1/bc/eth/${NETWORK}/info

Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)

The returned object contains a litany of information about the blockchain, including its height, the hash of the latest block and more.

Block Hash Endpoint

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383 \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "mainnet",
    "blocks",
    "0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,mainnet,blocks,0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "chain": "ETH.mainnet",
        "height": 523442,
        "hash": "0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383",
        "parent_hash": "0x3e3ad7b9a63de7a1f1f564ee5393876caf61eff04d7c330bfe6df9b942c606d6",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "gas_used": "21000",
        "size": "658 bytes",
        "timestamp": 1447237199,
        "date": "2015-11-11 10:19:59 +UTC",
        "transactions": 1,
        "difficulty": "7657563137253",
        "total_difficulty": "2874342750898990991",
        "gas_limit": "3141592",
        "nonce": "0x32dd2d75a55f1463",
        "mined_by": "0xf8b483dba2c3b7176a3da549ad41a48bb3121069 in 7 secs",
        "uncles": [],
        "extra_data": "0xd983010203844765746887676f312e342e328777696e646f7773",
        "confirmations": 7023472,
        "total_fees": "1050000000000000"
    }
}
Info

Block Hash Endpoint gives you detail information for particular block in the blockchain

HTTP Request

GET /v1/bc/eth/${NETWORK}/blocks/${BLOCK_HASH}

Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)
BLOCK_HASH - Hash of the block in blockchain

BLOCK_HASH is a string representing the hash of the block you’re interested in querying, for example:

0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383

The returned object contains information about the block in JSON format, including its height, the total amount of wei transacted within it, the number of transactions in it, transaction hashes listed in the canonical order in which they appear in the block and more.

Block Height Endpoint

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/523442 \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/mainnet/blocks/523442 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/523442",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


const https = require('https');

var options = {
  "method": "GET",
  "hostname": "https://api.cryptoapis.io",
  "path": "/v1/bc/eth/mainnet/blocks/523442",
  "headers": {
    'Content-Type': 'application/json',
    'X-API-Key': 'my-api-key'
  }
};

var request = https.request(options, function (response) {
  response.on("data", function (data) {
    console.log(data);
  });
});

request.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/523442');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/523442")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,mainnet,blocks,523442", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/523442")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/523442"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "chain": "ETH.mainnet",
        "height": 523442,
        "hash": "0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383",
        "parent_hash": "0x3e3ad7b9a63de7a1f1f564ee5393876caf61eff04d7c330bfe6df9b942c606d6",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "gas_used": "21000",
        "size": "658 bytes",
        "timestamp": 1447237199,
        "date": "2015-11-11 10:19:59 +UTC",
        "transactions": 1,
        "difficulty": "7657563137253",
        "total_difficulty": "2874342750898990991",
        "gas_limit": "3141592",
        "nonce": "0x32dd2d75a55f1463",
        "mined_by": "0xf8b483dba2c3b7176a3da549ad41a48bb3121069 in 7 secs",
        "uncles": [],
        "extra_data": "0xd983010203844765746887676f312e342e328777696e646f7773",
        "confirmations": 7023472,
        "total_fees": "1050000000000000"
    }
}
Info

Block Height Endpoint gives you detail information for particular block in the blockchain

HTTP Request

GET /v1/bc/eth/${NETWORK}/blocks/${BLOCK_HEIGHT}

Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)
BLOCK_HEIGHT - Height of the block in blockchain

BLOCK_HEIGHT is a integer representing the height of the block you’re interested in querying, for example:

523442

The returned object contains information about the block in JSON format, including its height, the total amount of wei transacted within it, the number of transactions in it and more.

Latest Block Endpoint

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/rinkeby/blocks/latest \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/rinkeby/blocks/latest HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/blocks/latest",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "port": "8021",
  "path": [
    "v1",
    "bc",
    "eth",
    "rinkeby",
    "blocks",
    "latest"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/blocks/latest');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/blocks/latest")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,rinkeby,blocks,latest", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/blocks/latest")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/blocks/latest"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "chain": "ETH.rinkeby",
        "height": 4190586,
        "hash": "0x0e6dd17fd8796d2dd9b443a877f4f0d5a9ac96f178469a53eacfaf6fdf5e0a34",
        "parent_hash": "0x61980a93a927bb57e890d637f96997d0a30855cf19597c6adcea2f2789ee8d1e",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "gas_used": "973938",
        "size": "2921 bytes",
        "timestamp": 1554988169,
        "date": "2019-04-11 13:09:29 +UTC",
        "transactions": 10,
        "difficulty": "2",
        "total_difficulty": "7713556",
        "gas_limit": "7019104",
        "nonce": "0x00",
        "mined_by": "0x0000000000000000000000000000000000000000 in 15 secs",
        "uncles": [],
        "extra_data": "0xd683010900846765746886676f312e3132856c696e7578000000000000000000b4e94cf8329db3b98d7fd1ed5087edbcfc176bdc3fd9b1f25f19299cb16599f27a047aa82eee5b49cfa53e411194d09c91cb295c0f131082fd9bd2a5e1f63cc601",
        "confirmations": 0,
        "total_fees": "2999609192498000"
    }
}
Info

Latest Block Endpoint gives you detail information for the latest block in the blockchain

HTTP Request

GET /v1/bc/eth/${NETWORK}/blocks/latest

Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)

The returned object contains information about the latest block in JSON format, including its height, the total amount of wei transacted within it, the number of transactions in it and more.

Address API

Whereas the Bitcoin blockchain was purely a list of transactions, Ethereum’s basic unit is the account. The Ethereum blockchain tracks the state of every account, and all state transitions on the Ethereum blockchain are transfers of value and information between accounts. There are two types of accounts:

Crypto APIs Address API allows you to look up information about public Ethereum addresses/accounts and generate your own low-value Ethereum addresses/public-private key pairs.

If you’re new to blockchains, you can think of public addresses as similar to bank account numbers in a traditional ledger. The biggest differences:

More about Ethereum Account Management can be found in the offical documents.

Address Endpoint

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987 \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "ropsten",
    "address",
    "0x9e44c54a4ccdade765d23bbbdb99e66003b5e987"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,ropsten,address,0x9e44c54a4ccdade765d23bbbdb99e66003b5e987", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "chain": "ETH.ropsten",
        "address": "0x9e44c54a4ccdade765d23bbbdb99e66003b5e987",
        "balance": "0.116622817690596", //eth
        "txs_count": 18,
        "from": 17,
        "to": 1
    }
}
Info

The default Address Endpoint strikes a balance between speed of response and data on Addresses. It returns information about the balance (in ETH) and transactions of a specified address.

HTTP Request

GET /v1/bc/eth/${NETWORK}/address/${ADDRESS}

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. ropsten, rinkeby or mainnet)
ADDRESS ------- Address in blockchain

ADDRESS is a string representing the public address you’re interested in querying, for example:

0x9e44c54a4ccdade765d23bbbdb99e66003b5e987

The returned object contains information about the address, including its balance in ETH and the number of transactions associated with it. The endpoint omits any detailed transaction information, but if that isn’t required by your application, then it’s the fastest and preferred way to get public address information.

Transactions By Address Endpoint

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15  \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "ropsten",
    "address",
    "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
    "transactions"
  ],
    "qs": {
    "index": 0,
    "limit": 15
  },
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

querystring = {"index": 0, "limit": 15}

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,ropsten,address,0x0cb1883c01377f45ee5d7448a32b5ac1709afc11,transactions", headers=headers, params=querystring))

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "payload": [
        {
            "from": "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
            "to": "0xe7d553c3aab5943ec097d60535fd06f1b75db43e",
            "hash": "0x608de2c0c3a3795b95b2127a967860eb3a9137c91109f026634586faf2ee7ac5",
            "value": "0",
            "timestamp": "2019-04-11 12:06:35",
            "nonce": 176,
            "confirmations": 244
        },
        {
            "from": "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
            "to": "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
            "hash": "0x889d6c73465bfaf9164f967ac5f6afe2bee968099f45626abdb6ce37b68886a0",
            "value": "1300000000000",
            "timestamp": "2019-04-11 11:07:31",
            "nonce": 175,
            "confirmations": 490
        },
        {
            "from": "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
            "to": "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
            "hash": "0x8affaeef4c0582050345524ddd6bcfc332b782a2574026b3968fdce20b5744ab",
            "value": "1300000000000",
            "timestamp": "2019-04-11 11:03:06",
            "nonce": 174,
            "confirmations": 499
        },
        ...
        {
            "from": "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
            "to": "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
            "hash": "0x494840139d5f988569b19f4a71f076c4310a9c406e33b67fd61578ac68187d4d",
            "value": "12000000000000000",
            "timestamp": "2018-11-28 12:06:37",
            "nonce": 65,
            "confirmations": 863054
        }
    ],
    "meta": {
        "totalCount": 279,
        "index": 0,
        "limit": 15,
        "results": 15
    }
}
Info

The Transactions By Address Endpoint returns all transactions specified by the query params: index and limit; The maxim value of limit is 50. The value in the returned transactions in WEI.

HTTP Request

GET /v1/bc/eth/${NETWORK}/address/${ADDRESS}/transactions?index=${INDEX}&limit=${LIMIT}

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. ropsten, rinkeby or mainnet)
ADDRESS ------- Address in blockchain
INDEX 0 start from
LIMIT ------- limit up to n transactions
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria

ADDRESS is a string representing the public address you’re interested in querying, for example:

0x0cb1883c01377f45ee5d7448a32b5ac1709afc11

INDEX is a integer representing the order of the transaction, for example:

0

LIMIT is a integer representing limit for transactions, for example:

15

Generate Address Endpoint

Code samples


curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/address \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


POST /v1/bc/eth/ropsten/address HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/address",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "ropsten",
    "address"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/address');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/address")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "v1,bc,eth,ropsten,address", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/ropsten/address")
  .post(null)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/address"

  req, _ := http.NewRequest("POST", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
  "payload": {
      "address": "0xb8e51b75a8ab6995b2e11938fed3b05837ec5fa2",
      "privateKey": "5d06b11d276e169d2fa2ced94d327902ee954ff47e31bcbf0aa4957a829a0aed",
      "publicKey": "303727940fca8f9b1f580908246aa980f9ee2aa9ecc379cbaf6a80f0050c1a2cdd7a467c1e564a2e272fb5b1958320ca11ca79b9cdfaf2bd74e6decd2592daa8"
  }
}
Info

The Generate Address endpoint allows you to generate private-public key-pairs along with an associated public address. No information is required with this POST request.

HTTP Request

POST /v1/bc/eth/${NETWORK}/address

Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)

The returned object contains a private key in hex-encoded, a public key, and a public address.

Generate Account Endpoint

Code samples


curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/account \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'
    -d '{
        "password":"yourpassword"
    }'


POST /v1/bc/eth/ropsten/account HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
  "password":"yourpassword"
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/account",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"password\":\"yourpassword\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "ropsten",
    "account"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ password: 'yourpassword' }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/account');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
  "password":"yourpassword"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/account")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"password\":\"yourpassword\"\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n  \"password\":\"yourpassword\"\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "v1,bc,eth,ropsten,account", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"password\":\"yourpassword\"\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/ropsten/account")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/account"

  payload := strings.NewReader("{\n\t\"password\":\"yourpassword\"\n}")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "success": "keystore saved",
        "address": "0x14eefa06e6f617ba9df050d7f9415e5bd0f11d34"
    }
}
Info

The Generate Account Endpoint allows you to generate private-public key-pairs along with an associated public address encoded in a keyfile. A password and user id are required with this POST request. Keyfiles are stored in a keystore subdirectory on our servers. The critical component of the keyfile, the account’s private key, is always encrypted, and it is encrypted with the password entered when the account was created.

The user id is needed in order to associate the keyfile with the specific user.

HTTP Request

POST /v1/bc/eth/${NETWORK}/account

Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)

The returned object contains a public address.

Transaction API

Crypto APIs Transaction API allows you to look up information about pending transactions, query transactions based on hash, create and propagate your own transactions and embed data on the blockchain—all based on the coin/chain resource you’ve selected for your endpoints.

Unlike Bitcoin, Ethereum has no concept of UTXOs. Instead, addresses have a running balance, and use an ever-increasing sequence/nonce for every transaction to maintain proper address state. You can read more about this design decision here. Transaction signing and generation are also different in Ethereum, but for basic transactions, the process is very similar to our Bitcoin API.

Transaction Hash Endpoint

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "eth",
    "bc",
    "mainnet",
    "txs",
    "hash",
    "0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,mainnet,txs,hash,0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "chain": "ETH.mainnet",
        "status": "0x1",
        "index": 79,
        "hash": "0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c",
        "value": "0",              
        "from": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
        "to": "0x946048a75af11c300a274344887ec39452218b3d",
        "date": "2018-10-17 08:31:13 +UTC",
        "block_hash": "0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c",
        "block_number": 6530876,
        "gas": "340977",           
        "gas_price": "6000000000", 
        "gas_used": "227318",      
        "nonce": 61,
        "confirmations": 1016247,
        "token_transfers": {
            "from": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
            "to": "0x946048a75af11c300a274344887ec39452218b3d",
            "tokenName": "EtheremonToken",
            "symbol": "EMONT",
            "tokenType": "ERC-20",
            "tokenID": "30060053",
            "value": "11.10948334"
        },
        "input": "0x0396dcb00000000000000000000000000000000000000000000000000000000000000bbe0000000000000000000000000000000000000000000000000000000042e369c00000000000000000000000000000000000000000000000000000000000000000"
    }
}
Info

The Transaction Hash Endpoint returns detailed information about a given transaction based on its hash.

HTTP Request

GET /v1/bc/eth/${NETWORK}/txs/hash/${TX_HASH}

Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)
TX_HASH - Hash of the transaction in blockchain

TX_HASH is a string representing the hash of the block you’re interested in querying, for example:

0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c

The returned object contains detailed information about the transaction, including the value transfered, fees collected, date received, any scripts associated with an output, and more.

Transactions Index Endpoint by Index, Limit and Block Number

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4 \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "ropsten",
    "txs",
    "block",
    "4173655"
  ],
  "qs": {
    "index": 0,
    "limit": 4
  },
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

querystring = {"index": 0, "limit": 4}

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,ropsten,txs,block,4173655", headers=headers, params=querystring)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "meta": {
        "totalCount": 14,
        "index": 0,
        "limit": 4,
        "results": 4
    },
    "payload": [
        {
            "chain": "ETH.ropsten",
            "status": "0x1",
            "index": 3,
            "hash": "0xf81f9d0091d8e424545f080a6cbd1b5167926371f90828292452ca9df90b551e",
            "value": "60000000000000",
            "from": "0x31d69f8cb2a0c33d43f6a1eac1b5940483d6c40a",
            "to": "0x33e5208b30dd58495bd0037ab2ba9a8762c0e757",
            "date": "2018-10-05 06:26:26 +UTC",
            "block_hash": "0x0114449f2f83df6947c12e91a9d44cf69cdb34eb1d4b169e373ed2ead785e568",
            "block_number": 4173655,
            "gas": "21000",
            "gas_price": "1000000000",
            "gas_used": "21000",
            "nonce": 752,
            "confirmations": 1210755,
            "token_transfers": {},
            "input": "0x"
        },
        {
            "chain": "ETH.ropsten",
            "status": "0x1",
            "index": 2,
            "hash": "0xd6f1f418515ee7694c31f99d85feea9dddc8081317f0f76c6781de9009787da2",
            "value": "60000000000000",
            "from": "0x31d69f8cb2a0c33d43f6a1eac1b5940483d6c40a",
            "to": "0x82de76c863d85c4e3a61a6ea8ae3b7eb452ec0cf",
            "date": "2018-10-05 06:26:26 +UTC",
            "block_hash": "0x0114449f2f83df6947c12e91a9d44cf69cdb34eb1d4b169e373ed2ead785e568",
            "block_number": 4173655,
            "gas": "21000",
            "gas_price": "1000000000",
            "gas_used": "21000",
            "nonce": 751,
            "confirmations": 1210755,
            "token_transfers": {},
            "input": "0x"
        },
        {
            "chain": "ETH.ropsten",
            "status": "0x1",
            "index": 1,
            "hash": "0xe53df98e05e68eff01afca62a9ab720cbbe60fee88813148bc33d931d1ead98b",
            "value": "60000000000000",
            "from": "0x31d69f8cb2a0c33d43f6a1eac1b5940483d6c40a",
            "to": "0x9d271c0005aafb722d177aa6d0a8145c7be80ed4",
            "date": "2018-10-05 06:26:26 +UTC",
            "block_hash": "0x0114449f2f83df6947c12e91a9d44cf69cdb34eb1d4b169e373ed2ead785e568",
            "block_number": 4173655,
            "gas": "21000",
            "gas_price": "1000000000",
            "gas_used": "21000",
            "nonce": 750,
            "confirmations": 1210755,
            "token_transfers": {},
            "input": "0x"
        },
        {
            "chain": "ETH.ropsten",
            "status": "0x1",
            "index": 0,
            "hash": "0x7fc78d0e9a386076cd216ea207f19997d281163aee30204b7ec0a84791c0021f",
            "value": "60000000000000",
            "from": "0x31d69f8cb2a0c33d43f6a1eac1b5940483d6c40a",
            "to": "0x4709ab0acdb83b382240122fe360810668efa728",
            "date": "2018-10-05 06:26:26 +UTC",
            "block_hash": "0x0114449f2f83df6947c12e91a9d44cf69cdb34eb1d4b169e373ed2ead785e568",
            "block_number": 4173655,
            "gas": "21000",
            "gas_price": "1000000000",
            "gas_used": "21000",
            "nonce": 749,
            "confirmations": 1210755,
            "token_transfers": {},
            "input": "0x"
        }
    ]
}
Info

The Transaction Index Endpoint by Index, Limit and Block Number returns detailed information about transactions for the block height defined, starting from the index defined up to the limit defined . In the example above index is 0 and limit is 4, therefore the response will be an array of 4 transactions starting from index 0. The highest number for the limit is 50.

HTTP Request

GET /v1/bc/eth/${NETWORK}/txs/block/${BLOCK_NUMBER}?index=${TX_INDEX}&limit=${LIMIT}

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. ropsten, rinkeby or mainnet)
TX_INDEX ------- Index - start from
LIMIT ------- Limit - up to
BLOCK_NUMBER ------- Block height
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria

TX_INDEX is a integer representing the order of the transaction within the block, for example:

0

LIMIT is a integer representing limit for transactions, for example:

4

BLOCK_NUMBER is a integer representing the height of the block, for example:

4173655

Transactions Index Endpoint by Block Number

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/6530876/79 \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/mainnet/txs/block/6530876/79 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/6530876/79",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "mainnet",
    "txs",
    "6530876",
    "79"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/6530876/79');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/6530876/79")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,mainnet,txs,6530876,79", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/6530876/79")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/6530876/79"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
  "payload": {
      "chain": "ETH.mainnet",
      "status": "0x1",
      "index": 79,
      "hash": "0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c",
      "value": "0",
      "from": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
      "to": "0x946048a75af11c300a274344887ec39452218b3d",
      "date": "2018-10-17 08:31:13 +UTC",
      "block_hash": "0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c",
      "block_number": 6530876,
      "gas": "340977",
      "gas_price": "6000000000",
      "gas_used": "227318",
      "nonce": 61,
      "confirmations": 1016280,
      "token_transfers": [
          {
              "from": "0x0000000000000000000000000000000000000000",
              "to": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
              "tokenName": "MyCryptoHeroes:Hero",
              "symbol": "MCHH",
              "tokenType": "ERC-721",
              "tokenID": "30060053"
          },
          {
              "from": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
              "to": "0x946048a75af11c300a274344887ec39452218b3d",
              "value": "11.10948334",
              "tokenName": "EtheremonToken",
              "symbol": "EMONT",
              "tokenType": "ERC-20"
          }
      ],
      "input": "0x0396dcb00000000000000000000000000000000000000000000000000000000000000bbe0000000000000000000000000000000000000000000000000000000042e369c00000000000000000000000000000000000000000000000000000000000000000"
  }
}
Info

The Transaction Index Endpoint by Block Number returns detailed information about a given transaction based on its index and block height.

HTTP Request

GET /v1/bc/eth/${NETWORK}/txs/block/${BLOCK_NUMBER}/${TX_INDEX}

Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)
TX_INDEX - Index of the transaction in block
BLOCK_NUMBER - Block height

TX_INDEX is a integer representing the order of the transaction within the block, for example:

79

BLOCK_NUMBER is a integer representing the height of the block, for example:

6530876

The returned object contains detailed information about the transaction, including the value transfered, fees collected, date received, any scripts associated with an output, and more.

Transactions Index Endpoint by Block Hash

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79 \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "mainnet",
    "txs",
    "block",
    "0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c",
    "79"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,mainnet,txs,block,0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c,79", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
  "payload": {
      "chain": "ETH.mainnet",
      "status": "0x1",
      "index": 79,
      "hash": "0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c",
      "value": "0",
      "from": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
      "to": "0x946048a75af11c300a274344887ec39452218b3d",
      "date": "2018-10-17 08:31:13 +UTC",
      "block_hash": "0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c",
      "block_number": 6530876,
      "gas": "340977",
      "gas_price": "6000000000",
      "gas_used": "227318",
      "nonce": 61,
      "confirmations": 1016285,
      "token_transfers": [
          {
              "from": "0x0000000000000000000000000000000000000000",
              "to": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
              "tokenName": "MyCryptoHeroes:Hero",
              "symbol": "MCHH",
              "tokenType": "ERC-721",
              "tokenID": "30060053"
          },
          {
              "from": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
              "to": "0x946048a75af11c300a274344887ec39452218b3d",
              "value": "11.10948334",
              "tokenName": "EtheremonToken",
              "symbol": "EMONT",
              "tokenType": "ERC-20"
          }
      ],
      "input": "0x0396dcb00000000000000000000000000000000000000000000000000000000000000bbe0000000000000000000000000000000000000000000000000000000042e369c00000000000000000000000000000000000000000000000000000000000000000"
  }
}
Info

The Transaction Index Endpoint by Block Hash returns detailed information about a given transaction based on its index and block hash.

HTTP Request

GET /v1/bc/eth/${NETWORK}/txs/block/${BLOCK_HASH}/${TX_INDEX}

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. ropsten, rinkeby or mainnet)
TX_INDEX ------- Index of the transaction in block
BLOCK_HASH ------- Block hash

TX_INDEX is a integer representing the order of the transaction within the block, for example:

79

BLOCK_HASH is a string representing the hash of the block, for example:

0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c

The returned object contains detailed information about the transaction, including the value transfered, fees collected, date received, any scripts associated with an output, and more.

Creating Transactions
Info

Using Crypto APIs, you can push transactions to blockchains one of two ways:

Use a third-party library to create your transactions and push raw transactions Use our two-endpoint process outlined below, wherein we generate a TXSkeleton based on your input address, output address, and value to transfer.

New Transaction Endpoint using keystore file stored on our server

In order to use this endpoint you should have an account(keystore file) stored on our servers.

Then, you need to provide the input address(es), output address, value to transfer (in Ether), gas price and gas limit in wei. If gas limit is not specified, a the default value will be set to 60,000 wei. A standard ETH transfer requires a gas limit of 21,000 units of gas. Even if you set a higher than the required gas limit, only the required limit will be deducted.

If needed, a data hexidecimal string can be provided as well (within the json request), as follows: "data" : "0xbc373585" Be aware that the gas limit will be higher than the minumum amount of 21,000 wei.

The password associated with the keyfile should also be specified in order to unlock the account.

HTTP Request

POST /v1/bc/eth/${NETWORK}/txs/new

Code samples


curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'
    -d '{
        "fromAddress" : "0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff",
        "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
        "gasPrice" : 21000000000,
        "gasLimit" : 21000,
        "value" : 1.12,
        "password" : "123456ABCdef"
    }'


POST /v1/bc/eth/ropsten/txs/new HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
  "fromAddress" : "0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff",
  "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
  "gasPrice" : 21000000000,
  "gasLimit" : 21000,
  "value" : 1.12,
  "password" : "123456ABCdef"
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"password\" : \"123456ABCdef\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "ropsten",
    "txs",
    "new"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ fromAddress: '0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff',
  toAddress: '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11',
  gasPrice: 21000000000,
  gasLimit: 21000,
  value: 1.12,
  password: '123456ABCdef' }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
  "fromAddress" : "0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff",
  "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
  "gasPrice" : 21000000000,
  "gasLimit" : 21000,
  "value" : 1.12,
  "password" : "123456ABCdef"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

request.body = "{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"password\" : \"123456ABCdef\"\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n  \"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n  \"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n  \"gasPrice\" : 21000000000,\n  \"gasLimit\" : 21000,\n  \"value\" : 1.12,\n  \"password\" : \"123456ABCdef\"\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "v1,bc,eth,ropsten,txs,new", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"password\" : \"123456ABCdef\"\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new"

  payload := strings.NewReader("{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"password\" : \"123456ABCdef\"\n}")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "hex": "0xfebf0691cc92f67ace032897a83587c44c5b2ef437341c6cfd5dbf1f8f4c288d",
    }
}
Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)

As you can see from the code example, you only need to provide a single public address within the addresses array of both the input and output of your TX request object. You also need to fill in the value with the amount you’d like to transfer from one address to another, gas price, gas limit and password.

While this particular usage will differ between client libraries, the result is the same: the addresses within your wallet will be used as the inputs, as if all of them had been placed within the addresses array.

As a return object, you’ll receive a transaction hash, for example:

{ "payload": { "hex": "0xfebf0691cc92f67ace032897a83587c44c5b2ef437341c6cfd5dbf1f8f4c288d" } }

This hash can be traced in the explorer. It will be with a pending status until it is mined.

Send All Amount Endpoint using keystore file stored on our server

This endpoint allows users to send all the available ether on their accounts to a specified address. Users should only specify the following information:

Gas limit and price are optional. Gas limit will be calculated by the EVM and the gas price has a default value of 15 Gwei.

HTTP Request

POST /v1/bc/eth/${NETWORK}/txs/new/all

Code samples


curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new/all \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'
    -d '{
        "fromAddress" : "0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff",
        "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
        "password" : "123456ABCdef"
    }'


POST /v1/bc/eth/ropsten/txs/new/all HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
  "fromAddress" : "0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff",
  "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
  "password" : "123456ABCdef"
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new/all",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"password\" : \"123456ABCdef\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "ropsten",
    "txs",
    "new",
    "all"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ fromAddress: '0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff',
  toAddress: '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11',
  password: '123456ABCdef' }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new/all');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
  "fromAddress" : "0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff",
  "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
  "password" : "123456ABCdef"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new/all")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

request.body = "{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"password\" : \"123456ABCdef\"\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n  \"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n  \"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n  \"password\" : \"123456ABCdef\"\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "v1,bc,eth,ropsten,txs,new,all", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"password\" : \"123456ABCdef\"\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new/all")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new/all"

  payload := strings.NewReader("{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"password\" : \"123456ABCdef\"\n}")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "hex": "0xfebf0691cc92f67ace032897a83587c44c5b2ef437341c6cfd5dbf1f8f4c288d",
    }
}
Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)

As a return object, you’ll receive a transaction hash, for example:

{ "payload": { "hex": "0xfebf0691cc92f67ace032897a83587c44c5b2ef437341c6cfd5dbf1f8f4c288d" } }

This hash can be traced in the explorer. It will be with a pending status until it is mined.

New Transaction Endpoint with a private key

Crypto APIs allows sending transactions for address that are not hold on our servers. In this case the data that should be provided is as follows:

HTTP Request

POST /v1/bc/eth/${NETWORK}/txs/new-pvtkey

Code samples


curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'
        -d '{
        "fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
        "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
        "gasPrice" : 21000000000,
        "gasLimit" : 21000,
        "value" : 1.12,
        "privateKey" : "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e"
    }'


POST /v1/bc/eth/ropsten/txs/new-pvtkey HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
  "fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
  "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
  "gasPrice" : 21000000000,
  "gasLimit" : 21000,
  "value" : 1.12,
  "privateKey" : "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e"
}

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "ropsten",
    "txs",
    "new-pvtkey"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ fromAddress: '0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be',
  toAddress: '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11',
  gasPrice: 21000000000,
  gasLimit: 21000,
  value: 1.12,
  privateKey: '0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e' }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
  "fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
  "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
  "gasPrice" : 21000000000,
  "gasLimit" : 21000,
  "value" : 1.12,
  "privateKey" : "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

request.body = "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n  \"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n  \"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n  \"gasPrice\" : 21000000000,\n  \"gasLimit\" : 21000,\n  \"value\" : 1.12,\n  \"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "v1,bc,eth,ropsten,txs,new-pvtkey", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey"

  payload := strings.NewReader("{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "hex": "0x300feeceb350a5e2e955d05bd31adde7f4e2c6d2390a16d9435c704525e61ea4"
    }
}
Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)

As you can see from the code example, you only need to provide a single public address within the addresses array of both the input and output of your TX request object. You also need to fill in the value with the amount you’d like to transfer from one address to another, gas price, gas limit and the private key of the address. A standard ETH transfer requires a gas limit of 21,000 units of gas, thefore if gas limit is not priveded the default value will be 60,000 units of gas.

As a return object, you’ll receive a transaction hash, for example:

{ "payload": { "hex": "0x300feeceb350a5e2e955d05bd31adde7f4e2c6d2390a16d9435c704525e61ea4" } }

This hash can be traced in the explorer. It will be with a status pending until it is mined.

Send All Amount Endpoint with a private key

Crypto APIs allows sending transactions (all available eth on a specified address) for address that are not hold on our servers. In this case the data that should be provided is as follows:

Default gas price is 15Gwei, gas limit (if not set) will be calculated by the EVM.

HTTP Request

POST /v1/bc/eth/${NETWORK}/txs/new-pvtkey/all

Code samples


curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey/all \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'
        -d '{
        "fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
        "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
        "privateKey" : "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e"
    }'


POST /v1/bc/eth/ropsten/txs/new-pvtkey/all HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
  "fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
  "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
  "privateKey" : "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e"
}

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey/all",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\", privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "ropsten",
    "txs",
    "new-pvtkey",
    "all"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ fromAddress: '0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be',
  toAddress: '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11',
  privateKey: '0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e' }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey/all');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
  "fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
  "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
  "privateKey" : "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey/all")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

request.body = "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n  \"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n  \"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n  \"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "v1,bc,eth,ropsten,txs,new-pvtkey,all", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey/all")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey/all"

  payload := strings.NewReader("{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\", \n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "hex": "0x300feeceb350a5e2e955d05bd31adde7f4e2c6d2390a16d9435c704525e61ea4"
    }
}
Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)

As a return object, you’ll receive a transaction hash, for example:

{ "payload": { "hex": "0x300feeceb350a5e2e955d05bd31adde7f4e2c6d2390a16d9435c704525e61ea4" } }

This hash can be traced in the explorer. It will be with a status pending until it is mined.

Locally Sign Your Transaction Endpoint

Crypto APIs provides the opportunity to locally sign your transaction. If you want to use third-pary tools for signing your raw transactions you can send to the Locally Sign Your Transaction Endpoint only the following data:

For your convenience we need only this information. We will calculate the nonce for your transaction and add default values for gas price and gas value. After sending the request a JSON will be send to you (see response body). With your JSON returned from the Locally Sign Your Transaction Endpoint you now need to use your private key to sign the data provided.

After signing your JSON locally you will be provided with hex-encoded raw string, for example(depends on your third-party tools):

{ raw: "0xf8690e827d00831e8480940cb1883c01377f45ee5d7448a32b5ac1709afc11877265bab9c48000802aa05be8d75183572592949237b32a9aec605631ca3e7471f038d69fff6a4b320777a00f41b170152f34644c1423b1aaf29b2229f05c35eb7534830d30c974c7f9c7c4", tx: { gas: "0x1e8480", gasPrice: "0x7d00", hash: "0x61710049f64c5187611ebc827d7a9f2479cd7c78e8bf6d66232e8dc57328b09c", input: "0x", nonce: "0xe", r: "0x5be8d75183572592949237b32a9aec605631ca3e7471f038d69fff6a4b320777", s: "0xf41b170152f34644c1423b1aaf29b2229f05c35eb7534830d30c974c7f9c7c4", to: "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11", v: "0x2a", value: "0x7265bab9c48000" } }

We expect the hex-encoded data from the raw field.

HTTP Request

POST /v1/bc/eth/${NETWORK}/txs/send

Code samples


curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/send \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'
    -d '{
        "fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
        "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
        "value" : 1.212
    }'


POST /v1/bc/eth/ropsten/txs/send HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
  "fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
  "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
  "value" : 1.212
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/send",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"value\" : 1.212\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "ropsten",
    "txs",
    "send"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ fromAddress: '0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be',
  toAddress: '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11',
  value: 1.212 }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/send');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
  "fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
  "toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
  "value" : 1.212
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/send")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"value\" : 1.212\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n  \"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n  \"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n  \"value\" : 1.212\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "v1,bc,eth,ropsten,txs,send", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"value\" : 1.212\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/send")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/send"

  payload := strings.NewReader("{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"value\" : 1.212\n}")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response body

{
    "payload": {
        "from": "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
        "gas": "2000000",
        "gasLimit": "21000",
        "gasPrice": "11000000000",
        "nonce": 0,
        "to": "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
        "value": "1212000000000000000"
    }
}
Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)

If request is successful, you’ll receive a JSON with the completed TX and an HTTP Status Code 200.

Push Raw Transaction Endpoint

Once you’ve finished signing the raw transaction locally, send that raw transaction to our Push Raw Transaction Endpoint.

HTTP Request

POST /v1/bc/eth/${NETWORK}/txs/push

Code samples


curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'
    -d '{
        "hex" : "0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69"
    }'


POST /v1/bc/eth/ropsten/txs/push HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
  "hex" : "0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69"
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "ropsten",
    "txs",
    "push"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ hex: '0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69' }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
  "hex" : "0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "v1,bc,eth,ropsten,txs,push", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push"

  payload := strings.NewReader("{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response body

{
    "payload": {
        "hex" : "0x61710049f64c5187611ebc827d7a9f2479cd7c78e8bf6d66232e8dc57328b09c"
    }
}
Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)

$hex is a hex-encoded raw representation of your transaction, for example:

{ "hex" : 0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69 }

If it succeeds, you’ll receive your transacation hash, for example:

{ "payload": { "hex" : "0x61710049f64c5187611ebc827d7a9f2479cd7c78e8bf6d66232e8dc57328b09c" } }

Estimate Transaction Gas Endpoint

Crypto APIs provides an endpoint for estimating the gas needed for a successful transaction. This is very useful when sending ether to contracts or making a transaction with additional data in it.

You have to provide the following data:

HTTP Request

POST /v1/bc/eth/${NETWORK}/txs/gas

Code samples


curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/gas \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'
    -d '{
        "fromAddress" : "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
        "toAddress" : "0xc595B20EEC3d35E8f993d79262669F3ADb6328f7",
        "value" : 0.12,
        "data" : "24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7"
    }'

POST /v1/bc/eth/ropsten/txs/gas HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
  "fromAddress" : "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
  "toAddress" : "0xc595B20EEC3d35E8f993d79262669F3ADb6328f7",
  "value" : 0.12,
  "data" : "24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7"
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/gas",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n  \"fromAddress\" : \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n  \"toAddress\" : \"0xc595B20EEC3d35E8f993d79262669F3ADb6328f7\",\n  \"value\" : 0.12,\n  \"data\" : \"24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "ropsten",
    "txs",
    "gas"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ fromAddress: '0x7857af2143cb06ddc1dab5d7844c9402e89717cb',
  toAddress: '0xc595B20EEC3d35E8f993d79262669F3ADb6328f7',
  value: 0.12,
  data: '24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7' }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/gas');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
  "fromAddress" : "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
  "toAddress" : "0xc595B20EEC3d35E8f993d79262669F3ADb6328f7",
  "value" : 0.12,
  "data" : "24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/gas")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n  \"fromAddress\" : \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n  \"toAddress\" : \"0xc595B20EEC3d35E8f993d79262669F3ADb6328f7\",\n  \"value\" : 0.12,\n  \"data\" : \"24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7\"\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n  \"fromAddress\" : \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n  \"toAddress\" : \"0xc595B20EEC3d35E8f993d79262669F3ADb6328f7\",\n  \"value\" : 0.12,\n  \"data\" : \"24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7\"\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "v1,bc,eth,ropsten,txs,gas", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"fromAddress\" : \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n  \"toAddress\" : \"0xc595B20EEC3d35E8f993d79262669F3ADb6328f7\",\n  \"value\" : 0.12,\n  \"data\" : \"24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7\"\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/gas")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/gas"

  payload := strings.NewReader("{\n  \"fromAddress\" : \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n  \"toAddress\" : \"0xc595B20EEC3d35E8f993d79262669F3ADb6328f7\",\n  \"value\" : 0.12,\n  \"data\" : \"24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7\"\n}")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response body

{
    "payload": {
        "gas_needed": "21040"
    }
}
Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)

If it succeeds, you’ll receive a response with the estimated gas, as follows:

{ "gas_needed": "21040" }

Pending Transactions Endpoint

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/pending \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/mainnet/txs/pending HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/pending",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "mainnet",
    "txs",
    "pending"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/pending');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/pending")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,mainnet,txs,pending", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/pending")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/pending"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "meta": {
        "totalCount": 150,
        "limit": 50,
        "results": 50
    },
    "payload": [
        {
            "hash": "0xf730a960741612568f37fcfdc690cf3a0d64df47608cbd1ccb5b2cd0fd761d7c",
            "nonce": 67952,
            "blockHash": "0xd7a527f3b9e1955672e25b506985423e9643866a4e9c452f312b97772a620156",
            "blockNumber": 7547053,
            "transactionIndex": 0,
            "from": "0x99fe5d6383289cdd56e54fc0baf7f67c957a8888",
            "to": "0x9064c91e51d7021a85ad96817e1432abf6624470",
            "value": "0",
            "gasPrice": "66000000000",
            "gas": "77777",
            "input": "0xa9059cbb000000000000000000000000b0715ffbdbda3b1abf2fc66339412b6cde636728000000000000000000000000000000000000000000000546f85996e215c40000"
        },
        {
            "hash": "0x22c3f2e2314a715c54b551b935f95886cda901ad02db82aa3ea548e154e0a057",
            "nonce": 67953,
            "blockHash": "0xd7a527f3b9e1955672e25b506985423e9643866a4e9c452f312b97772a620156",
            "blockNumber": 7547053,
            "transactionIndex": 1,
            "from": "0x99fe5d6383289cdd56e54fc0baf7f67c957a8888",
            "to": "0x9064c91e51d7021a85ad96817e1432abf6624470",
            "value": "0",
            "gasPrice": "66000000000",
            "gas": "77777",
            "input": "0xa9059cbb000000000000000000000000b0715ffbdbda3b1abf2fc66339412b6cde6367280000000000000000000000000000000000000000000005466d9273dd8bdc0000"
        },
       ...
        {
            "hash": "0xfadc74ab6cb41172541faa6824caf40210ec4a945f7611a3853bf373b3cdaef1",
            "nonce": 7565,
            "blockHash": "0xd7a527f3b9e1955672e25b506985423e9643866a4e9c452f312b97772a620156",
            "blockNumber": 7547053,
            "transactionIndex": 49,
            "from": "0x726718b171c91e8ec0cd484e49aa943703f5be18",
            "to": "0x47ba0689fbd72936749b007d18dfb75d34bf241b",
            "value": "0",
            "gasPrice": "12000000000",
            "gas": "90000",
            "input": "0xa9059cbb000000000000000000000000741586d63e7f2b180f425ad322372fd33ee6321f000000000000000000000000000000000000000000000000000012020bf77000"
        }
    ]
}
Info

Pending Transactions Endpoint makes a call to the EVM and returns all pending transactions. The response might be limited if you lack credits.

HTTP Request

GET /v1/bc/eth/${NETWORK}/txs/pending

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. ropsten, rinkeby or mainnet)
LIMIT 50 limit to 50 transactions
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria

The returned object contains detailed information about the pending transactions.

Queued Transactions Endpoint

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/queued \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/mainnet/txs/queued HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/queued",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "mainnet",
    "txs",
    "queued"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/queued');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/queued")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,mainnet,txs,queued", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/queued")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/queued"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "meta": {
        "totalCount": 73,
        "limit": 3,
        "results": 3
    },
    "payload": [
        {
            "hash": "0x20872578e2f25a1ef7a234c2f7974c54e9c1a9c8ee70e95674750e394fc71dbb",
            "nonce": 67973,
            "blockHash": "0xefef5c28ca8360140aec3920de48ad27e98acc250173240fa16bdf63f9245de3",
            "blockNumber": 7547071,
            "transactionIndex": 0,
            "from": "0x99fe5d6383289cdd56e54fc0baf7f67c957a8888",
            "to": "0x9064c91e51d7021a85ad96817e1432abf6624470",
            "value": "0",
            "gasPrice": "66000000000",
            "gas": "77777",
            "input": "0xa9059cbb00000000000000000000000077c9b160a38e023fe90e50498f984ae0ead58db7000000000000000000000000000000000000000000000a94564788f48d6a8000"
        },
        {
            "hash": "0x7c30619b83063efd3c1c57b85630ea47ee4939b5735ea837de1a4222ef98fca8",
            "nonce": 67974,
            "blockHash": "0xefef5c28ca8360140aec3920de48ad27e98acc250173240fa16bdf63f9245de3",
            "blockNumber": 7547071,
            "transactionIndex": 1,
            "from": "0x99fe5d6383289cdd56e54fc0baf7f67c957a8888",
            "to": "0x9064c91e51d7021a85ad96817e1432abf6624470",
            "value": "0",
            "gasPrice": "66000000000",
            "gas": "77777",
            "input": "0xa9059cbb0000000000000000000000006fc83d6a36e79838f6ef8116627b21a5ef5c95be00000000000000000000000000000000000000000000054915956c4096000000"
        },
        {
            "hash": "0xea4b4e92ba783fd6fe0e1a15e502d2e807f23a806f68b99609ecf5206d97be20",
            "nonce": 15,
            "blockHash": "0xefef5c28ca8360140aec3920de48ad27e98acc250173240fa16bdf63f9245de3",
            "blockNumber": 7547071,
            "transactionIndex": 2,
            "from": "0xd6ad306af05fb9fc6d52025d3e7004a3b1390af2",
            "to": "0xfbb589251a5dcd955f51fc36e560b18fa8a5e974",
            "value": "1013000000000000000",
            "gasPrice": "60000000000",
            "gas": "1000000",
            "input": "0x"
        }
    ]
}
Info

Queued Transactions Endpoint makes a call to the EVM and returns all queued transactions. The response might be limited if you lack credits.

HTTP Request

GET /v1/bc/eth/${NETWORK}/txs/queued

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. ropsten, rinkeby or mainnet)
LIMIT 50 limit to 50 transactions
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria

The returned object contains detailed information about the queued transactions.

Transactions Fee Endpoint

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/fee \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/mainnet/txs/fee HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/fee",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "mainnet",
    "txs",
    "fee"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/fee');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/fee")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,mainnet,txs,fee", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/fee")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/fee"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response Body

{
    "payload": {
        "min": "0.1",
        "max": "1500",
        "average": "11.4",
        "recommended": "5.7",
        "unit": "Gwei"
    }
}
Info

Transactions Fee Endpoint gives information about the gas price for the successfull transactions included in the last 1500 blocks. min shows the lowest gas price, max is the highest and average - the average gas price. recommended is the gas price that we consider as the one that corresponds to a cheap and fast execution. However, it is only a suggestion and should be used at users' sole discretion. All gas prices are in Gwei.

HTTP Request

GET /v1/bc/eth/${NETWORK}/txs/fee

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. ropsten, rinkeby or mainnet)

Contract API

Compared to other blockchains, contracts lie at the heart of Ethereum’s unique value proposition. Contracts can be expressively programmed in languages like Solidity; if you’re not familiar with Ethereum’s contract language you should definitely start there.

We offer a number of API endpoints that significantly simplify contract creation and method calling. Via the methods below, you can embed new contracts into the Ethereum blockchain, check their code and ABI, and initiate contract methods and execution. Essentially, we provide a JSON/HTTP binding for your Ethereum contracts.

With great power comes great responsibility; in other words, it’s easier to shoot yourself in the foot with Ethereum. Don’t The DAO it. Follow best security and safety practices when coding your smart contracts.

Estimate Gas Smart Contract Endpoint

This endpoint retuns the average gas price and gas limit set by the Ethereum Blockchain. At this point for all kinds of deployments the json result will be as follows:

{ "gas_price": 22000000000, "gas_limit": 4300000 }

The actual amount will be known after the deployment is complete.

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts/gas \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/rinkeby/contracts/gas HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts/gas",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [ "https://api.cryptoapis.io:" ],
  "path": [
    "v1",
    "bc",
    "eth",
    "rinkeby",
    "contracts",
    "gas"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts/gas');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts/gas")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,rinkeby,contracts,gas", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts/gas")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts/gas"

  req, _ := http.NewRequest("GET", url, nil)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response body

{
    "payload": {
        "gas_price": "22000000000",
        "gas_limit": "4300000"
    }
}
HTTP Request

GET /v1/bc/eth/${NETWORK}/contracts/gas

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. ropsten, rinkeby or mainnet)
Deploy Smart Contract Endpoint

The Deploy Smart Contract Endpoint allows you to push your smart contract to the Ethereum Blockchain. You have to provide the bytecode - compiled to binary solidity code. At this point you can validate and compile your smart contract to bytecode at the Ethereum official website - Solidity IDE. When you finish the solidity code go to Compile -> Choose the name of the contract -> Details and from there go to the part BYTECODE and copy the object propery. It should only be a hexadecimal number, for example:

"object":"60806040523480156200001157600080fd5b50336000................"

A private key (associated with a funded Ethereum external account), fromAddress, byteCode, gasPrice and gasLimit, to publish, Crypto APIs will embed the contract into the blockchain and return the transaction hash that created the contract, for example

{ "privateKey" : "4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1", "fromAddress" : "0xe7cc96ba0562dfba61a55c8dd2e162a30942f402", "gasPrice" : 21000000000, "gasLimit" : 2100000, "byteCode": "0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b5400000000000000000000000000000000000000000000000000000000815250600290805190602001906200009f92919062000128565b506040805190810160405280600d81526020017f6d616166616b6120546f6b656e0000000000000000000000000000000000000081525060039080519060200190620000ed92919062000128565b506012600460006101000a81548160ff021916908360ff16021790555062093a804201600781905550624099804201600881905550620001d7565b828054600181600116 .... ffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029" }

The response will be date and hash of the transaction:

{ "date": "2018-07-20 12:41:39.703", "tx_hash": "0xf24889df3b88f8bfe2898a41ecab8ec62b60839a22eec606afe3dff9025b86f6" }

It is very important to provide enough gas in order the transaction to be successful!

Code samples


curl -X POST https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'
    -d '{
        "privateKey" : "4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1",
        "fromAddress" : "0xe7cc96ba0562dfba61a55c8dd2e162a30942f402",
        "gasPrice" : 21000000000,
        "gasLimit" : 2100000,
        "byteCode": "0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029"
    }'


POST /v1/bc/eth/rinkeby/contracts HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
  
  "privateKey" : "4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1",
  "fromAddress" : "0xe7cc96ba0562dfba61a55c8dd2e162a30942f402",
  "gasPrice" : 21000000000,
  "gasLimit" : 2100000,
  "byteCode": "0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029"
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\n\t\"privateKey\" : \"4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1\",\n\t\"fromAddress\" : \"0xe7cc96ba0562dfba61a55c8dd2e162a30942f402\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 2100000,\n\t\"byteCode\": \"0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": [https://api.cryptoapis.io],
  "path": [
    "v1",
    "bc",
    "eth",
    "rinkeby",
    "contracts"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ privateKey: '4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1',
  fromAddress: '0xe7cc96ba0562dfba61a55c8dd2e162a30942f402',
  gasPrice: 21000000000,
  gasLimit: 2100000,
  byteCode: '0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029' }));
req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
  
  "privateKey" : "4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1",
  "fromAddress" : "0xe7cc96ba0562dfba61a55c8dd2e162a30942f402",
  "gasPrice" : 21000000000,
  "gasLimit" : 2100000,
  "byteCode": "0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\n\t\"privateKey\" : \"4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1\",\n\t\"fromAddress\" : \"0xe7cc96ba0562dfba61a55c8dd2e162a30942f402\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 2100000,\n\t\"byteCode\": \"0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029\"\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n\t\n\t\"privateKey\" : \"4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1\",\n\t\"fromAddress\" : \"0xe7cc96ba0562dfba61a55c8dd2e162a30942f402\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 2100000,\n\t\"byteCode\": \"0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029\"\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "v1,bc,eth,rinkeby,contracts", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\n\t\"privateKey\" : \"4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1\",\n\t\"fromAddress\" : \"0xe7cc96ba0562dfba61a55c8dd2e162a30942f402\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 2100000,\n\t\"byteCode\": \"0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029\"\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts"

  payload := strings.NewReader("{\n\t\n\t\"privateKey\" : \"4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1\",\n\t\"fromAddress\" : \"0xe7cc96ba0562dfba61a55c8dd2e162a30942f402\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 2100000,\n\t\"byteCode\": \"0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029\"\n}")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response body

{
    "payload": {
        "hex": "0xf24889df3b88f8bfe2898a41ecab8ec62b60839a22eec606afe3dff9025b86f6"
    }
}
HTTP Request

POST /v1/bc/eth/${NETWORK}/contracts

Query Parameters
Parameter Default Description
NETWORK - Network name (e.g. ropsten, rinkeby or mainnet)

Token API

Crypto APIs Token API allows you to get token balances of adressess, as well as to transfer tokens from one address to another.

Get Token Balance

In the request url you should provide the address you want to observe and the contract address that created the token. After sending the request you will receive a json object with the name of the token, the amount and its symbol.

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "rinkeby",
    "token",
    "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
    "0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014",
    "balance"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,rinkeby,token,0x7857af2143cb06ddc1dab5d7844c9402e89717cb,0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014,balance", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance"

  req, _ := http.NewRequest("GET", url, nil)

  res, _ := http.DefaultClient.Do(req)
  
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response body

{
    "payload": {
        "name": "Elly Token",
        "token": "0.70429514041990424",
        "symbol": "ELT"
    }
}
HTTP Request

GET /v1/bc/eth/${NETWORK}/tokens/{address}/{contract}/balance

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. ropsten, rinkeby or mainnet)
ADDRESS ------- address with tokens (e.g. "0x7857af2143cb06ddc1dab5d7844c9402e89717cb")
CONTRACT ------- contract address (e.g. "0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014")
Transfer Tokens

In order to transfer tokens from one address to another you should provide the from address, the private key or password (if it is an account stored on our servers), the to address, the contract adress that created the tokens and the amount of tokens you would like to transfer. It is also necessary to provide gas price and gas limit. By default these are set to: 21000000000 wei and 60000 wei, accordingly. The amount of token is per unit, for example: if you want to send 120 tokens you should specify:

"token" : 120;

and for 10.5 tokens:

"token" : 10.5,

etc...;

Code samples


curl -X POST https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/transfer \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'
    -d '{
        "fromAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
        "toAddress" : "0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8",
        "contract" : "0xe7d553c3aab5943ec097d60535fd06f1b75db43e",
        "password": "abc123456" or "privateKey" : "0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed",
        "gasPrice" : 11500000000,
        "gasLimit" : 60000,
        "token" : 115
    }'

POST /v1/bc/eth/rinkeby/tokens/transfer HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key

{
  "fromAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
  "toAddress" : "0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8",
  "contract" : "0xe7d553c3aab5943ec097d60535fd06f1b75db43e",
  "password": "abc123456" or "privateKey" : "0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed",
  "gasPrice" : 11500000000,
  "gasLimit" : 60000,
  "token" : 115
}


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/transfer",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  },
  "processData": false,
  "data": "{\n\t\"fromAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"toAddress\" : \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n\t\"contract\" : \"0xe7d553c3aab5943ec097d60535fd06f1b75db43e\",\n\t \"password\": \"abc123456\" or \n\t\"privateKey\" : \"0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed\",\n\t\"gasPrice\" : 11500000000,\n\t\"gasLimit\" : 60000,\n\t\"token\" : 115\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "POST",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "rinkeby",
    "token",
    "transfer"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ fromAddress: '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11',
  toAddress: '0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8',
  contract: '0xe7d553c3aab5943ec097d60535fd06f1b75db43e',
  password: 'abc123456' or privateKey: '0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed',
  gasPrice: 11500000000,
  gasLimit: 60000,
  token: 115 }));
req.end();

<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/transfer');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

$request->setBody('{
  "fromAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
  "toAddress" : "0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8",
  "contract" : "0xe7d553c3aab5943ec097d60535fd06f1b75db43e",
  "password" : "abc123456" or "privateKey" : "0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed",
  "gasPrice" : 11500000000,
  "gasLimit" : 60000,
  "token" : 115
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/transfer")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"fromAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"toAddress\" : \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n\t\"contract\" : \"0xe7d553c3aab5943ec097d60535fd06f1b75db43e\",\n\t \"password\": \"abc123456\" or \n\t\"privateKey\" : \"0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed\",\n\t\"gasPrice\" : 11500000000,\n\t\"gasLimit\" : 60000,\n\t\"token\" : 115\n}"

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

payload = "{\n\t\"fromAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"toAddress\" : \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n\t\"contract\" : \"0xe7d553c3aab5943ec097d60535fd06f1b75db43e\",\n\t \"password\": \"abc123456\" or \n\t\"privateKey\" : \"0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed\",\n\t\"gasPrice\" : 11500000000,\n\t\"gasLimit\" : 60000,\n\t\"token\" : 115\n}"

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("POST", "v1,bc,eth,rinkeby,token,transfer", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"fromAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"toAddress\" : \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n\t\"contract\" : \"0xe7d553c3aab5943ec097d60535fd06f1b75db43e\",\n\t \"password\": \"abc123456\" or \n\t\"privateKey\" : \"0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed\",\n\t\"gasPrice\" : 11500000000,\n\t\"gasLimit\" : 60000,\n\t\"token\" : 115\n}");
Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/transfer")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/transfer"

  payload := strings.NewReader("{\n\t\"fromAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"toAddress\" : \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n\t\"contract\" : \"0xe7d553c3aab5943ec097d60535fd06f1b75db43e\",\n\t \"password\": \"abc123456\" or \n\t\"privateKey\" : \"0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed\",\n\t\"gasPrice\" : 11500000000,\n\t\"gasLimit\" : 60000,\n\t\"token\" : 115\n}")

  req, _ := http.NewRequest("POST", url, payload)

  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  res, _ := http.DefaultClient.Do(req)

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response body

{
    "payload": {
        "hex": "0xeca1b4ad7b3df4fb65b0e3c1e079f2f6878bd5bd6185fe23319f7dec6a2fc203"
    }
}
HTTP Request

POST /v1/bc/eth/${NETWORK}/tokens/transfer

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. ropsten, rinkeby or mainnet)
Get Address Token Transfers

In the request url you should provide the address you want to observe. After sending the request you will receive a json object with a list of each transfer for the specified address that includes the following infromation: the contract, the name, symbol and type of the token.

Code samples


curl -X GET https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/address/0x2b5634c42055806a59e9107ed44d43c426e58258 \
    -H 'Content-Type: application/json' \
    -H 'X-API-Key: my-api-key'


GET /v1/bc/eth/rinkeby/tokens/address/0x2b5634c42055806a59e9107ed44d43c426e58258 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key


var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/address/0x2b5634c42055806a59e9107ed44d43c426e58258",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});


var http = require("http");

var options = {
  "method": "GET",
  "hostname": [
    "https://api.cryptoapis.io"
  ],
  "path": [
    "v1",
    "bc",
    "eth",
    "rinkeby",
    "token",
    "address",
    "0x2b5634c42055806a59e9107ed44d43c426e58258"
  ],
  "headers": {
    "Content-Type": "application/json",
    "X-API-Key": "my-api-key"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();


<?php

$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/address/0x2b5634c42055806a59e9107ed44d43c426e58258');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'X-API-Key' => 'my-api-key'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
?>


require 'uri'
require 'net/http'

url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/address/0x2b5634c42055806a59e9107ed44d43c426e58258")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'

response = http.request(request)
puts response.read_body


import http.client

conn = http.client.HTTPConnection("https://api.cryptoapis.io")

headers = {
  'Content-Type': "application/json",
  'X-API-Key': "my-api-key"
}

conn.request("GET", "v1,bc,eth,rinkeby,token,address,0x2b5634c42055806a59e9107ed44d43c426e58258", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))


OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/address/0x2b5634c42055806a59e9107ed44d43c426e58258")
  .get()
  .addHeader("Content-Type", "application/json")
  .addHeader("X-API-Key", "my-api-key")
  .build();

Response response = client.newCall(request).execute();


package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/address/0x2b5634c42055806a59e9107ed44d43c426e58258"

  req, _ := http.NewRequest("GET", url, nil)

  res, _ := http.DefaultClient.Do(req)
  
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-API-Key", "my-api-key")

  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))

}

Response body

{
    "meta": {
        "totalCount": 37,
        "limit": 50,
        "results": 37
    },
    "payload": [
        {
            "contract": "0xa4ba9e023a4f8d695e16d3f3050f96aea0001c98",
            "symbol": "ePRX",
            "name": "eProxy",
            "type": "ERC-20"
        },
        {
            "contract": "0xdc888b47268a704eea6e57d9d6ff455cc7332afc",
            "symbol": "ePRX",
            "name": "eProxy",
            "type": "ERC-20"
        },
        {
            "contract": "0x24fd4d057e131623429878270836607e43d89c10",
            "symbol": "ePRX",
            "name": "eProxy",
            "type": "ERC-20"
        },
        ...
        {
            "contract": "0x74f46ca46a49015c7677c9ee237479b17cf7d8e7",
            "symbol": "COSM",
            "name": "CosmoCoin",
            "type": "ERC-20"
        }
    ]
}
HTTP Request

GET /v1/bc/eth/${NETWORK}/tokens/address/{address}

Query Parameters
Parameter Default Description
NETWORK ------- Network name (e.g. ropsten, rinkeby or mainnet)
ADDRESS ------- address with tokens (e.g. "0x2b5634c42055806a59e9107ed44d43c426e58258")
LIMIT ------- limit to n results
Meta Response
Variable Type Description
totalCount int Total count of the items in the listing for the given criteria
index int Sequential index number of the items list start position (depends on the skip parameter) for the given criteria
limit int Limit number of the items list (depends on the limit parameter) for the given criteria.
results int Count of the items listed in the current response for the given criteria

Payment Forwarding

One of the well-known benefits of cryptocurrency is the ability to allow users to partake in online commerce without necessarily requiring extensive setup barriers, like registering new accounts. In that spirit, our Payment Forwarding API is the easiest way to accept—and consolidate—payments securely without forcing your users to create accounts and jump through unnecessary loops. It’s also a generic way to automatically transfer value from one address to another. While there are many possible use cases, the two we hear most about are:

A way to generate payment-specific addresses for which funds will automatically transfer to a main merchant address. Great for automatic merchandise (whether physical or virtual) processing. A method to easily fund a multisignature address from any wallet by providing a classic address that will automatically transfer to the multisignature/pay-to-script-hash address. We do not take a fee on payment forwarding, other than the required 21,000 units of wei for gas fee; payments are free. However, as part of your own services, you can include a f