NAV Navbar
Shell HTTP JavaScript Node.JS Ruby Python Java Go
  • ONCHAIN.IO API overview v2
  • Authentication
  • Address API
  • Transaction API
  • Multisig
  • Ethereum API
  • ERC20
  • Schemas
  • ONCHAIN.IO API overview v2

    Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

    Base URLs:

    Authentication

    Address API

    Get Balance

    Code samples

    # You can also use wget
    curl -X GET https://onchain.io/api/address/balance/{coin}/{address} \
      -H 'Accept: application/json' \
      -H 'X-API-KEY: API_KEY'
    
    
    GET https://onchain.io/api/address/balance/{coin}/{address} HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/address/balance/{coin}/{address}',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    
    const headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    fetch('https://onchain.io/api/address/balance/{coin}/{address}',
    {
      method: 'GET',
    
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
    
    
    require 'rest-client'
    require 'json'
    
    headers = {
      'Accept' => 'application/json',
      'X-API-KEY' => 'API_KEY'
    }
    
    result = RestClient.get 'https://onchain.io/api/address/balance/{coin}/{address}',
      params: {
      }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json',
      'X-API-KEY': 'API_KEY'
    }
    
    r = requests.get('https://onchain.io/api/address/balance/{coin}/{address}', params={
    
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/address/balance/{coin}/{address}");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("GET");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());
    
    
    package main
    
    import (
           "bytes"
           "net/http"
    )
    
    func main() {
    
        headers := map[string][]string{
            "Accept": []string{"application/json"},
            "X-API-KEY": []string{"API_KEY"},
    
        }
    
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("GET", "https://onchain.io/api/address/balance/{coin}/{address}", data)
        req.Header = headers
    
        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }
    
    

    GET /address/balance/{coin}/{address}

    Returns the satoshi balance, usd balance and user viewable balance for an address. For ERC20 tokens you need to pass in the contract ID and the number of decimal places.

    Parameters

    Parameter In Type Required Description
    coin path string true The name of the coin i.e. bitcoin
    address path string true The public address to lookup
    contract_id query string false The contract ID of the ERC20 token.
    decimal_places query integer false The number of decimal places for this contract.

    Example responses

    {
      "usd_balance": 120.34,
      "balance": 27018060,
      "unconfirmed_balance": 27018060,
      "human_balance": 0.2701806,
      "human_unconfirmed_balance": 0.2701806
    }
    
    {
      "message": "Something went wrong."
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Returns the balances balance
    default Default If an error occurs error_message

    Get Balances

    Code samples

    # You can also use wget
    curl -X GET https://onchain.io/api/address/balances/{coin}/{addresses} \
      -H 'Accept: application/json' \
      -H 'X-API-KEY: API_KEY'
    
    
    GET https://onchain.io/api/address/balances/{coin}/{addresses} HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/address/balances/{coin}/{addresses}',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    
    const headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    fetch('https://onchain.io/api/address/balances/{coin}/{addresses}',
    {
      method: 'GET',
    
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
    
    
    require 'rest-client'
    require 'json'
    
    headers = {
      'Accept' => 'application/json',
      'X-API-KEY' => 'API_KEY'
    }
    
    result = RestClient.get 'https://onchain.io/api/address/balances/{coin}/{addresses}',
      params: {
      }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json',
      'X-API-KEY': 'API_KEY'
    }
    
    r = requests.get('https://onchain.io/api/address/balances/{coin}/{addresses}', params={
    
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/address/balances/{coin}/{addresses}");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("GET");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());
    
    
    package main
    
    import (
           "bytes"
           "net/http"
    )
    
    func main() {
    
        headers := map[string][]string{
            "Accept": []string{"application/json"},
            "X-API-KEY": []string{"API_KEY"},
    
        }
    
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("GET", "https://onchain.io/api/address/balances/{coin}/{addresses}", data)
        req.Header = headers
    
        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }
    
    

    GET /address/balances/{coin}/{addresses}

    Returns the satoshi balance, usd balance and user viewable balance for a set of addresses

    Parameters

    Parameter In Type Required Description
    coin path string true The name of the coin i.e. bitcoin
    addresses path string true A comma seperated list of public addresses
    contract_id query string false The contract ID of the ERC20 token.
    decimal_places query integer false The number of decimal places for this contract.

    Example responses

    {
      "totals": {
        "usd_balance": 120.34,
        "balance": 27018060,
        "unconfirmed_balance": 27018060,
        "human_balance": 0.2701806,
        "human_unconfirmed_balance": 0.2701806
      },
      "addresses": [
        {
          "address": "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY",
          "usd_balance": 120.34,
          "balance": 27018060,
          "unconfirmed_balance": 27018060,
          "human_balance": 0.2701806,
          "human_unconfirmed_balance": 0.2701806
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    default Default Returns the balances balances

    Get History

    Code samples

    # You can also use wget
    curl -X GET https://onchain.io/api/address/history/{coin}/{addresses} \
      -H 'Accept: application/json' \
      -H 'X-API-KEY: API_KEY'
    
    
    GET https://onchain.io/api/address/history/{coin}/{addresses} HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/address/history/{coin}/{addresses}',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    
    const headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    fetch('https://onchain.io/api/address/history/{coin}/{addresses}',
    {
      method: 'GET',
    
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
    
    
    require 'rest-client'
    require 'json'
    
    headers = {
      'Accept' => 'application/json',
      'X-API-KEY' => 'API_KEY'
    }
    
    result = RestClient.get 'https://onchain.io/api/address/history/{coin}/{addresses}',
      params: {
      }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json',
      'X-API-KEY': 'API_KEY'
    }
    
    r = requests.get('https://onchain.io/api/address/history/{coin}/{addresses}', params={
    
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/address/history/{coin}/{addresses}");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("GET");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());
    
    
    package main
    
    import (
           "bytes"
           "net/http"
    )
    
    func main() {
    
        headers := map[string][]string{
            "Accept": []string{"application/json"},
            "X-API-KEY": []string{"API_KEY"},
    
        }
    
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("GET", "https://onchain.io/api/address/history/{coin}/{addresses}", data)
        req.Header = headers
    
        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }
    
    

    GET /address/history/{coin}/{addresses}

    Returns the transaction history for an address or addresses.

    Parameters

    Parameter In Type Required Description
    coin path string true The name of the coin i.e. bitcoin
    addresses path string true A comma seperated list of public addresses
    contract_id query string false The contract ID of the ERC20 token.
    decimal_places query integer false The number of decimal places for this contract.

    Example responses

    {
      "total_txs": 37000,
      "txs": [
        {
          "confirmations": 3,
          "time": 1524579200,
          "is_deposit": true,
          "address": "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY",
          "amount": 27018060,
          "human_amount": 0.2701806
        }
      ]
    }
    
    {
      "message": "Something went wrong."
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Returns the transaction history for an address or addresses history
    default Default If an error occurs error_message

    Get Unspent Outs

    Code samples

    # You can also use wget
    curl -X GET https://onchain.io/api/address/utxo/{coin}/{addresses} \
      -H 'Accept: application/json' \
      -H 'X-API-KEY: API_KEY'
    
    
    GET https://onchain.io/api/address/utxo/{coin}/{addresses} HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/address/utxo/{coin}/{addresses}',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    
    const headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    fetch('https://onchain.io/api/address/utxo/{coin}/{addresses}',
    {
      method: 'GET',
    
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
    
    
    require 'rest-client'
    require 'json'
    
    headers = {
      'Accept' => 'application/json',
      'X-API-KEY' => 'API_KEY'
    }
    
    result = RestClient.get 'https://onchain.io/api/address/utxo/{coin}/{addresses}',
      params: {
      }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json',
      'X-API-KEY': 'API_KEY'
    }
    
    r = requests.get('https://onchain.io/api/address/utxo/{coin}/{addresses}', params={
    
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/address/utxo/{coin}/{addresses}");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("GET");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());
    
    
    package main
    
    import (
           "bytes"
           "net/http"
    )
    
    func main() {
    
        headers := map[string][]string{
            "Accept": []string{"application/json"},
            "X-API-KEY": []string{"API_KEY"},
    
        }
    
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("GET", "https://onchain.io/api/address/utxo/{coin}/{addresses}", data)
        req.Header = headers
    
        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }
    
    

    GET /address/utxo/{coin}/{addresses}

    Returns the unspent outputs for an address or addresses.

    Parameters

    Parameter In Type Required Description
    coin path string true The name of the coin i.e. bitcoin
    addresses path string true A comma seperated list of public addresses

    Example responses

    [
      {
        "amount": 395260,
        "vout": 1,
        "txid": "9bd89c6555d42a2e0922f32f9227440def71ffc4e03ac6eda4c79ebbc0ceed1f",
        "script_pub_key": "76a91404d075b3f501deeef5565143282b6cfe8fad5e9488ac"
      }
    ]
    
    {
      "message": "Something went wrong."
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Returns the unspent outputs for an address or addresses Inline
    default Default If an error occurs error_message

    Response Schema

    Status Code 200

    Name Type Required Description
    anonymous [utxo] false No description
    » amount integer false No description
    » vout integer false No description
    » txid string false No description
    » script_pub_key string false No description

    Transaction API

    Create Unsigned Transaction

    Code samples

    # You can also use wget
    curl -X POST https://onchain.io/api/transaction/create/{coin}?to=2MttUxQo4jjyVtb5Br49WUEy3LZoZuwtba5&from=036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49&amount=80000 \
      -H 'Accept: application/json' \
      -H 'X-API-KEY: API_KEY'
    
    
    POST https://onchain.io/api/transaction/create/{coin}?to=2MttUxQo4jjyVtb5Br49WUEy3LZoZuwtba5&from=036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49&amount=80000 HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/transaction/create/{coin}',
      method: 'post',
      data: '?to=2MttUxQo4jjyVtb5Br49WUEy3LZoZuwtba5&from=036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49&amount=80000',
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    
    const headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    fetch('https://onchain.io/api/transaction/create/{coin}?to=2MttUxQo4jjyVtb5Br49WUEy3LZoZuwtba5&from=036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49&amount=80000',
    {
      method: 'POST',
    
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
    
    
    require 'rest-client'
    require 'json'
    
    headers = {
      'Accept' => 'application/json',
      'X-API-KEY' => 'API_KEY'
    }
    
    result = RestClient.post 'https://onchain.io/api/transaction/create/{coin}',
      params: {
      'to' => 'string',
    'from' => 'string',
    'amount' => 'integer'
    }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json',
      'X-API-KEY': 'API_KEY'
    }
    
    r = requests.post('https://onchain.io/api/transaction/create/{coin}', params={
      'to': '2MttUxQo4jjyVtb5Br49WUEy3LZoZuwtba5',  'from': '036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49',  'amount': '80000'
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/transaction/create/{coin}?to=2MttUxQo4jjyVtb5Br49WUEy3LZoZuwtba5&from=036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49&amount=80000");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());
    
    
    package main
    
    import (
           "bytes"
           "net/http"
    )
    
    func main() {
    
        headers := map[string][]string{
            "Accept": []string{"application/json"},
            "X-API-KEY": []string{"API_KEY"},
    
        }
    
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("POST", "https://onchain.io/api/transaction/create/{coin}", data)
        req.Header = headers
    
        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }
    
    

    POST /transaction/create/{coin}

    Create an unsigned transaction. OnChain returns the transaction for the specified coin in hex format along with a list of hashes that need to be signed.

    Parameters

    Parameter In Type Required Description
    coin path string true The name of the coin i.e. bitcoin
    to query string true The address to send coins to.
    from query string true The addresses we are sending coins from. OnChain will fetch unspent outs from each address in order until the amount to send is met. We use the public hex key of the address not the hash.
    amount query integer true The amount we wish to send.
    fee_address query string false An address to send fees to.
    fee_amount query integer false The amount of fees to send.
    miners_fee query integer false The amount to send to the miners.

    Example responses

    {
      "tx": "02000000011cd5d7621e2a7c9403e54e089cb0b5430b83ed13f1b897d3e319b100ba1b059b01000000db00483045022100d7534c80bc0a42addc3d955f74e31610aa78bf15d79ec4df4c36dc98e802f5200220369cab1bccb2dbca0921444ce3fafb15129fa0494d041998be104df39b8895ec01483045022100fe48c4c1d46e163acaff6b0d2e702812d20",
      "total_input_value": 500000,
      "hashes": [
        {
          "input_index": 0,
          "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49",
          "hash_to_sign": "004cfaf7cff86e7f171db23d67acd6c986273e578d7466e43e2b78913e1ce7c7"
        }
      ]
    }
    
    {
      "message": "Something went wrong."
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The unsigned transaction in hex format and a list of hashes that need signatures. hashes_to_sign
    default Default If an error occurs error_message

    Sign and Send a Transaction

    Code samples

    # You can also use wget
    curl -X POST https://onchain.io/api/transaction/sign_and_send/{coin} \
      -H 'Content-Type: application/json' \
      -H 'Accept: application/json' \
      -H 'X-API-KEY: API_KEY'
    
    
    POST https://onchain.io/api/transaction/sign_and_send/{coin} HTTP/1.1
    Host: onchain.io
    Content-Type: application/json
    Accept: application/json
    
    
    var headers = {
      'Content-Type':'application/json',
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/transaction/sign_and_send/{coin}',
      method: 'post',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    const inputBody = '{
      "tx": "string",
      "signatures": [
        {
          "hash_to_sign": "7a77eb8e0e9e56ca925473cbfaa215822b1bc73de40dc9098d66b2eb785af9db",
          "signature": "304402202915d9763c944918712155522ed99d1f01d7998c349316b5ba2d75ac41bb3dae022033b4d5800d2c5f461abf42a967625f77f4e16933bf9fa81aa753c423687eee02",
          "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49",
          "input_index": 0
        }
      ]
    }';
    const headers = {
      'Content-Type':'application/json',
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    fetch('https://onchain.io/api/transaction/sign_and_send/{coin}',
    {
      method: 'POST',
      body: inputBody,
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
    
    
    require 'rest-client'
    require 'json'
    
    headers = {
      'Content-Type' => 'application/json',
      'Accept' => 'application/json',
      'X-API-KEY' => 'API_KEY'
    }
    
    result = RestClient.post 'https://onchain.io/api/transaction/sign_and_send/{coin}',
      params: {
      }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'X-API-KEY': 'API_KEY'
    }
    
    r = requests.post('https://onchain.io/api/transaction/sign_and_send/{coin}', params={
    
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/transaction/sign_and_send/{coin}");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());
    
    
    package main
    
    import (
           "bytes"
           "net/http"
    )
    
    func main() {
    
        headers := map[string][]string{
            "Content-Type": []string{"application/json"},
            "Accept": []string{"application/json"},
            "X-API-KEY": []string{"API_KEY"},
    
        }
    
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("POST", "https://onchain.io/api/transaction/sign_and_send/{coin}", data)
        req.Header = headers
    
        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }
    
    

    POST /transaction/sign_and_send/{coin}

    Sign and send transaction onto the network.

    Body parameter

    {
      "tx": "string",
      "signatures": [
        {
          "hash_to_sign": "7a77eb8e0e9e56ca925473cbfaa215822b1bc73de40dc9098d66b2eb785af9db",
          "signature": "304402202915d9763c944918712155522ed99d1f01d7998c349316b5ba2d75ac41bb3dae022033b4d5800d2c5f461abf42a967625f77f4e16933bf9fa81aa753c423687eee02",
          "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49",
          "input_index": 0
        }
      ]
    }
    

    Parameters

    Parameter In Type Required Description
    coin path string true The name of the coin i.e. bitcoin
    body body signatures true No description
    » tx body string false No description
    » signatures body [signature] false No description
    »» hash_to_sign body string false No description
    »» signature body string false No description
    »» public_key body string false No description
    »» input_index body integer false No description

    Example responses

    {
      "status_code": 200,
      "message": "3bcf74e3421148db08daf6f5787a698534046bff54b2af1b8252b9166f8f4749"
    }
    
    {
      "message": "Something went wrong."
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Send a transaction onto the network. send_status
    default Default If an error occurs error_message

    Send Raw Transaction

    Code samples

    # You can also use wget
    curl -X POST https://onchain.io/api/transaction/send_raw/{coin}?rawtx=string \
      -H 'Accept: application/json' \
      -H 'X-API-KEY: API_KEY'
    
    
    POST https://onchain.io/api/transaction/send_raw/{coin}?rawtx=string HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/transaction/send_raw/{coin}',
      method: 'post',
      data: '?rawtx=string',
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    
    const headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    fetch('https://onchain.io/api/transaction/send_raw/{coin}?rawtx=string',
    {
      method: 'POST',
    
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
    
    
    require 'rest-client'
    require 'json'
    
    headers = {
      'Accept' => 'application/json',
      'X-API-KEY' => 'API_KEY'
    }
    
    result = RestClient.post 'https://onchain.io/api/transaction/send_raw/{coin}',
      params: {
      'rawtx' => 'string'
    }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json',
      'X-API-KEY': 'API_KEY'
    }
    
    r = requests.post('https://onchain.io/api/transaction/send_raw/{coin}', params={
      'rawtx': 'string'
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/transaction/send_raw/{coin}?rawtx=string");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());
    
    
    package main
    
    import (
           "bytes"
           "net/http"
    )
    
    func main() {
    
        headers := map[string][]string{
            "Accept": []string{"application/json"},
            "X-API-KEY": []string{"API_KEY"},
    
        }
    
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("POST", "https://onchain.io/api/transaction/send_raw/{coin}", data)
        req.Header = headers
    
        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }
    
    

    POST /transaction/send_raw/{coin}

    Send a transaction onto the network.

    Parameters

    Parameter In Type Required Description
    coin path string true The name of the coin i.e. bitcoin
    rawtx query string true The raw signed transaction as a hex string

    Example responses

    {
      "status_code": 200,
      "message": "3bcf74e3421148db08daf6f5787a698534046bff54b2af1b8252b9166f8f4749"
    }
    
    {
      "message": "Something went wrong."
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Send a transaction onto the network. send_status
    default Default If an error occurs error_message

    Multisig

    Create Unsigned Transaction

    Code samples

    # You can also use wget
    curl -X POST https://onchain.io/api/multi_sig/create/{coin} \
      -H 'Content-Type: application/json' \
      -H 'Accept: application/json' \
      -H 'X-API-KEY: API_KEY'
    
    
    POST https://onchain.io/api/multi_sig/create/{coin} HTTP/1.1
    Host: onchain.io
    Content-Type: application/json
    Accept: application/json
    
    
    var headers = {
      'Content-Type':'application/json',
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/multi_sig/create/{coin}',
      method: 'post',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    const inputBody = '{
      "number_of_required_signatures": 1,
      "amount": 100000,
      "to": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX",
      "fee_amount": 100000,
      "fee_address": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX",
      "miners_fee": 40000,
      "redeem_scripts": {
        "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49"
      }
    }';
    const headers = {
      'Content-Type':'application/json',
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    fetch('https://onchain.io/api/multi_sig/create/{coin}',
    {
      method: 'POST',
      body: inputBody,
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
    
    
    require 'rest-client'
    require 'json'
    
    headers = {
      'Content-Type' => 'application/json',
      'Accept' => 'application/json',
      'X-API-KEY' => 'API_KEY'
    }
    
    result = RestClient.post 'https://onchain.io/api/multi_sig/create/{coin}',
      params: {
      }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'X-API-KEY': 'API_KEY'
    }
    
    r = requests.post('https://onchain.io/api/multi_sig/create/{coin}', params={
    
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/multi_sig/create/{coin}");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());
    
    
    package main
    
    import (
           "bytes"
           "net/http"
    )
    
    func main() {
    
        headers := map[string][]string{
            "Content-Type": []string{"application/json"},
            "Accept": []string{"application/json"},
            "X-API-KEY": []string{"API_KEY"},
    
        }
    
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("POST", "https://onchain.io/api/multi_sig/create/{coin}", data)
        req.Header = headers
    
        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }
    
    

    POST /multi_sig/create/{coin}

    Create an unsigned transaction. OnChain returns the transaction for the specified coin in hex format along with a list of hashes that need to be signed.

    Body parameter

    {
      "number_of_required_signatures": 1,
      "amount": 100000,
      "to": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX",
      "fee_amount": 100000,
      "fee_address": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX",
      "miners_fee": 40000,
      "redeem_scripts": {
        "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49"
      }
    }
    

    Parameters

    Parameter In Type Required Description
    coin path string true No description
    body body multi_sig_payment true No description
    » number_of_required_signatures body integer false No description
    » amount body integer false No description
    » to body string false No description
    » fee_amount body integer false No description
    » fee_address body string false No description
    » miners_fee body integer false No description
    » redeem_scripts body redeem_script false No description
    »» public_key body string false No description

    Example responses

    {
      "tx": "02000000011cd5d7621e2a7c9403e54e089cb0b5430b83ed13f1b897d3e319b100ba1b059b01000000db00483045022100d7534c80bc0a42addc3d955f74e31610aa78bf15d79ec4df4c36dc98e802f5200220369cab1bccb2dbca0921444ce3fafb15129fa0494d041998be104df39b8895ec01483045022100fe48c4c1d46e163acaff6b0d2e702812d20",
      "total_input_value": 500000,
      "hashes": [
        {
          "input_index": 0,
          "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49",
          "hash_to_sign": "004cfaf7cff86e7f171db23d67acd6c986273e578d7466e43e2b78913e1ce7c7"
        }
      ]
    }
    
    {
      "message": "Something went wrong."
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The unsigned transaction in hex format and a list of hashes that need signatures. hashes_to_sign
    default Default If an error occurs error_message

    Sign and Send a Transaction

    Code samples

    # You can also use wget
    curl -X POST https://onchain.io/api/multi_sig/sign_and_send/{coin} \
      -H 'Content-Type: application/json' \
      -H 'Accept: application/json' \
      -H 'X-API-KEY: API_KEY'
    
    
    POST https://onchain.io/api/multi_sig/sign_and_send/{coin} HTTP/1.1
    Host: onchain.io
    Content-Type: application/json
    Accept: application/json
    
    
    var headers = {
      'Content-Type':'application/json',
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/multi_sig/sign_and_send/{coin}',
      method: 'post',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    const inputBody = '{
      "tx": "string",
      "signatures": [
        {
          "hash_to_sign": "7a77eb8e0e9e56ca925473cbfaa215822b1bc73de40dc9098d66b2eb785af9db",
          "signature": "304402202915d9763c944918712155522ed99d1f01d7998c349316b5ba2d75ac41bb3dae022033b4d5800d2c5f461abf42a967625f77f4e16933bf9fa81aa753c423687eee02",
          "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49",
          "input_index": 0
        }
      ]
    }';
    const headers = {
      'Content-Type':'application/json',
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    fetch('https://onchain.io/api/multi_sig/sign_and_send/{coin}',
    {
      method: 'POST',
      body: inputBody,
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
    
    
    require 'rest-client'
    require 'json'
    
    headers = {
      'Content-Type' => 'application/json',
      'Accept' => 'application/json',
      'X-API-KEY' => 'API_KEY'
    }
    
    result = RestClient.post 'https://onchain.io/api/multi_sig/sign_and_send/{coin}',
      params: {
      }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'X-API-KEY': 'API_KEY'
    }
    
    r = requests.post('https://onchain.io/api/multi_sig/sign_and_send/{coin}', params={
    
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/multi_sig/sign_and_send/{coin}");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());
    
    
    package main
    
    import (
           "bytes"
           "net/http"
    )
    
    func main() {
    
        headers := map[string][]string{
            "Content-Type": []string{"application/json"},
            "Accept": []string{"application/json"},
            "X-API-KEY": []string{"API_KEY"},
    
        }
    
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("POST", "https://onchain.io/api/multi_sig/sign_and_send/{coin}", data)
        req.Header = headers
    
        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }
    
    

    POST /multi_sig/sign_and_send/{coin}

    Sign and send transaction onto the network.

    Body parameter

    {
      "tx": "string",
      "signatures": [
        {
          "hash_to_sign": "7a77eb8e0e9e56ca925473cbfaa215822b1bc73de40dc9098d66b2eb785af9db",
          "signature": "304402202915d9763c944918712155522ed99d1f01d7998c349316b5ba2d75ac41bb3dae022033b4d5800d2c5f461abf42a967625f77f4e16933bf9fa81aa753c423687eee02",
          "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49",
          "input_index": 0
        }
      ]
    }
    

    Parameters

    Parameter In Type Required Description
    coin path string true The name of the coin i.e. bitcoin
    body body signatures true No description
    » tx body string false No description
    » signatures body [signature] false No description
    »» hash_to_sign body string false No description
    »» signature body string false No description
    »» public_key body string false No description
    »» input_index body integer false No description

    Example responses

    {
      "status_code": 200,
      "message": "3bcf74e3421148db08daf6f5787a698534046bff54b2af1b8252b9166f8f4749"
    }
    
    {
      "message": "Something went wrong."
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Send a transaction onto the network. send_status
    default Default If an error occurs error_message

    Ethereum API

    Create Unsigned Transaction

    Code samples

    # You can also use wget
    curl -X POST https://onchain.io/api/ethereum/create/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000 \
      -H 'Accept: application/json' \
      -H 'X-API-KEY: API_KEY'
    
    
    POST https://onchain.io/api/ethereum/create/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000 HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/ethereum/create/',
      method: 'post',
      data: '?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000',
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    
    const headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    fetch('https://onchain.io/api/ethereum/create/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000',
    {
      method: 'POST',
    
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
    
    
    require 'rest-client'
    require 'json'
    
    headers = {
      'Accept' => 'application/json',
      'X-API-KEY' => 'API_KEY'
    }
    
    result = RestClient.post 'https://onchain.io/api/ethereum/create/',
      params: {
      'to' => 'string',
    'from' => 'string',
    'amount' => 'integer'
    }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json',
      'X-API-KEY': 'API_KEY'
    }
    
    r = requests.post('https://onchain.io/api/ethereum/create/', params={
      'to': '2.5329069089123447e+76',  'from': '2.5329069089123447e+76',  'amount': '80000'
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/ethereum/create/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());
    
    
    package main
    
    import (
           "bytes"
           "net/http"
    )
    
    func main() {
    
        headers := map[string][]string{
            "Accept": []string{"application/json"},
            "X-API-KEY": []string{"API_KEY"},
    
        }
    
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("POST", "https://onchain.io/api/ethereum/create/", data)
        req.Header = headers
    
        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }
    
    

    POST /ethereum/create/

    Create an unsigned transaction. OnChain returns the ethereum transaction in hex format along with a hash that would need to be signed.

    Parameters

    Parameter In Type Required Description
    to query string true The address to send Ether to.
    from query string true The addresses we are sending ether from.
    amount query integer true The amount we wish to send in GWEI.
    gas_price query integer false The gas price to pay.
    gas_limit query integer false The gas limit to use.

    Example responses

    {
      "tx": "02000000011cd5d7621e2a7c9403e54e089cb0b5430b83ed13f1b897d3e319b100ba1b059b01000000db00483045022100d7534c80bc0a42addc3d955f74e31610aa78bf15d79ec4df4c36dc98e802f5200220369cab1bccb2dbca0921444ce3fafb15129fa0494d041998be104df39b8895ec01483045022100fe48c4c1d46e163acaff6b0d2e702812d20",
      "hash_to_sign": "955f74e31610aa78bf15d79ec4df4c36dc98e802f52002"
    }
    
    {
      "message": "Something went wrong."
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The unsigned transaction in hex format and the hash to sign. ethereum_to_sign
    default Default If an error occurs error_message

    Sign and send transaction.

    Code samples

    # You can also use wget
    curl -X POST https://onchain.io/api/ethereum/sign_and_send/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&r=37ffbebc90cd580b516d99cc53050e93a6cd5f&s=37ffbebc90cd580b516d99cc53050e93a6cd5f&v=52 \
      -H 'Accept: application/json' \
      -H 'X-API-KEY: API_KEY'
    
    
    POST https://onchain.io/api/ethereum/sign_and_send/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&r=37ffbebc90cd580b516d99cc53050e93a6cd5f&s=37ffbebc90cd580b516d99cc53050e93a6cd5f&v=52 HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/ethereum/sign_and_send/',
      method: 'post',
      data: '?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&r=37ffbebc90cd580b516d99cc53050e93a6cd5f&s=37ffbebc90cd580b516d99cc53050e93a6cd5f&v=52',
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    
    const headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    fetch('https://onchain.io/api/ethereum/sign_and_send/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&r=37ffbebc90cd580b516d99cc53050e93a6cd5f&s=37ffbebc90cd580b516d99cc53050e93a6cd5f&v=52',
    {
      method: 'POST',
    
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
    
    
    require 'rest-client'
    require 'json'
    
    headers = {
      'Accept' => 'application/json',
      'X-API-KEY' => 'API_KEY'
    }
    
    result = RestClient.post 'https://onchain.io/api/ethereum/sign_and_send/',
      params: {
      'to' => 'string',
    'from' => 'string',
    'amount' => 'integer',
    'r' => 'string',
    's' => 'string',
    'v' => 'string'
    }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json',
      'X-API-KEY': 'API_KEY'
    }
    
    r = requests.post('https://onchain.io/api/ethereum/sign_and_send/', params={
      'to': '2.5329069089123447e+76',  'from': '2.5329069089123447e+76',  'amount': '80000',  'r': '37ffbebc90cd580b516d99cc53050e93a6cd5f',  's': '37ffbebc90cd580b516d99cc53050e93a6cd5f',  'v': '52'
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/ethereum/sign_and_send/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&r=37ffbebc90cd580b516d99cc53050e93a6cd5f&s=37ffbebc90cd580b516d99cc53050e93a6cd5f&v=52");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());
    
    
    package main
    
    import (
           "bytes"
           "net/http"
    )
    
    func main() {
    
        headers := map[string][]string{
            "Accept": []string{"application/json"},
            "X-API-KEY": []string{"API_KEY"},
    
        }
    
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("POST", "https://onchain.io/api/ethereum/sign_and_send/", data)
        req.Header = headers
    
        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }
    
    

    POST /ethereum/sign_and_send/

    Sign and send transaction onto the Ethereum network.

    Parameters

    Parameter In Type Required Description
    to query string true The address to send Ether to.
    from query string true The addresses we are sending ether from.
    amount query integer true The amount we wish to send in GWEI.
    r query string true The signed r value.
    s query string true The signed r value.
    v query string true The signed r value.
    gas_price query integer false The gas price to pay.
    gas_limit query integer false The gas limit to use.

    Example responses

    {
      "status_code": 200,
      "message": "3bcf74e3421148db08daf6f5787a698534046bff54b2af1b8252b9166f8f4749"
    }
    
    {
      "message": "Something went wrong."
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Send a transaction onto the network. send_status
    default Default If an error occurs error_message

    ERC20

    Create Unsigned Transaction

    Code samples

    # You can also use wget
    curl -X POST https://onchain.io/api/erc20/create/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&contract_id=6.058968844090876e%2B47&decimal_places=18 \
      -H 'Accept: application/json' \
      -H 'X-API-KEY: API_KEY'
    
    
    POST https://onchain.io/api/erc20/create/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&contract_id=6.058968844090876e%2B47&decimal_places=18 HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/erc20/create/',
      method: 'post',
      data: '?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&contract_id=6.058968844090876e%2B47&decimal_places=18',
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    
    const headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    fetch('https://onchain.io/api/erc20/create/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&contract_id=6.058968844090876e%2B47&decimal_places=18',
    {
      method: 'POST',
    
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
    
    
    require 'rest-client'
    require 'json'
    
    headers = {
      'Accept' => 'application/json',
      'X-API-KEY' => 'API_KEY'
    }
    
    result = RestClient.post 'https://onchain.io/api/erc20/create/',
      params: {
      'to' => 'string',
    'from' => 'string',
    'amount' => 'integer',
    'contract_id' => 'string',
    'decimal_places' => 'integer'
    }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json',
      'X-API-KEY': 'API_KEY'
    }
    
    r = requests.post('https://onchain.io/api/erc20/create/', params={
      'to': '2.5329069089123447e+76',  'from': '2.5329069089123447e+76',  'amount': '80000',  'contract_id': '6.058968844090876e+47',  'decimal_places': '18'
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/erc20/create/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&contract_id=6.058968844090876e%2B47&decimal_places=18");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());
    
    
    package main
    
    import (
           "bytes"
           "net/http"
    )
    
    func main() {
    
        headers := map[string][]string{
            "Accept": []string{"application/json"},
            "X-API-KEY": []string{"API_KEY"},
    
        }
    
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("POST", "https://onchain.io/api/erc20/create/", data)
        req.Header = headers
    
        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }
    
    

    POST /erc20/create/

    Create an unsigned transaction. OnChain returns the ethereum transaction in hex format along with a hash that would need to be signed.

    Parameters

    Parameter In Type Required Description
    to query string true The address to send Ether to.
    from query string true The addresses we are sending ether from.
    amount query integer true The amount we wish to send in GWEI.
    contract_id query string true The contract ID of the ERC20 token.
    decimal_places query integer true The number of decimal places for this contract.
    gas_price query integer false The gas price to pay.
    gas_limit query integer false The gas limit to use.

    Example responses

    {
      "tx": "02000000011cd5d7621e2a7c9403e54e089cb0b5430b83ed13f1b897d3e319b100ba1b059b01000000db00483045022100d7534c80bc0a42addc3d955f74e31610aa78bf15d79ec4df4c36dc98e802f5200220369cab1bccb2dbca0921444ce3fafb15129fa0494d041998be104df39b8895ec01483045022100fe48c4c1d46e163acaff6b0d2e702812d20",
      "hash_to_sign": "955f74e31610aa78bf15d79ec4df4c36dc98e802f52002"
    }
    
    {
      "message": "Something went wrong."
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The unsigned transaction in hex format and the hash to sign. ethereum_to_sign
    default Default If an error occurs error_message

    Sign and send transaction.

    Code samples

    # You can also use wget
    curl -X POST https://onchain.io/api/erc20/sign_and_send/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&contract_id=6.058968844090876e%2B47&decimal_places=18&r=37ffbebc90cd580b516d99cc53050e93a6cd5f&s=37ffbebc90cd580b516d99cc53050e93a6cd5f&v=52 \
      -H 'Accept: application/json' \
      -H 'X-API-KEY: API_KEY'
    
    
    POST https://onchain.io/api/erc20/sign_and_send/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&contract_id=6.058968844090876e%2B47&decimal_places=18&r=37ffbebc90cd580b516d99cc53050e93a6cd5f&s=37ffbebc90cd580b516d99cc53050e93a6cd5f&v=52 HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/erc20/sign_and_send/',
      method: 'post',
      data: '?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&contract_id=6.058968844090876e%2B47&decimal_places=18&r=37ffbebc90cd580b516d99cc53050e93a6cd5f&s=37ffbebc90cd580b516d99cc53050e93a6cd5f&v=52',
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    
    const headers = {
      'Accept':'application/json',
      'X-API-KEY':'API_KEY'
    
    };
    
    fetch('https://onchain.io/api/erc20/sign_and_send/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&contract_id=6.058968844090876e%2B47&decimal_places=18&r=37ffbebc90cd580b516d99cc53050e93a6cd5f&s=37ffbebc90cd580b516d99cc53050e93a6cd5f&v=52',
    {
      method: 'POST',
    
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
    
    
    require 'rest-client'
    require 'json'
    
    headers = {
      'Accept' => 'application/json',
      'X-API-KEY' => 'API_KEY'
    }
    
    result = RestClient.post 'https://onchain.io/api/erc20/sign_and_send/',
      params: {
      'to' => 'string',
    'from' => 'string',
    'amount' => 'integer',
    'contract_id' => 'string',
    'decimal_places' => 'integer',
    'r' => 'string',
    's' => 'string',
    'v' => 'string'
    }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json',
      'X-API-KEY': 'API_KEY'
    }
    
    r = requests.post('https://onchain.io/api/erc20/sign_and_send/', params={
      'to': '2.5329069089123447e+76',  'from': '2.5329069089123447e+76',  'amount': '80000',  'contract_id': '6.058968844090876e+47',  'decimal_places': '18',  'r': '37ffbebc90cd580b516d99cc53050e93a6cd5f',  's': '37ffbebc90cd580b516d99cc53050e93a6cd5f',  'v': '52'
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/erc20/sign_and_send/?to=2.5329069089123447e%2B76&from=2.5329069089123447e%2B76&amount=80000&contract_id=6.058968844090876e%2B47&decimal_places=18&r=37ffbebc90cd580b516d99cc53050e93a6cd5f&s=37ffbebc90cd580b516d99cc53050e93a6cd5f&v=52");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());
    
    
    package main
    
    import (
           "bytes"
           "net/http"
    )
    
    func main() {
    
        headers := map[string][]string{
            "Accept": []string{"application/json"},
            "X-API-KEY": []string{"API_KEY"},
    
        }
    
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("POST", "https://onchain.io/api/erc20/sign_and_send/", data)
        req.Header = headers
    
        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }
    
    

    POST /erc20/sign_and_send/

    Sign and send transaction onto the Ethereum network.

    Parameters

    Parameter In Type Required Description
    to query string true The address to send Ether to.
    from query string true The addresses we are sending ether from.
    amount query integer true The amount we wish to send in GWEI.
    contract_id query string true The contract ID of the ERC20 token.
    decimal_places query integer true The number of decimal places for this contract.
    r query string true The signed r value.
    s query string true The signed r value.
    v query string true The signed r value.
    gas_price query integer false The gas price to pay.
    gas_limit query integer false The gas limit to use.

    Example responses

    {
      "status_code": 200,
      "message": "3bcf74e3421148db08daf6f5787a698534046bff54b2af1b8252b9166f8f4749"
    }
    
    {
      "message": "Something went wrong."
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Send a transaction onto the network. send_status
    default Default If an error occurs error_message

    Schemas

    coin

    "bitcoin"
    

    Properties

    None

    balance

    {
      "usd_balance": 120.34,
      "balance": 27018060,
      "unconfirmed_balance": 27018060,
      "human_balance": 0.2701806,
      "human_unconfirmed_balance": 0.2701806
    }
    

    Properties

    Name Type Required Description
    usd_balance number false No description
    balance integer false No description
    unconfirmed_balance integer false No description
    human_balance number false No description
    human_unconfirmed_balance number false No description

    addr_balance

    {
      "address": "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY",
      "usd_balance": 120.34,
      "balance": 27018060,
      "unconfirmed_balance": 27018060,
      "human_balance": 0.2701806,
      "human_unconfirmed_balance": 0.2701806
    }
    

    Properties

    Name Type Required Description
    address string false No description
    usd_balance integer false No description
    balance integer false No description
    unconfirmed_balance integer false No description
    human_balance number false No description
    human_unconfirmed_balance number false No description

    balances

    {
      "totals": {
        "usd_balance": 120.34,
        "balance": 27018060,
        "unconfirmed_balance": 27018060,
        "human_balance": 0.2701806,
        "human_unconfirmed_balance": 0.2701806
      },
      "addresses": [
        {
          "address": "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY",
          "usd_balance": 120.34,
          "balance": 27018060,
          "unconfirmed_balance": 27018060,
          "human_balance": 0.2701806,
          "human_unconfirmed_balance": 0.2701806
        }
      ]
    }
    

    Properties

    Name Type Required Description
    totals balance false No description
    addresses [addr_balance] false No description

    tx

    {
      "confirmations": 3,
      "time": 1524579200,
      "is_deposit": true,
      "address": "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY",
      "amount": 27018060,
      "human_amount": 0.2701806
    }
    

    Properties

    Name Type Required Description
    confirmations integer false No description
    time integer false No description
    is_deposit boolean false No description
    address string false No description
    amount integer false No description
    human_amount number false No description

    utxo

    {
      "amount": 395260,
      "vout": 1,
      "txid": "9bd89c6555d42a2e0922f32f9227440def71ffc4e03ac6eda4c79ebbc0ceed1f",
      "script_pub_key": "76a91404d075b3f501deeef5565143282b6cfe8fad5e9488ac"
    }
    

    Properties

    Name Type Required Description
    amount integer false No description
    vout integer false No description
    txid string false No description
    script_pub_key string false No description

    history

    {
      "total_txs": 37000,
      "txs": [
        {
          "confirmations": 3,
          "time": 1524579200,
          "is_deposit": true,
          "address": "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY",
          "amount": 27018060,
          "human_amount": 0.2701806
        }
      ]
    }
    

    Properties

    Name Type Required Description
    total_txs integer false No description
    txs [tx] false No description

    hashes_to_sign

    {
      "tx": "02000000011cd5d7621e2a7c9403e54e089cb0b5430b83ed13f1b897d3e319b100ba1b059b01000000db00483045022100d7534c80bc0a42addc3d955f74e31610aa78bf15d79ec4df4c36dc98e802f5200220369cab1bccb2dbca0921444ce3fafb15129fa0494d041998be104df39b8895ec01483045022100fe48c4c1d46e163acaff6b0d2e702812d20",
      "total_input_value": 500000,
      "hashes": [
        {
          "input_index": 0,
          "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49",
          "hash_to_sign": "004cfaf7cff86e7f171db23d67acd6c986273e578d7466e43e2b78913e1ce7c7"
        }
      ]
    }
    

    Properties

    Name Type Required Description
    tx string false No description
    total_input_value integer false No description
    hashes [hash_to_sign] false No description

    ethereum_to_sign

    {
      "tx": "02000000011cd5d7621e2a7c9403e54e089cb0b5430b83ed13f1b897d3e319b100ba1b059b01000000db00483045022100d7534c80bc0a42addc3d955f74e31610aa78bf15d79ec4df4c36dc98e802f5200220369cab1bccb2dbca0921444ce3fafb15129fa0494d041998be104df39b8895ec01483045022100fe48c4c1d46e163acaff6b0d2e702812d20",
      "hash_to_sign": "955f74e31610aa78bf15d79ec4df4c36dc98e802f52002"
    }
    

    Properties

    Name Type Required Description
    tx string false No description
    hash_to_sign string false No description

    hash_to_sign

    {
      "input_index": 0,
      "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49",
      "hash_to_sign": "004cfaf7cff86e7f171db23d67acd6c986273e578d7466e43e2b78913e1ce7c7"
    }
    

    Properties

    Name Type Required Description
    input_index integer false No description
    public_key string false No description
    hash_to_sign string false No description

    signatures

    {
      "tx": "string",
      "signatures": [
        {
          "hash_to_sign": "7a77eb8e0e9e56ca925473cbfaa215822b1bc73de40dc9098d66b2eb785af9db",
          "signature": "304402202915d9763c944918712155522ed99d1f01d7998c349316b5ba2d75ac41bb3dae022033b4d5800d2c5f461abf42a967625f77f4e16933bf9fa81aa753c423687eee02",
          "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49",
          "input_index": 0
        }
      ]
    }
    

    Properties

    Name Type Required Description
    tx string false No description
    signatures [signature] false No description

    signature

    {
      "hash_to_sign": "7a77eb8e0e9e56ca925473cbfaa215822b1bc73de40dc9098d66b2eb785af9db",
      "signature": "304402202915d9763c944918712155522ed99d1f01d7998c349316b5ba2d75ac41bb3dae022033b4d5800d2c5f461abf42a967625f77f4e16933bf9fa81aa753c423687eee02",
      "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49",
      "input_index": 0
    }
    

    Properties

    Name Type Required Description
    hash_to_sign string false No description
    signature string false No description
    public_key string false No description
    input_index integer false No description

    redeem_script

    {
      "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49"
    }
    

    Properties

    Name Type Required Description
    public_key string false No description

    multi_sig_payment

    {
      "number_of_required_signatures": 1,
      "amount": 100000,
      "to": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX",
      "fee_amount": 100000,
      "fee_address": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX",
      "miners_fee": 40000,
      "redeem_scripts": {
        "public_key": "036f3972643ab052f9f77cbaf67f0e517180ac488453bde8cb27e9e3e1d6847d49"
      }
    }
    

    Properties

    Name Type Required Description
    number_of_required_signatures integer false No description
    amount integer false No description
    to string false No description
    fee_amount integer false No description
    fee_address string false No description
    miners_fee integer false No description
    redeem_scripts redeem_script false No description

    send_status

    {
      "status_code": 200,
      "message": "3bcf74e3421148db08daf6f5787a698534046bff54b2af1b8252b9166f8f4749"
    }
    

    Properties

    Name Type Required Description
    status_code integer false No description
    message string false No description

    error_message

    {
      "message": "Something went wrong."
    }
    

    Properties

    Name Type Required Description
    message string false No description