NAV Navbar
Shell HTTP JavaScript Node.JS Ruby Python Java Go
  • ONCHAIN.IO API overview v2
  • Authentication
  • Address API
  • Transaction API
  • 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'
    
    
    GET https://onchain.io/api/address/balance/{coin}/{address} HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json'
    
    };
    
    $.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'
    
    };
    
    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'
    }
    
    result = RestClient.get 'https://onchain.io/api/address/balance/{coin}/{address}',
      params: {
      }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json'
    }
    
    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"},
    
        }
    
        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

    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

    Example responses

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

    Responses

    Status Meaning Description Schema
    200 OK Returns the balances balance

    Get Balances

    Code samples

    # You can also use wget
    curl -X GET https://onchain.io/api/address/balances/{coin}/{addresses} \
      -H 'Accept: application/json'
    
    
    GET https://onchain.io/api/address/balances/{coin}/{addresses} HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json'
    
    };
    
    $.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'
    
    };
    
    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'
    }
    
    result = RestClient.get 'https://onchain.io/api/address/balances/{coin}/{addresses}',
      params: {
      }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json'
    }
    
    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"},
    
        }
    
        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

    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
    200 OK 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'
    
    
    GET https://onchain.io/api/address/history/{coin}/{addresses} HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json'
    
    };
    
    $.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'
    
    };
    
    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'
    }
    
    result = RestClient.get 'https://onchain.io/api/address/history/{coin}/{addresses}',
      params: {
      }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json'
    }
    
    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"},
    
        }
    
        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

    Example responses

    {
      "total_txs": 37000,
      "txs": [
        {
          "blockheight": 48138,
          "time": 1524579200,
          "total_out": 1,
          "total_in": 1,
          "fees": 40000,
          "vins": [
            {
              "amount": 395260,
              "address": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX"
            }
          ],
          "vouts": [
            {
              "amount": 395260,
              "address": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX"
            }
          ]
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Returns the transaction history for an address or addresses history

    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'
    
    
    GET https://onchain.io/api/address/utxo/{coin}/{addresses} HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json'
    
    };
    
    $.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'
    
    };
    
    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'
    }
    
    result = RestClient.get 'https://onchain.io/api/address/utxo/{coin}/{addresses}',
      params: {
      }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json'
    }
    
    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"},
    
        }
    
        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"
      }
    ]
    

    Responses

    Status Meaning Description Schema
    200 OK Returns the unspent outputs for an address or addresses Inline

    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'
    
    
    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'
    
    };
    
    $.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'
    
    };
    
    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'
    }
    
    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'
    }
    
    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"},
    
        }
    
        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 string false The amount of fees to send.
    miners_fee query integer false The amount to send to the miners.

    Example responses

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

    Responses

    Status Meaning Description Schema
    200 OK The unsigned transaction in hex format and a list of hashes that need signatures. hashes_to_sign

    Sign and Send a Transaction

    Code samples

    # You can also use wget
    curl -X POST https://onchain.io/api/transaction/sign_and_send/{coin}?tx=string&public_keys=string&signatures=string&hashes_to_sign=string&input_indexes=0 \
      -H 'Accept: application/json'
    
    
    POST https://onchain.io/api/transaction/sign_and_send/{coin}?tx=string&public_keys=string&signatures=string&hashes_to_sign=string&input_indexes=0 HTTP/1.1
    Host: onchain.io
    
    Accept: application/json
    
    
    var headers = {
      'Accept':'application/json'
    
    };
    
    $.ajax({
      url: 'https://onchain.io/api/transaction/sign_and_send/{coin}',
      method: 'post',
      data: '?tx=string&public_keys=string&signatures=string&hashes_to_sign=string&input_indexes=0',
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    const request = require('node-fetch');
    
    const headers = {
      'Accept':'application/json'
    
    };
    
    fetch('https://onchain.io/api/transaction/sign_and_send/{coin}?tx=string&public_keys=string&signatures=string&hashes_to_sign=string&input_indexes=0',
    {
      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'
    }
    
    result = RestClient.post 'https://onchain.io/api/transaction/sign_and_send/{coin}',
      params: {
      'tx' => 'string',
    'public_keys' => 'array[string]',
    'signatures' => 'array[string]',
    'hashes_to_sign' => 'array[string]',
    'input_indexes' => 'array[integer]'
    }, headers: headers
    
    p JSON.parse(result)
    
    
    import requests
    headers = {
      'Accept': 'application/json'
    }
    
    r = requests.post('https://onchain.io/api/transaction/sign_and_send/{coin}', params={
      'tx': 'string',  'public_keys': [
      "string"
    ],  'signatures': [
      "string"
    ],  'hashes_to_sign': [
      "string"
    ],  'input_indexes': [
      0
    ]
    }, headers = headers)
    
    print r.json()
    
    
    URL obj = new URL("https://onchain.io/api/transaction/sign_and_send/{coin}?tx=string&public_keys=string&signatures=string&hashes_to_sign=string&input_indexes=0");
    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"},
    
        }
    
        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.

    Parameters

    Parameter In Type Required Description
    coin path string true The name of the coin i.e. bitcoin
    tx query string true The raw unsigned transaction as a hex string
    public_keys query array[string] true The list of public keys we are signing for.
    signatures query array[string] true The signatures generated for each.
    hashes_to_sign query array[string] true The list of hashes returned by the create API with the corresponding signatures from your private keys.
    input_indexes query array[integer] true The list of input indexes corresponding to the hashes and signatures.

    Example responses

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

    Responses

    Status Meaning Description Schema
    default Default Send a transaction onto the network. Inline

    Response Schema

    Status Code default

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

    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'
    
    
    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'
    
    };
    
    $.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'
    
    };
    
    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'
    }
    
    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'
    }
    
    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"},
    
        }
    
        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"
    }
    

    Responses

    Status Meaning Description Schema
    default Default Send a transaction onto the network. Inline

    Response Schema

    Status Code default

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

    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 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

    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

    vins

    {
      "amount": 395260,
      "address": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX"
    }
    

    Properties

    Name Type Required Description
    amount integer false No description
    address string false No description

    vouts

    {
      "amount": 395260,
      "address": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX"
    }
    

    Properties

    Name Type Required Description
    amount integer false No description
    address string false No description

    tx

    {
      "blockheight": 48138,
      "time": 1524579200,
      "total_out": 1,
      "total_in": 1,
      "fees": 40000,
      "vins": [
        {
          "amount": 395260,
          "address": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX"
        }
      ],
      "vouts": [
        {
          "amount": 395260,
          "address": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX"
        }
      ]
    }
    

    Properties

    Name Type Required Description
    blockheight integer false No description
    time integer false No description
    total_out integer false No description
    total_in integer false No description
    fees integer false No description
    vins [vins] false No description
    vouts [vouts] 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": [
        {
          "blockheight": 48138,
          "time": 1524579200,
          "total_out": 1,
          "total_in": 1,
          "fees": 40000,
          "vins": [
            {
              "amount": 395260,
              "address": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX"
            }
          ],
          "vouts": [
            {
              "amount": 395260,
              "address": "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX"
            }
          ]
        }
      ]
    }
    

    Properties

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

    hashes_to_sign

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

    Properties

    Name Type Required Description
    tx string false No description
    hashes [hash_to_sign] 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

    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