Skip to main content

REST API Quick Start

See below how you can start fetching data from the Mirror Nodes through our Service REST API.

info

You will need:

  • Arkhia's Service URL
  • Arkhia's API Key

Both of these can be retrieved from the Arkhia Dashboard after you Create a Project.

Don't have an account yet with Arkhia? Signup.

Basic Rest calls

    // Make sure you have Axios (https://www.npmjs.com/package/axios) installedconst axios = require('axios');// These 2 variables are taken from your Arkhia account. Sign up @ (https://auth.arkhia.io/signup)const baseUrl = `<ARKHIA_REST_API_URL_HERE>`;const headerKey = `<ARKHIA_API_KEY_HERE>`;// header config to work with Arkhiaconst config = {  method: 'get',  url: baseUrl,  headers: {    'x-api-key': headerKey  }};// Replace with the data you need to access from the mirror nodeconst standardApiRequests = {  transactions: `transactions`,  contracts: `contracts`,  tokens: `tokens`,  accounts: `accounts`,  balances: `balances`,  blocks: `blocks`,  schedules: `schedules`,  tokens: `tokens`,};const getMirrorNodeRestData = async (apiRequest) => {  config.url = `${baseUrl}/${apiRequest}`;  await axios(config)    .then(function (response) {      if (!response.data) {        console.error(`Something went wrong`);        return;      }      console.info(response.data);      console.info(`Retrieved ${response.data[apiRequest].length} results`);    })    .catch(function (error) {      console.log(error);  });}getMirrorNodeRestData(standardApiRequests.tokens);process.on('uncaughtException', (error) => {  console.log(error)});process.on('unhandledRejection', (error) => {  console.log(error)});