# Allnodes API

Welcome to Allnodes API documentation, where you can access the right information for building on our API.

Our **RESTful API** allows you to perform actions available in the Allnodes portfolio programmatically. Currently, this **API** allows you to host and remove **Dash**, **Firo, Syscoin** nodes. Additional currencies and functions will become available in nearest future.

## Authentication

To make an authenticated request, include a bearer-type **Authorization** header containing your **TOKEN**. All requests must be made over **HTTPS**.

```bash
curl -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d '{...}' \
    -X POST "https://www.allnodes.com/api/v1/node"
```


# Account

## Get account balance

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/account/balance`

This endpoint returns the total and currently available account balances in USD.

The available balance excludes funds reserved for upcoming charges.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  totalBalance: number;
  availableBalance: number;
  balanceRunsOutAt: string | null;
}
```

{% endtab %}
{% endtabs %}

## Get all invoices

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/account/invoices`

This endpoint returns all invoices issued for your account.

Invoices are returned from newest to oldest. The invoice amount is represented as a positive USD value.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  invoices: [
    {
      id: number;
      name: string;
      amountUSD: number;
      timestamp: string;
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Get an invoice as CSV

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/account/invoices/:id/csv`

This endpoint returns the specified invoice in CSV format.

#### Path Parameters

| Name                                 | Type   | Description                                            |
| ------------------------------------ | ------ | ------------------------------------------------------ |
| id<mark style="color:red;">\*</mark> | number | Invoice ID returned by the "Get all invoices" endpoint |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```javascript
Invoice Number,Category,Name,Description,Start,End,Duration,Amount (USD)
260812345,Advanced plan charges,Validator 1,0x1234...,01.08.2026 00:00,01.09.2026 00:00,744 hours,25.00
260812345,Total,-,-,-,-,-,25.00
```

{% endtab %}
{% endtabs %}


# Bare-Metal Server

## Get all servers

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/server`

This endpoint allows to get list of all your servers.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  servers: [
    {
      id: number;
      alias: string;
      hostname: string | null;
      servername: string;
      platform: 'epyc' | 'threadripper' | 'ryzen' | 'core';
      cpu: {
        name: string;
        cores: number;
        threads: number;
        baseClockMhz: number;
        boostClockMhz: number;
        type: 'SINGLE' | 'DUAL';
      }
      gpu: {
        name: string;
        vramSizeGb: number;
        gddrVersion: 'GDDR6' | 'GDDR6X' | 'GDDR7';
        vendor: 'nvidia' | 'amd';
        count: number;
      } | null; 
      motherboard: {
        name: string;
        dimmCount: number;
      }
      ram: {
        ddrVersion: 'DDR4' | 'DDR5';
        totalSizeGb: number;
        stickSizeGb: number;
        stickCount: number;
        speedMts: number;
        isECC: boolean;
      }
      ssd: [
        {
          pcieVersion: '4.0' | '5.0';
          sizeGb: number;
          name: string;
          slotType: 'M2' | 'U2'; 
          count: number;
        }
      ]
      securityModules: [
        [
          {
            id: number;
            type: 'TPM_MODULE';
            manufacturer: string;
            name: string;
            model: string;
            platforms: string[];
          },
          number // count
        ]
      ]
      connectivity: {
        speedGbit: number;
      }
      traffic: {
        amountTb: number;
      }
      ipAddresses: string[];
      psu: 'SINGLE' | 'DUAL';
      powerStatus: string | null;
      ipmi: boolean;
      os: {
        name: string;
        version: string | null;
      }
      bios: {
        model: string;
        value: string;
        serial: string;
      } | null;
      location: {
        country: string;
        city: string;
      }
      datacenter: {
        id: string;
        name: string;
      }
      priceMonthlyUSD: number;
      priceHourlyUSD: number;
      currentChargesUSD: number;
      prepaidTill: string | null;
      createdAt: string;
      // Timestamp when the server was assigned to the account and marked as delivered.
      // Does not indicate OS installation completion or SSH availability.
      readyAt: string | null;
    } 
  ]  
}
```

{% endtab %}
{% endtabs %}

## Get all available Instant servers

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/server/hosting/instant`

This endpoint allows to get list of all available to host Instant servers.

This endpoint returns live inventory. Each `id` identifies a specific currently available physical server, not a reusable hardware configuration. Once a server is ordered, it is removed from the list. Do not cache or hard-code these IDs; fetch the latest inventory shortly before placing an order.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  instantServers: [
    {
      id: number;
      platform: 'epyc' | 'threadripper' | 'ryzen' | 'core';
      cpu: {
        name: string;
        cores: number;
        threads: number;
        baseClockMhz: number;
        boostClockMhz: number;
        type: 'SINGLE' | 'DUAL';
      }
      gpu: {
        name: string;
        vramSizeGb: number;
        gddrVersion: string;
        vendor: string;
        count: number;
      } | null;
      motherboard: {
        name: string;
        dimmCount: number;
      }
      ram: {
        ddrVersion: 'DDR4' | 'DDR5';
        totalSizeGb: number;
        stickSizeGb: number;
        stickCount: number;
        speedMts: number;
        isECC: boolean;
      }
      ssd: [
        {
          pcieVersion: '4.0' | '5.0';
          sizeGb: number;
          name: string;
          slotType: 'M2' | 'U2'; 
          count: number;
        }
      ]
      securityModules: [
        {
          manufacturer: string;
          name: string;
          model: string;
          count: number;
        }
      ]
      connectivity: {
        speedGbit: number;
      }
      traffic: {
        amountTb: number;
      }
      psu: 'SINGLE' | 'DUAL';
      location: {
        country: string;
        city: string;
      }
      pricing: {
        onDemand?: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
        oneMonth: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
        threeMonths: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
        sixMonths: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
        oneYear: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
      }
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Get all available Instant server upgrades

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/server/hosting/instant/upgrades`

This endpoint allows to get list of all available upgrades for Instant server.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  upgrades: {
    solanaPackage: {
      name: "Solana Package"
      additionalTrafficTb: number;
      pricing: {
        onDemand?: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
        oneMonth: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
        threeMonths: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
        sixMonths: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
        oneYear: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
      }
    } | null;
    additionalIp: {
      maxAdditionalIps: number;
      pricing: {
        onDemand?: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
        oneMonth: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
        threeMonths: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
        sixMonths: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
        oneYear: {
          priceMonthlyUSD: number;
          priceHourlyUSD: number;
          discountPercent: number;
        }
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}

## Get all available Instant server installation profiles

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/server/hosting/instant/:id/profiles`

This endpoint allows to get list of all available installation profiles (OS) for Instant server.

#### Path Parameters

| Name                                 | Type   | Description                                                           |
| ------------------------------------ | ------ | --------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | ID can be extracted from the “Get all available Instant servers” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  profiles: [
    {
      id: number;
      name: string;
      version: string;
      allowSshKeys: boolean;
      allowSetHostname: boolean;
      allowSetRootPassword: boolean;
      diskLayouts: [
        {
          id: number;
          name: string;
        }
      ]
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Get OS installation status

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/server/:id/os-installation-status`

Returns the current operating system installation status for a server.

Use this endpoint after ordering an instant server to determine when the operating system installation has completed. The readyAt field returned by the server endpoints indicates when the server order was provisioned, not when the operating system became available.

Possible status values:

* pending – the installation has not started yet or is not currently reported as running or completed.
* installing – the operating system installation is in progress.
* completed – the operating system installation has completed.

Poll this endpoint until status becomes completed. After the installation completes, the server automatically reboots and requires additional time before it is ready to accept SSH connections.

#### Path Parameters

| Name                                 | Type   | Description                                                                                                                                                                                                                                                                              |
| ------------------------------------ | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | ID of the server whose OS installation status to retrieve. Use the `id` field of the corresponding server returned by the “Get all servers” endpoint (`servers[].id`). For a newly created server, the same ID is returned as `serverOrder.id` by the “Host an Instant server” endpoint. |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  status: 'pending' | 'installing' | 'completed';
}
```

{% endtab %}
{% endtabs %}

## Host an Instant server

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/server/hosting/instant`

This endpoint allows to host an Instant server.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

**Body**

| Name                           | Type          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |                      |                    |                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ------------------------------ | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `instantServerId`              | number        | ID of a specific physical server from the latest “Get all available Instant servers” response (`instantServers[].id`). Availability is not guaranteed until the order has been successfully created.                                                                                                                                                                                                                                                                                                                                                                  |                      |                    |                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `prepaidType`                  | <p>"onDemand" | </p><p>"oneMonth"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | </p><p>"threeMonths" | </p><p>"sixMonths" | </p><p>"oneYear"</p> | <p>Defines the prepaid billing period for the server.<br><br>This value represents the <strong>initial payment option</strong>:<br><br><code>onDemand</code> — no upfront payment. Usage is billed by UTC calendar hour, and each started hour is charged in full. Partial hours are not prorated.<br>For example, using a server from <code>12:50 UTC</code> to <code>13:10 UTC</code> results in two billable hours.<br><br><code>oneMonth</code>, <code>threeMonths</code>, <code>sixMonths</code>, <code>oneYear</code> — prepaid plans with a fixed monthly price and discounts depending on the selected period</p> |
| `instantServerPriceMonthlyUSD` | number        | The monthly price in USD that **must exactly match** the `priceMonthlyUSD` value from the selected `prepaidType` in the "Get all available Instant servers" API                                                                                                                                                                                                                                                                                                                                                                                                       |                      |                    |                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `solanaPackage`                | boolean       | <p>Whether to enable the <strong>Solana Package Traffic Upgrade</strong> for this server.<br></p><ul><li><code>true</code> — Solana traffic package will be added.</li><li><code>false</code> — no Solana traffic upgrade</li></ul>                                                                                                                                                                                                                                                                                                                                   |                      |                    |                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `additionalIpCount`            | number        | <p>Number of additional IPv4 addresses to attach to the server.<br></p><ul><li>The server includes <strong>1 IPv4 address by default</strong>.</li><li>You can request up to <strong>11 additional IPv4 addresses</strong>.</li><li>Maximum total IPv4 addresses per server: <strong>12</strong></li></ul>                                                                                                                                                                                                                                                            |                      |                    |                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `osInstallation`               | object        | Configuration object describing the operating system and installation parameters that will be automatically installed on the server                                                                                                                                                                                                                                                                                                                                                                                                                                   |                      |                    |                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `osInstallation.profileId`     | number        | <p>ID of the operating system installation profile.</p><p>You can obtain this value from the "Get all available Instant server installation profiles" API</p>                                                                                                                                                                                                                                                                                                                                                                                                         |                      |                    |                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `osInstallation.hostname`      | string        | <p>Hostname to be set on the server during OS installation.</p><p><br>This field is <strong>required only if</strong> the selected installation profile has <code>allowSetHostname = true</code><br><br>If the profile does not allow setting a hostname, this field must be omitted</p>                                                                                                                                                                                                                                                                              |                      |                    |                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `osInstallation.rootPassword`  | string        | <p>Root user password for the operating system.<br></p><p>This field is <strong>required only if</strong> the selected installation profile has <code>allowSetRootPassword = true</code><br><br><br>If the profile does not allow setting a root password, this field must be omitted<br><br>The password must be between 8 and 63 characters long. It may contain uppercase and lowercase Latin letters (<code>A-Z</code>, <code>a-z</code>), digits (<code>0-9</code>), and the following special characters: <code>! @ # $ % ^ & \* \_ + - = . , : ; ?</code>.</p> |                      |                    |                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `osInstallation.diskLayoutId`  | number        | <p>ID of the disk layout to use during OS installation.<br><br>Available disk layout IDs can be obtained from the <code>diskLayouts</code> list of the selected installation profile</p>                                                                                                                                                                                                                                                                                                                                                                              |                      |                    |                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `osInstallation.sshKeyIds`     | number\[]     | <p>List of SSH key IDs that will be added to the server during OS installation.<br><br></p><ul><li>SSH key IDs can be obtained from the "Get all SSH Keys" API.</li><li>This field must be provided <strong>only if</strong> the selected installation profile has <code>allowSshKeys = true</code>.</li><li>If SSH keys are not allowed by the profile, this field must be omitted</li></ul>                                                                                                                                                                         |                      |                    |                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

{% tabs %}
{% tab title="201: OK " %}

```javascript
{
  serverOrder: {
    id: number;
    alias: string;
    hostname: string | null;
    servername: string;
    platform: 'epyc' | 'threadripper' | 'ryzen' | 'core';
    cpu: {
      name: string;
      cores: number;
      threads: number;
      baseClockMhz: number;
      boostClockMhz: number;
      type: 'SINGLE' | 'DUAL';
    }
    gpu: {
      name: string;
      vramSizeGb: number;
      gddrVersion: 'GDDR6' | 'GDDR6X' | 'GDDR7';
      vendor: 'nvidia' | 'amd';
      count: number;
    } | null; 
    motherboard: {
      name: string;
      dimmCount: number;
    }
    ram: {
      ddrVersion: 'DDR4' | 'DDR5';
      totalSizeGb: number;
      stickSizeGb: number;
      stickCount: number;
      speedMts: number;
      isECC: boolean;
    }
    ssd: [
      {
        pcieVersion: '4.0' | '5.0';
        sizeGb: number;
        name: string;
        slotType: 'M2' | 'U2'; 
        count: number;
      }
    ]
    securityModules: [
      [
        {
          id: number;
          type: 'TPM_MODULE';
          manufacturer: string;
          name: string;
          model: string;
          platforms: string[];
        },
        number // count
      ]
    ]
    connectivity: {
      speedGbit: number;
    }
    traffic: {
      amountTb: number;
    }
    ipAddresses: string[];
    psu: 'SINGLE' | 'DUAL';
    powerStatus: string | null;
    ipmi: boolean;
    os: {
      name: string;
      version: string | null;
    }
    bios: {
      model: string;
      value: string;
      serial: string;
    } | null;
    location: {
      country: string;
      city: string;
    }
    datacenter: {
      id: string;
      name: string;
    }
    priceMonthlyUSD: number;
    priceHourlyUSD: number;
    currentChargesUSD: number;
    prepaidTill: string | null;
    createdAt: string;
    // Timestamp when the server was assigned to the account and marked as delivered.
    // Does not indicate OS installation completion or SSH availability.
    readyAt: string | null;
  }
}
```

{% endtab %}

{% tab title="403: Forbidden" %}

```
{
  error: "NOT_REGISTERED";
  description?: string;
}
```

{% endtab %}
{% endtabs %}

## Remove a server

<mark style="color:red;">`DELETE`</mark> `https://www.allnodes.com/api/v1/server/:id`

This endpoint allows you to remove a Bare-Metal server from your account.

#### Path Parameters

| Name                                 | Type   | Description                                                                                                                                                                                                                                               |
| ------------------------------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | ID of the server to remove. Use the `id` field of the corresponding server returned by the “Get all servers” endpoint (`servers[].id`). For a newly created server, the same ID is returned as `serverOrder.id` by the “Host an Instant server” endpoint. |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="204: Server successfully removed " %}

{% endtab %}

{% tab title="404: Not Found" %}

```
{
  "error": "SERVER_NOT_FOUND"
}
```

{% endtab %}
{% endtabs %}


# SSH Key

## Get all SSH Keys

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/ssh-key`

This endpoint allows to get list of all your ssh keys.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  sshKeys: [
    {
      id: number;
      alias: string;
      publicKey: string;
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Add a new SSH Key

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/ssh-key`

This endpoint allows to add a new ssh key.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

**Body**

| Name        | Type   | Description           |
| ----------- | ------ | --------------------- |
| `alias`     | string | Alias of your SSH Key |
| `publicKey` | string | SSH Public Key        |

{% tabs %}
{% tab title="201: OK " %}

```javascript
{
  sshKey: {
    id: number;
    alias: string;
    publicKey: string;
  }
}
```

{% endtab %}

{% tab title="403: Forbidden" %}

```
{
  error: "NOT_REGISTERED";
  description?: string;
}
```

{% endtab %}
{% endtabs %}

## Remove a SSH Key

<mark style="color:red;">`DELETE`</mark> `https://www.allnodes.com/api/v1/ssh-key/{id}`

This endpoint allows you to remove a ssh key.

#### Path Parameters

| Name                                 | Type   | Description                                                                      |
| ------------------------------------ | ------ | -------------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | SSH Key you want to remove. ID can be extracted from the “Get all SSH Keys” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="204: No Content " %}

{% endtab %}

{% tab title="403: Forbidden" %}

```
{
  error: "NOT_REGISTERED";
  description?: string;
}
```

{% endtab %}
{% endtabs %}


# Validator

## Get all validators

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node`

This endpoint allows to get list of all your hosted validators.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
[
  {
    id: string;
    ip: string;
    name: string;
    currencySymbol: string;
    createdAt: string;
    payoutFrequencySeconds: number | null;
    apr: string | null;
    instance: {
      version: string;
      status: string;
      uptimeSeconds: number | null;
      lastSeenAt: string | null;
    };
    address: {
      collateralAddress: string;
      collateralHash: string;
      collateralIndex: number;
      payeeAddress: string;
      balanceAmount: number;
      rewardsEarned: number;
      lastRewardAt: string | null;
    };
    settings: {
      walletType: 'ledger' | 'trezor' | 'core' | null;
    };
  }
]
```

{% endtab %}
{% endtabs %}

## Get a validator

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/{id}`

This endpoint allows to get info about specific validator on your account.

#### Path Parameters

| Name                                 | Type   | Description                                                                                  |
| ------------------------------------ | ------ | -------------------------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | Validator you want to get info about. ID can be extracted from the “Get all validators” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```typescript
{
  id: string;
  ip: string;
  name: string;
  currencySymbol: string;
  createdAt: string;
  payoutFrequencySeconds: number | null;
  apr: string | null;
  instance: {
    version: string;
    status: string;
    uptimeSeconds: number | null;
    lastSeenAt: string | null;
  };
  address: {
    collateralAddress: string;
    collateralHash: string;
    collateralIndex: number;
    payeeAddress: string;
    balanceAmount: number;
    rewardsEarned: number;
    lastRewardAt: string | null;
  };
  settings: {
    walletType: 'ledger' | 'trezor' | 'core' | null;
  };
}
```

{% endtab %}

{% tab title="404 Validator not found" %}

```javascript
{
  "error": "NODE_NOT_FOUND"
}
```

{% endtab %}
{% endtabs %}

## Remove a validator

<mark style="color:red;">`DELETE`</mark> `https://www.allnodes.com/api/v1/node/{id}`

This endpoint allows you to remove validator from hosting.

#### Path Parameters

| Name                                 | Type   | Description                                                                          |
| ------------------------------------ | ------ | ------------------------------------------------------------------------------------ |
| id<mark style="color:red;">\*</mark> | string | Validator you want to remove. ID can be extracted from the “Get all validators” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="204 Validator successfully removed" %}

```
```

{% endtab %}

{% tab title="404 Example of error response" %}

```javascript
{
  "error": "NODE_NOT_FOUND"
}
```

{% endtab %}
{% endtabs %}


# Staking

## Get all delegations

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows to get list of all your delegations.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
[
  {
    id: number;
    name: string;
    currencySymbol: string;
    createdAt: string;
    apr: string | null;
    payoutFrequencySeconds: number | null;
    address: {
      ownerAddress?: string;
      stakingAddress?: string;
      lastRewardAt: string | null;
    };
    delegations: [{
      validatorId: string;
      validatorName: string;
      delegationAmount: number;
      rewardAmount: number;
    }];
    undelegations: [{
      validatorId: string;
      validatorName: string;
      amount: number;
    }];
    settings: {
      wallet: string;
    };
  }
]
```

{% endtab %}
{% endtabs %}

## Get a delegation

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/staking/{id}`

This endpoint allows to get info about specific delegation on your account.

#### Path Parameters

| Name                                 | Type   | Description                                                                                    |
| ------------------------------------ | ------ | ---------------------------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | number | Delegation you want to get info about. ID can be extracted from the “Get all delegations” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
{
  id: number;
  name: string;
  currencySymbol: string;
  createdAt: string;
  apr: string | null;
  payoutFrequencySeconds: number | null;
  address: {
    ownerAddress?: string;
    stakingAddress?: string;
    lastRewardAt: string | null;
  };
  delegations: [{
    validatorId: string;
    validatorName: string;
    delegationAmount: number;
    rewardAmount: number;
  }];
  undelegations: [{
    validatorId: string;
    validatorName: string;
    amount: number;
  }];
  settings: {
    wallet: string;
  };
}
```

{% endtab %}
{% endtabs %}


# Full Node

## Get all full nodes

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/fullnode`

This endpoint allows to get list of all your hosted full nodes and sentry nodes.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```javascript
[
  {
    id: number;
    fqdn: string;
    name: string;
    currencySymbol: string;
    createdAt: string;
    mode: 'fullnode' | 'sentry';
    instances: [{
      slug: string;
      version: string;
      blockHeight: number | null;
      startedAt: string | null;
    }];
  }
]
```

{% endtab %}
{% endtabs %}

## Get a full node

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/fullnode/{id}`

This endpoint allows to get info about specific full node or sentry node on your account.

#### Path Parameters

<table><thead><tr><th>Name</th><th width="209">Type</th><th>Description</th></tr></thead><tbody><tr><td>id<mark style="color:red;">*</mark></td><td>string</td><td>Full node you want to get info about. ID can be extracted from the “Get all full nodes” call</td></tr></tbody></table>

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  id: number;
  fqdn: string;
  name: string;
  currencySymbol: string;
  createdAt: string;
  mode: 'fullnode' | 'sentry';
  instances: [{
    slug: string;
    version: string;
    blockHeight: number | null;
    startedAt: string | null;
  }];
}
```

{% endtab %}

{% tab title="404: Not Found Full node not found" %}

```javascript
{
  "error": "NODE_NOT_FOUND" 
}
```

{% endtab %}
{% endtabs %}

## Restart a full node

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/fullnode/{id}/restart`

This endpoint allows you to restart your full node.

This feature is available only for Advanced or Enterprise plan nodes.

#### Path Parameters

<table><thead><tr><th>Name</th><th width="209">Type</th><th>Description</th></tr></thead><tbody><tr><td>id<mark style="color:red;">*</mark></td><td>string</td><td>Full node you want to restart. ID can be extracted from the “Get all full nodes” call</td></tr></tbody></table>

**Headers**

| Name                                            | Type   | Value        |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

**Response**

{% tabs %}
{% tab title="204: No Content Full node successfully restarted." %}

```json
```

{% endtab %}

{% tab title="403: Forbidden Full node can not be restarted." %}

```json
{
  "error": "FORBIDDEN"
}
```

{% endtab %}
{% endtabs %}


# Staking

## Approve a token

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for approve tokens.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description         |
| ------------------------------------------------ | ------ | ------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "1INCH"     |
| action<mark style="color:red;">\*</mark>         | string | Must be "approve"   |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "TOKEN_ALREADY_APPROVED"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Stake coins/tokens

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for staking coins/tokens.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description         |
| ------------------------------------------------ | ------ | ------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "1INCH"     |
| action<mark style="color:red;">\*</mark>         | string | Must be "stake"     |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address |
| amount<mark style="color:red;">\*</mark>         | string | Amount to stake     |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_TOKENS"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Withdraw rewards

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for withdraw rewards earned.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                |
| ------------------------------------------------ | ------ | -------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "1INCH"            |
| action<mark style="color:red;">\*</mark>         | string | Must be "withdraw-rewards" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address        |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_REWARDS"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Withdraw stake

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for withdraw stake.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description              |
| ------------------------------------------------ | ------ | ------------------------ |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "1INCH"          |
| action<mark style="color:red;">\*</mark>         | string | Must be "withdraw-stake" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address      |
| amount<mark style="color:red;">\*</mark>         | string | Amount to withdraw       |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}


# Staking

## Approve a token

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for approve tokens.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description         |
| ------------------------------------------------ | ------ | ------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "AAVE"      |
| action<mark style="color:red;">\*</mark>         | string | Must be "approve"   |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "TOKEN_ALREADY_APPROVED"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Stake coins/tokens

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for staking coins/tokens.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description         |
| ------------------------------------------------ | ------ | ------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "AAVE"      |
| action<mark style="color:red;">\*</mark>         | string | Must be "stake"     |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address |
| amount<mark style="color:red;">\*</mark>         | string | Amount to stake     |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_TOKENS"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Withdraw rewards

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for withdraw rewards earned.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                |
| ------------------------------------------------ | ------ | -------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "AAVE"             |
| action<mark style="color:red;">\*</mark>         | string | Must be "withdraw-rewards" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address        |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_REWARDS"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Unbond coins/tokens

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for unbonding coins/tokens.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description            |
| ------------------------------------------------ | ------ | ---------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "AAVE"         |
| action<mark style="color:red;">\*</mark>         | string | Must be "unbond-stake" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address    |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_TOKENS"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Withdraw stake (after unbonding period finished)

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for withdraw stake.\
\
**Unbonding period**: 10 days + 2 days to withdraw stake after that

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description              |
| ------------------------------------------------ | ------ | ------------------------ |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "AAVE"           |
| action<mark style="color:red;">\*</mark>         | string | Must be "withdraw-stake" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address      |
| amount<mark style="color:red;">\*</mark>         | string | Amount to withdraw       |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_EPOCHS_PASSED"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}


# Validator

## Host a validator

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/node/hosting`

This endpoint allows you to host new validator.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description    |
| ------------------------------------------------ | ------ | -------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "AVAX" |

{% tabs %}
{% tab title="201: Validator was successfully hosted." %}

```javascript
{
  id: string;
  ip: string;
  name: string;
  currencySymbol: string;
  createdAt: string;
  payoutFrequencySeconds: null;
  apr: string;
  instance: {
    version: string;
    status: string;
    lastSeenAt: string | null;
    uptimeSeconds: number | null;
    uptimePercent: number | null;
    nodeId: string | null;
    blsPublicKey: string | null;
    blsSignature: string | null;
  };
  address: {
    rewardOwner: string;
    rewardsEarned: number;
    rewardsEarnedUsd: number;
    rewardsEarnedFromOwnStake: number;
    rewardsEarnedFromOwnStakeUsd: number;
    rewardsEarnedFromDelegatedStake: number;
    rewardsEarnedFromDelegatedStakeUsd: number;
    stakeAmount: number | null;
    stakeAmountUsd: number | null;
    delegatorAmount: number | null;
    delegatedAmount: number | null;
    delegatedAmountUsd: number | null;
    totalAvailableAmount: number | null;
    totalAvailableAmountUsd: number | null;
    fee: number | null;
    startTimestamp: string | null;
    endTimestamp: string | null;
    delegators: Array<{
      address: string;
      amount: number;
      amountUsd: number;
      startTimestamp: string;
      endTimestamp: string;
    }> | null;
  };
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```javascript
{
  "error": "NEGATIVE_BALANCE"
}
```

{% endtab %}
{% endtabs %}


# Masternode

## Host a masternode

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/node/hosting`

This endpoint allows you to host new masternode.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name            | Type   | Description                    |
| --------------- | ------ | ------------------------------ |
| currencySymbol  | string | Must be "DASH"                 |
| collateralHash  | string | Hash of your collateral UTXO   |
| collateralIndex | number | Index of your collateral UTXO  |
| nodeName        | string | Name of your new masternode    |
| walletType      | string | "ledger" \| "trezor" \| "core" |

{% tabs %}
{% tab title="201 Masternode was successfully hosted." %}

```typescript
{
  id: string;
  ip: string;
  name: string;
  currencySymbol: string;
  createdAt: string;
  payoutFrequencySeconds: number | null;
  apr: string | null;
  instance: {
    version: string;
    status: string;
    uptimeSeconds: number | null;
    lastSeenAt: string | null;
  };
  address: {
    collateralAddress: string;
    collateralHash: string;
    collateralIndex: number;
    payeeAddress: string;
    balanceAmount: number;
    rewardsEarned: number;
    lastRewardAt: string | null;
  };
  settings: {
    walletType: 'ledger' | 'trezor' | 'core' | null;
  };
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```javascript
{
  "error": "INVALID_CURRENCY_SYMBOL"
}
```

{% endtab %}
{% endtabs %}

## Get UTXO

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/utxo/{address}`

This endpoint allows you to get list of all your collateral utxo.

#### Path Parameters

| Name                                      | Type   | Description             |
| ----------------------------------------- | ------ | ----------------------- |
| address<mark style="color:red;">\*</mark> | string | Your collateral address |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
[
  {
    hash: string;
    index: number;
  }
]
```

{% endtab %}
{% endtabs %}

## Get hosting state

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/state/{hash}-{index}`

This endpoint allows you to get hosting state of your collateral utxo.

#### Path Parameters

| Name                                    | Type   | Description                |
| --------------------------------------- | ------ | -------------------------- |
| hash<mark style="color:red;">\*</mark>  | string | Your collateral UTXO hash  |
| index<mark style="color:red;">\*</mark> | number | Your collateral UTXO index |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
{
  isAlreadyHosted: boolean;
  isAlreadyHostedOnAllnodes: boolean;
  isActivated: boolean;
  isBanned: boolean;
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "error": "INVALID_COLLATERAL_HASH_AND_INDEX"
}
```

{% endtab %}
{% endtabs %}

## Execute "protx register\_prepare" command and get output

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/{id}/deterministic/prepare`

This endpoint allows you to get results of "protx register\_submit" command executed on our full node.

#### Path Parameters

| Name                                 | Type   | Description                                                                  |
| ------------------------------------ | ------ | ---------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | Node you want to register. ID can be extracted from the “Get all nodes” call |

#### Query Parameters

| Name         | Type   | Description                              |
| ------------ | ------ | ---------------------------------------- |
| payeeAddress | string | Address for receiving masternode rewards |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
{
  tx: string;
  collateralAddress: string;
  signMessage: string;
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "error": "INVALID_PAYEE_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Execute "protx register\_submit" command

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/node/{id}/deterministic/submit`

This endpoint allows you to execute "protx register\_submit" command on our full node with data provided through the API call. Registration in deterministic list will happen in 1 block after execution.

#### Path Parameters

| Name                                 | Type   | Description                                                                  |
| ------------------------------------ | ------ | ---------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | Node you want to register. ID can be extracted from the “Get all nodes” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name      | Type   | Description                                                      |
| --------- | ------ | ---------------------------------------------------------------- |
| signature | string | Signed "signMessage" from protx register\_prepare command output |
| tx        | string | "tx" from protx register\_prepare command output                 |

{% tabs %}
{% tab title="200 " %}

```
{
  hash: string;
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "error": "INVALID_SIGNATURE"
}
```

{% endtab %}
{% endtabs %}


# Validator

## Host a validator (with private key)

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/node/hosting`

This endpoint allows you to host new validator.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                                                                                                                                                                                   |
| ------------------------------------------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "ETH"                                                                                                                                                                                 |
| privateKey<mark style="color:red;">\*</mark>     | string | Validator private key in HEX (not withdrawal private key)                                                                                                                                     |
| network<mark style="color:red;">\*</mark>        | string | "mainnet" \| "pyrmont" \| "prater"                                                                                                                                                            |
| graffiti<mark style="color:red;">\*</mark>       | string | Graffiti of your new validator (not more than 17 bytes)                                                                                                                                       |
| relayId                                          | string | <p>MEV-Boost Relay of your new validator. Possible options:<br>\* "flashbots"<br>\* "ultrasound"<br>\* "maxprofit" (Enterprise plan required)<br>\* null (this option disables MEV-Boost)</p> |
| planType                                         | string | <p>Pricing plan. Possible options:<br>\* "advanced" (default)<br>\* "enterprise"</p>                                                                                                          |

{% tabs %}
{% tab title="201: Validator was successfully hosted." %}

```javascript
{
  id: string;
  ip: string;
  name: string;
  currencySymbol: string;
  createdAt: string;
  payoutFrequencySeconds: number;
  apr: string;
  instance: {
    version: string;
    status: string;
    uptimeSeconds: number | null;
    nodeId: number | null;
  };
  address: {
    rewardOwner: string;
    rewardsEarned: number;
    signingPublicKey: string;
  };
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```javascript
{
  "error": "INVALID_GRAFFITI"
}
```

{% endtab %}
{% endtabs %}

## Host a validator (with keystore and password)

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/node/hosting`

This endpoint allows you to host new validator.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                                                                                                                                                                                   |
| ------------------------------------------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "ETH"                                                                                                                                                                                 |
| keystore<mark style="color:red;">\*</mark>       | object | Your keystore content in JSON                                                                                                                                                                 |
| password<mark style="color:red;">\*</mark>       | string | Your keystore password                                                                                                                                                                        |
| networkName<mark style="color:red;">\*</mark>    | string | "mainnet" \| "pyrmont" \| "prater"                                                                                                                                                            |
| graffiti<mark style="color:red;">\*</mark>       | string | Graffiti of your new validator (not more than 17 bytes)                                                                                                                                       |
| relayId                                          | string | <p>MEV-Boost Relay of your new validator. Possible options:<br>\* "flashbots"<br>\* "ultrasound"<br>\* "maxprofit" (Enterprise plan required)<br>\* null (this option disables MEV-Boost)</p> |
| planType                                         | string | <p>Pricing plan. Possible options:<br>\* "advanced" (default)<br>\* "enterprise"</p>                                                                                                          |

{% tabs %}
{% tab title="201: Validator was successfully hosted." %}

```javascript
{
  id: string;
  ip: string;
  name: string;
  currencySymbol: string;
  createdAt: string;
  payoutFrequencySeconds: number;
  apr: string;
  instance: {
    version: string;
    status: string;
    uptimeSeconds: number | null;
    nodeId: number | null;
  };
  address: {
    rewardOwner: string;
    rewardsEarned: number;
    signingPublicKey: string;
  };
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```javascript
{
  "error": "INVALID_GRAFFITI"
}
```

{% endtab %}
{% endtabs %}

## Get message to sign for Fee Recipient address change

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/{id}/fee-recipient/sign-message`

Use this endpoint before changing Fee Recipient address.

#### Path Parameters

| Name                                 | Type   | Description                                                                                                |
| ------------------------------------ | ------ | ---------------------------------------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | Node for which you want to change Fee Recipient address. ID can be extracted from the “Get all nodes” call |

#### Query Parameters

| Name                                      | Type   | Description                    |
| ----------------------------------------- | ------ | ------------------------------ |
| address<mark style="color:red;">\*</mark> | string | Your new Fee Recipient address |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```json
{
  message: string;
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```json
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Change Fee Recipient address

<mark style="color:orange;">`PUT`</mark> `https://www.allnodes.com/api/v1/node/{id}/fee-recipient`

This endpoint allows you to change Fee Recipient address of your validator.

#### Path Parameters

| Name                                 | Type   | Description                                                                                                |
| ------------------------------------ | ------ | ---------------------------------------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | Node for which you want to change Fee Recipient address. ID can be extracted from the “Get all nodes” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                        | Type   | Description                                                              |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------ |
| message<mark style="color:red;">\*</mark>   | string | Message to sign                                                          |
| signature<mark style="color:red;">\*</mark> | string | ECDSA signature (HEX). Must be signed by deposit or withdrawal addresses |
| address<mark style="color:red;">\*</mark>   | string | Your new Fee Recipient address                                           |

{% tabs %}
{% tab title="200: OK " %}

```json
{
  nodeId: string;
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```json
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Change MEV-Boost Relay

<mark style="color:orange;">`PUT`</mark> `https://www.allnodes.com/api/v1/node/{id}/relay`

This endpoint allows you to change MEV-Boost Relay of your validator.

#### Path Parameters

| Name                                 | Type   | Description                                                                                          |
| ------------------------------------ | ------ | ---------------------------------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | Node for which you want to change MEV-Boost Relay. ID can be extracted from the “Get all nodes” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                      | Type   | Description                                                                                                                                                                                   |
| ----------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| relayId<mark style="color:red;">\*</mark> | string | <p>MEV-Boost Relay of your new validator. Possible options:<br>\* "flashbots"<br>\* "ultrasound"<br>\* "maxprofit" (Enterprise plan required)<br>\* null (this option disables MEV-Boost)</p> |

{% tabs %}
{% tab title="200: OK " %}

```json
{
  nodeId: string;
  newRelay: string;
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```json
{
  "error": "INVALID_RELAY_ID"
}
```

{% endtab %}
{% endtabs %}

## Get message to sign for Voluntary Exit request

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/{id}/voluntary-exit/sign-message`

Use this endpoint before requesting Voluntary Exit.

#### Path Parameters

| Name                                 | Type   | Description                                                              |
| ------------------------------------ | ------ | ------------------------------------------------------------------------ |
| id<mark style="color:red;">\*</mark> | string | Node you want to exit. ID can be extracted from the “Get all nodes” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```json
{
  message: string;
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```json
{
  "error": "VOLUNTARY_EXIT_ALREADY_REQUESTED"
}
```

{% endtab %}
{% endtabs %}

## Request Voluntary Exit

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/node/{id}/voluntary-exit`

This endpoint allows you to request Voluntary Exit of your validator.

#### Path Parameters

| Name                                 | Type   | Description                                                              |
| ------------------------------------ | ------ | ------------------------------------------------------------------------ |
| id<mark style="color:red;">\*</mark> | string | Node you want to exit. ID can be extracted from the “Get all nodes” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                        | Type   | Description                                                              |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------ |
| message<mark style="color:red;">\*</mark>   | string | Message to sign                                                          |
| signature<mark style="color:red;">\*</mark> | string | ECDSA signature (HEX). Must be signed by deposit or withdrawal addresses |

{% tabs %}
{% tab title="201: Created " %}

```json
{
  nodeId: string;
}
```

{% endtab %}

{% tab title="403: Forbidden " %}

```
{
  "error": "VERIFICATION_FAILED"
}
```

{% endtab %}
{% endtabs %}


# Staking

Powered by StakeWise

## Get info about address

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get info about your address.

**Headers**

| Name          | Type   | Value          |
| ------------- | ------ | -------------- |
| Authorization | string | `Bearer TOKEN` |

**Body**

| Name             | Type   | Description         |
| ---------------- | ------ | ------------------- |
| `currencySymbol` | string | Must be "ETH"       |
| `action`         | string | Must be "info"      |
| `address`        | string | Your wallet address |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  eth: {
    assets: string; // staked ETH amount (in wei)
    maxUnstakeAssets: string; // max allowed amount to unstake (in wei)
  }
  osEth: {
    shares: string; // minted osETH (in wei)
    maxMintShares: string; // max allowed amount to mint (in wei)
  }
  withdraw: {
    isAvailable: boolean; // is withdraw available
    availableAt: string | null; // ISO timestamp indicating when withdraw will be available
    withdrawableAssets: string; // ETH amount available to withdraw (in wei)
    requestedAssets: string; // ETH amount requested to withdraw (in wei)
  }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Stake ETH

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for stake ETH.

**Headers**

| Name          | Type   | Value          |
| ------------- | ------ | -------------- |
| Authorization | string | `Bearer TOKEN` |

**Body**

| Name             | Type   | Description              |
| ---------------- | ------ | ------------------------ |
| `currencySymbol` | string | Must be "ETH"            |
| `action`         | string | Must be "stake"          |
| `address`        | string | Your wallet address      |
| `amount`         | string | Amount to stake (in wei) |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  network: string; // mainnet
  toAddress: string;
  amount: string; // in wei
  gasLimit: number;
  gasPrice: string; // in wei
  data: string;
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "INVALID_AMOUNT"
}
```

{% endtab %}
{% endtabs %}

## Unstake ETH

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for unstake ETH.

**Headers**

| Name          | Type   | Value          |
| ------------- | ------ | -------------- |
| Authorization | string | `Bearer TOKEN` |

**Body**

| Name             | Type   | Description                |
| ---------------- | ------ | -------------------------- |
| `currencySymbol` | string | Must be "ETH"              |
| `action`         | string | Must be "unstake"          |
| `address`        | string | Your wallet address        |
| `amount`         | string | Amount to unstake (in wei) |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  network: string; // mainnet
  toAddress: string;
  amount: string; // in wei
  gasLimit: number;
  gasPrice: string; // in wei
  data: string;
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "AMOUNT_EXCEEDS_MAX_UNSTAKEABLE_ASSETS"
}
```

{% endtab %}
{% endtabs %}

## Withdraw ETH (after unstaking period finished)

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for withdraw unstaked ETH.

**Current unstaking period**: 1 - 10 days.

**Headers**

| Name          | Type   | Value          |
| ------------- | ------ | -------------- |
| Authorization | string | `Bearer TOKEN` |

**Body**

| Name             | Type   | Description         |
| ---------------- | ------ | ------------------- |
| `currencySymbol` | string | Must be "ETH"       |
| `action`         | string | Must be "withdraw"  |
| `address`        | string | Your wallet address |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  network: string; // mainnet
  toAddress: string;
  amount: string; // in wei
  gasLimit: number;
  gasPrice: string; // in wei
  data: string;
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "WITHDRAW_NOT_AVAILABLE"
}
```

{% endtab %}
{% endtabs %}

## Mint osETH token

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for mint osETH token.

**Headers**

| Name          | Type   | Value          |
| ------------- | ------ | -------------- |
| Authorization | string | `Bearer TOKEN` |

**Body**

| Name             | Type   | Description             |
| ---------------- | ------ | ----------------------- |
| `currencySymbol` | string | Must be "ETH"           |
| `action`         | string | Must be "mint-os-eth"   |
| `address`        | string | Your wallet address     |
| `amount`         | string | Amount to mint (in wei) |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  network: string; // mainnet
  toAddress: string;
  amount: string; // in wei
  gasLimit: number;
  gasPrice: string; // in wei
  data: string;
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "AMOUNT_EXCEEDS_MAX_MINT_SHARES"
}
```

{% endtab %}
{% endtabs %}

## Burn osETH token

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for burn osETH token.

**Headers**

| Name          | Type   | Value          |
| ------------- | ------ | -------------- |
| Authorization | string | `Bearer TOKEN` |

**Body**

| Name             | Type   | Description             |
| ---------------- | ------ | ----------------------- |
| `currencySymbol` | string | Must be "ETH"           |
| `action`         | string | Must be "burn-os-eth"   |
| `address`        | string | Your wallet address     |
| `amount`         | string | Amount to burn (in wei) |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  network: string; // mainnet
  toAddress: string;
  amount: string; // in wei
  gasLimit: number;
  gasPrice: string; // in wei
  data: string;
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "AMOUNT_EXCEEDS_OS_ETH_SHARES"
}
```

{% endtab %}
{% endtabs %}


# Masternode

## Host a masternode

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/node/hosting`

This endpoint allows you to host new masternode.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name            | Type   | Description                    |
| --------------- | ------ | ------------------------------ |
| currencySymbol  | string | Must be "FIRO"                 |
| collateralHash  | string | Hash of your collateral UTXO   |
| collateralIndex | number | Index of your collateral UTXO  |
| nodeName        | string | Name of your new masternode    |
| walletType      | string | "ledger" \| "trezor" \| "core" |

{% tabs %}
{% tab title="201 Masternode was successfully hosted." %}

```typescript
{
  id: string;
  ip: string;
  name: string;
  currencySymbol: string;
  createdAt: string;
  payoutFrequencySeconds: number | null;
  apr: string | null;
  instance: {
    version: string;
    status: string;
    uptimeSeconds: number | null;
    lastSeenAt: string | null;
  };
  address: {
    collateralAddress: string;
    collateralHash: string;
    collateralIndex: number;
    payeeAddress: string;
    balanceAmount: number;
    rewardsEarned: number;
    lastRewardAt: string | null;
  };
  settings: {
    walletType: 'ledger' | 'trezor' | 'core' | null;
  };
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```javascript
{
  "error": "INVALID_CURRENCY_SYMBOL"
}
```

{% endtab %}
{% endtabs %}

## Get UTXO

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/utxo/{address}`

This endpoint allows you to get list of all your collateral utxo.

#### Path Parameters

| Name                                      | Type   | Description             |
| ----------------------------------------- | ------ | ----------------------- |
| address<mark style="color:red;">\*</mark> | string | Your collateral address |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
[
  {
    hash: string;
    index: number;
  }
]
```

{% endtab %}
{% endtabs %}

## Get hosting state

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/state/{hash}-{index}`

This endpoint allows you to get hosting state of your collateral utxo.

#### Path Parameters

| Name                                    | Type   | Description                |
| --------------------------------------- | ------ | -------------------------- |
| hash<mark style="color:red;">\*</mark>  | string | Your collateral UTXO hash  |
| index<mark style="color:red;">\*</mark> | number | Your collateral UTXO index |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
{
  isAlreadyHosted: boolean;
  isAlreadyHostedOnAllnodes: boolean;
  isActivated: boolean;
  isBanned: boolean;
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "error": "INVALID_COLLATERAL_HASH_AND_INDEX"
}
```

{% endtab %}
{% endtabs %}

## Execute "protx register\_prepare" command and get output

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/{id}/deterministic/prepare`

This endpoint allows you to get results of "protx register\_submit" command executed on our full node.

#### Path Parameters

| Name                                 | Type   | Description                                                                  |
| ------------------------------------ | ------ | ---------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | Node you want to register. ID can be extracted from the “Get all nodes” call |

#### Query Parameters

| Name         | Type   | Description                              |
| ------------ | ------ | ---------------------------------------- |
| payeeAddress | string | Address for receiving masternode rewards |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
{
  tx: string;
  collateralAddress: string;
  signMessage: string;
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "error": "INVALID_PAYEE_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Execute "protx register\_submit" command

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/node/{id}/deterministic/submit`

This endpoint allows you to execute "protx register\_submit" command on our full node with data provided through the API call. Registration in deterministic list will happen in 1 block after execution.

#### Path Parameters

| Name                                 | Type   | Description                                                                  |
| ------------------------------------ | ------ | ---------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | Node you want to register. ID can be extracted from the “Get all nodes” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name      | Type   | Description                                                      |
| --------- | ------ | ---------------------------------------------------------------- |
| signature | string | Signed "signMessage" from protx register\_prepare command output |
| tx        | string | "tx" from protx register\_prepare command output                 |

{% tabs %}
{% tab title="200 " %}

```
{
  hash: string;
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "error": "INVALID_SIGNATURE"
}
```

{% endtab %}
{% endtabs %}


# Kusama Staking

Instructions: <https://help.allnodes.com/en/articles/6730086-kusama-staking-api>

## Bond coins (initial)

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for initial bond coins.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                                              |
| ------------------------------------------------ | ------ | -------------------------------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "KSM"                                            |
| action<mark style="color:red;">\*</mark>         | string | Must be "initial-bond"                                   |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address (will be used as stash account)      |
| controller<mark style="color:red;">\*</mark>     | string | Your wallet address (will be used as controller account) |
| payee<mark style="color:red;">\*</mark>          | string | "stash-reinvest" \| "stash-save" \| "controller"         |
| amount<mark style="color:red;">\*</mark>         | string | Amount to stake (in KSM)                                 |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```json
{
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```json
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Bond extra coins

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for bonding extra coins.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                         |
| ------------------------------------------------ | ------ | ----------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "KSM"                       |
| action<mark style="color:red;">\*</mark>         | string | Must be "bond-extra"                |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address (stash account) |
| amount<mark style="color:red;">\*</mark>         | string | Amount to bond (in KSM)             |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```json
{
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```json
{
  "error": "INVALID_AMOUNT"
}
```

{% endtab %}
{% endtabs %}

## Nominate validators

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for nominate validators.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type      | Description                                                     |
| ------------------------------------------------ | --------- | --------------------------------------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string    | Must be "KSM"                                                   |
| action<mark style="color:red;">\*</mark>         | string    | Must be "nominate"                                              |
| address<mark style="color:red;">\*</mark>        | string    | Your wallet address (stash account)                             |
| validators<mark style="color:red;">\*</mark>     | string\[] | Addresses of validators to nominate (up to 16 unique addresses) |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```json
{
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```json
{
  "error": "VALIDATORS_UNIQ_ERROR"
}
```

{% endtab %}
{% endtabs %}

## Unbond coins

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for unbonding coins.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                         |
| ------------------------------------------------ | ------ | ----------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "KSM"                       |
| action<mark style="color:red;">\*</mark>         | string | Must be "unbond"                    |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address (stash account) |
| amount<mark style="color:red;">\*</mark>         | string | Amount to unbond (in KSM)           |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```json
{
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```javascript
{
  "error": "NOT_ENOUGH_AMOUNT"
}
```

{% endtab %}
{% endtabs %}

## Withdraw stake (after unbonding period finished)

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for withdraw stake.\
\
**Unbonding period**: 7 days

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                         |
| ------------------------------------------------ | ------ | ----------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "KSM"                       |
| action<mark style="color:red;">\*</mark>         | string | Must be "withdraw-stake"            |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address (stash account) |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```json
{
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```json
{
  "error": "INVALID_ERA_FOR_WITHDRAW"
}
```

{% endtab %}
{% endtabs %}


# NEAR Protocol Staking

Instructions: <https://help.allnodes.com/en/articles/6759442-near-protocol-staking-api>

## Stake coins

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for staking coins.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                               | Type   | Description                                                                              |
| -------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark>   | string | Must be "NEAR"                                                                           |
| action<mark style="color:red;">\*</mark>           | string | Must be "stake"                                                                          |
| accountID<mark style="color:red;">\*</mark>        | string | You wallet ID (Example: "allnodes.near")                                                 |
| accountPublicKey<mark style="color:red;">\*</mark> | string | Your wallet public key (Example: "ed25519:1sTWdHCPJL3xkzxdg4ZkQm4d8A4TakDePXbpaGh4dAVE") |
| amount<mark style="color:red;">\*</mark>           | string | Amount to stake (in NEAR)                                                                |
| validatorID<mark style="color:red;">\*</mark>      | string | Validator ID to delegate (Example: "allnodes.poolv1.near")                               |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```javascript
{
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```javascript
{
  "error": "INVALID_ACCOUNT_ID"
}
```

{% endtab %}
{% endtabs %}

## Unbond coins

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for unbonding coins.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                               | Type   | Description                                                                              |
| -------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark>   | string | Must be "NEAR"                                                                           |
| action<mark style="color:red;">\*</mark>           | string | Must be "unbond"                                                                         |
| accountID<mark style="color:red;">\*</mark>        | string | You wallet ID (Example: "allnodes.near")                                                 |
| accountPublicKey<mark style="color:red;">\*</mark> | string | Your wallet public key (Example: "ed25519:1sTWdHCPJL3xkzxdg4ZkQm4d8A4TakDePXbpaGh4dAVE") |
| validatorID<mark style="color:red;">\*</mark>      | string | Validator ID to unbond from (Example: "allnodes.poolv1.near")                            |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```javascript
{
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```javascript
{
  "error": "INVALID_VALIDATOR_ID"
}
```

{% endtab %}
{% endtabs %}

## Withdraw stake (after unbonding period finished)

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for withdraw stake.

**Unbonding period**: 2 days

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                               | Type   | Description                                                                              |
| -------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark>   | string | Must be "NEAR"                                                                           |
| action<mark style="color:red;">\*</mark>           | string | Must be "withdraw-stake"                                                                 |
| accountID<mark style="color:red;">\*</mark>        | string | You wallet ID (Example: "allnodes.near")                                                 |
| accountPublicKey<mark style="color:red;">\*</mark> | string | Your wallet public key (Example: "ed25519:1sTWdHCPJL3xkzxdg4ZkQm4d8A4TakDePXbpaGh4dAVE") |
| validatorID<mark style="color:red;">\*</mark>      | string | Validator ID to withdraw stake from (Example: "allnodes.poolv1.near")                    |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```javascript
{
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```javascript
{
  "error": "INVALID_PUBLIC_KEY"
}
```

{% endtab %}
{% endtabs %}


# Masternode

## Host a masternode

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/node/hosting`

This endpoint allows you to host new masternode.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name            | Type   | Description                    |
| --------------- | ------ | ------------------------------ |
| currencySymbol  | string | Must be "PAC"                  |
| collateralHash  | string | Hash of your collateral UTXO   |
| collateralIndex | number | Index of your collateral UTXO  |
| nodeName        | string | Name of your new masternode    |
| walletType      | string | "ledger" \| "trezor" \| "core" |

{% tabs %}
{% tab title="201 Node was successfully hosted." %}

```typescript
{
  id: string;
  ip: string;
  name: string;
  currencySymbol: string;
  createdAt: string;
  payoutFrequencySeconds: number | null;
  apr: string | null;
  instance: {
    version: string;
    status: string;
    uptimeSeconds: number | null;
    lastSeenAt: string | null;
  };
  address: {
    collateralAddress: string;
    collateralHash: string;
    collateralIndex: number;
    payeeAddress: string;
    balanceAmount: number;
    rewardsEarned: number;
    lastRewardAt: string | null;
  };
  settings: {
    walletType: 'ledger' | 'trezor' | 'core' | null;
  };
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```javascript
{
  "error": "INVALID_CURRENCY_SYMBOL"
}
```

{% endtab %}
{% endtabs %}

## Get UTXO

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/utxo/{address}`

This endpoint allows you to get list of all your collateral utxo.

#### Path Parameters

| Name                                      | Type   | Description             |
| ----------------------------------------- | ------ | ----------------------- |
| address<mark style="color:red;">\*</mark> | string | Your collateral address |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
[
  {
    hash: string;
    index: number;
  }
]
```

{% endtab %}
{% endtabs %}

## Get hosting state

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/state/{hash}-{index}`

This endpoint allows you to get hosting state of your collateral utxo.

#### Path Parameters

| Name                                    | Type   | Description                |
| --------------------------------------- | ------ | -------------------------- |
| hash<mark style="color:red;">\*</mark>  | string | Your collateral UTXO hash  |
| index<mark style="color:red;">\*</mark> | number | Your collateral UTXO index |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
{
  isAlreadyHosted: boolean;
  isAlreadyHostedOnAllnodes: boolean;
  isActivated: boolean;
  isBanned: boolean;
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "error": "INVALID_COLLATERAL_HASH_AND_INDEX"
}
```

{% endtab %}
{% endtabs %}

## Execute "protx register\_prepare" command and get output

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/{id}/deterministic/prepare`

This endpoint allows you to get results of "protx register\_submit" command executed on our full node.

#### Path Parameters

| Name                                 | Type   | Description                                                                  |
| ------------------------------------ | ------ | ---------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | Node you want to register. ID can be extracted from the “Get all nodes” call |

#### Query Parameters

| Name         | Type   | Description                              |
| ------------ | ------ | ---------------------------------------- |
| payeeAddress | string | Address for receiving masternode rewards |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
{
  tx: string;
  collateralAddress: string;
  signMessage: string;
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "error": "INVALID_PAYEE_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Execute "protx register\_submit" command

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/node/{id}/deterministic/submit`

This endpoint allows you to execute "protx register\_submit" command on our full node with data provided through the API call. Registration in deterministic list will happen in 1 block after execution.

#### Path Parameters

| Name                                 | Type   | Description                                                                  |
| ------------------------------------ | ------ | ---------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | Node you want to register. ID can be extracted from the “Get all nodes” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name      | Type   | Description                                                      |
| --------- | ------ | ---------------------------------------------------------------- |
| signature | string | Signed "signMessage" from protx register\_prepare command output |
| tx        | string | "tx" from protx register\_prepare command output                 |

{% tabs %}
{% tab title="200 " %}

```
{
  hash: string;
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "error": "INVALID_SIGNATURE"
}
```

{% endtab %}
{% endtabs %}


# Polkadot Staking

Instructions: <https://help.allnodes.com/en/articles/6730085-polkadot-staking-api>

## Bond coins (initial)

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for initial bond coins.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                                              |
| ------------------------------------------------ | ------ | -------------------------------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "DOT"                                            |
| action<mark style="color:red;">\*</mark>         | string | Must be "initial-bond"                                   |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address (will be used as stash account)      |
| controller<mark style="color:red;">\*</mark>     | string | Your wallet address (will be used as controller account) |
| payee<mark style="color:red;">\*</mark>          | string | "stash-reinvest" \| "stash-save" \| "controller"         |
| amount<mark style="color:red;">\*</mark>         | string | Amount to stake (in DOT)                                 |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```json
{
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```json
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Bond extra coins

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for bonding extra coins.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                         |
| ------------------------------------------------ | ------ | ----------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "DOT"                       |
| action<mark style="color:red;">\*</mark>         | string | Must be "bond-extra"                |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address (stash account) |
| amount<mark style="color:red;">\*</mark>         | string | Amount to bond (in DOT)             |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```json
{
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```json
{
  "error": "INVALID_AMOUNT"
}
```

{% endtab %}
{% endtabs %}

## Nominate validators

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for nominate validators.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type      | Description                                                     |
| ------------------------------------------------ | --------- | --------------------------------------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string    | Must be "DOT"                                                   |
| action<mark style="color:red;">\*</mark>         | string    | Must be "nominate"                                              |
| address<mark style="color:red;">\*</mark>        | string    | Your wallet address (stash account)                             |
| validators<mark style="color:red;">\*</mark>     | string\[] | Addresses of validators to nominate (up to 16 unique addresses) |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```json
{
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```json
{
  "error": "VALIDATORS_UNIQ_ERROR"
}
```

{% endtab %}
{% endtabs %}

## Unbond coins

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for unbonding coins.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                         |
| ------------------------------------------------ | ------ | ----------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "DOT"                       |
| action<mark style="color:red;">\*</mark>         | string | Must be "unbond"                    |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address (stash account) |
| amount<mark style="color:red;">\*</mark>         | string | Amount to unbond (in DOT)           |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```json
{
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```javascript
{
  "error": "NOT_ENOUGH_AMOUNT"
}
```

{% endtab %}
{% endtabs %}

## Withdraw stake (after unbonding period finished)

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for withdraw stake.\
\
**Unbonding period**: 28 days

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                         |
| ------------------------------------------------ | ------ | ----------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "DOT"                       |
| action<mark style="color:red;">\*</mark>         | string | Must be "withdraw-stake"            |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address (stash account) |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```json
{
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```json
{
  "error": "INVALID_ERA_FOR_WITHDRAW"
}
```

{% endtab %}
{% endtabs %}


# Staking

## Approve a token

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for approve tokens.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description         |
| ------------------------------------------------ | ------ | ------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "POL"       |
| action<mark style="color:red;">\*</mark>         | string | Must be "approve"   |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "TOKEN_ALREADY_APPROVED"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Stake coins/tokens

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for staking coins/tokens to Allnodes validator.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description         |
| ------------------------------------------------ | ------ | ------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "POL"       |
| action<mark style="color:red;">\*</mark>         | string | Must be "stake"     |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address |
| amount<mark style="color:red;">\*</mark>         | string | Amount to delegate  |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_TOKENS"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Withdraw rewards

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for withdraw rewards earned.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                |
| ------------------------------------------------ | ------ | -------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "POL"              |
| action<mark style="color:red;">\*</mark>         | string | Must be "withdraw-rewards" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address        |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_REWARDS"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Restake rewards

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for restake rewards earned.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description               |
| ------------------------------------------------ | ------ | ------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "POL"             |
| action<mark style="color:red;">\*</mark>         | string | Must be "restake-rewards" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address       |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_REWARDS"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Unbond coins/tokens

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for unbonding coins/tokens from Allnodes validator.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description            |
| ------------------------------------------------ | ------ | ---------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "POL"          |
| action<mark style="color:red;">\*</mark>         | string | Must be "unbond-stake" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address    |
| amount<mark style="color:red;">\*</mark>         | string | Amount to undelegate   |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_TOKENS"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Withdraw stake (after unbonding period finished)

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for withdraw stake from Allnodes validator. \
\
**Unbonding period**: 80 checkpoints (1.5 - 2 days)

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description              |
| ------------------------------------------------ | ------ | ------------------------ |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "POL"            |
| action<mark style="color:red;">\*</mark>         | string | Must be "withdraw-stake" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address      |
| amount<mark style="color:red;">\*</mark>         | string | Amount to withdraw       |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_EPOCHS_PASSED"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}


# Shiba Inu Staking

## Approve a token

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for approve tokens.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description         |
| ------------------------------------------------ | ------ | ------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "SHIB"      |
| action<mark style="color:red;">\*</mark>         | string | Must be "approve"   |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "TOKEN_ALREADY_APPROVED"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Stake coins/tokens

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for staking coins/tokens.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description         |
| ------------------------------------------------ | ------ | ------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "SHIB"      |
| action<mark style="color:red;">\*</mark>         | string | Must be "stake"     |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address |
| amount<mark style="color:red;">\*</mark>         | string | Amount to stake     |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_TOKENS"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Approve withdraw

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for approve staked tokens (needed to be executed before withdraw staked SHIBs).

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                |
| ------------------------------------------------ | ------ | -------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "SHIB"             |
| action<mark style="color:red;">\*</mark>         | string | Must be "approve-withdraw" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address        |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "TOKEN_ALREADY_APPROVED"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Withdraw stake

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for withdraw stake.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description              |
| ------------------------------------------------ | ------ | ------------------------ |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "SHIB"           |
| action<mark style="color:red;">\*</mark>         | string | Must be "withdraw-stake" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address      |
| amount<mark style="color:red;">\*</mark>         | string | Amount to withdraw       |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_EPOCHS_PASSED"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}


# Solana Staking

Instructions: <https://help.allnodes.com/en/articles/6612209-solana-staking-api>

## Get stake accounts

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get list of all your stake accounts.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                  |
| ------------------------------------------------ | ------ | ---------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "SOL"                |
| action<mark style="color:red;">\*</mark>         | string | Must be "get-stake-accounts" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address          |

{% tabs %}
{% tab title="200: OK " %}

```javascript
[
  {
    publicKey: string;
    rentEpoch: number;
    lamports: number;
    stake: number;
    validatorPublicKey: string | null;
    status: {
      active: number;
      inactive: number;
      state: 'active' | 'inactive' | 'activating' | 'deactivating';
    };
  }
]
```

{% endtab %}
{% endtabs %}

## Create stake account

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for creating stake account.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                    |
| ------------------------------------------------ | ------ | ------------------------------ |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "SOL"                  |
| action<mark style="color:red;">\*</mark>         | string | Must be "create-stake-account" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address            |
| amount<mark style="color:red;">\*</mark>         | string | Amount to stake                |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```json
{
  network: string;
  amount: string;
  serializedTransaction: string;
  stakeAccountSecretKey: string;
  stakeAccountPublicKey: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```json
{
  "error": "ACCOUNT_DOES_NOT_EXIST"
}
```

{% endtab %}
{% endtabs %}

## Stake coins

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for delegating staked coins to Allnodes validator.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                                    | Type   | Description                                                                                    |
| ------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark>        | string | Must be "SOL"                                                                                  |
| action<mark style="color:red;">\*</mark>                | string | Must be "stake"                                                                                |
| address<mark style="color:red;">\*</mark>               | string | Your wallet address                                                                            |
| stakeAccountPublicKey<mark style="color:red;">\*</mark> | string | Public key of your stake account. Public key can be extracted from "Create stake account" call |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```javascript
{
  network: string;
  votePublicKey: string;
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```json
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Unbond coins

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for unbonding coins (deactivating your stake account).

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                                    | Type   | Description                                                                                    |
| ------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark>        | string | Must be "SOL"                                                                                  |
| action<mark style="color:red;">\*</mark>                | string | Must be "unbond-stake"                                                                         |
| address<mark style="color:red;">\*</mark>               | string | Your wallet address                                                                            |
| stakeAccountPublicKey<mark style="color:red;">\*</mark> | string | Public key of your stake account. Public key can be extracted from "Create stake account" call |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```javascript
{
  network: string;
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```javascript
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Withdraw stake (after unbonding period finished)

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get serialized unsigned transaction for withdraw stake.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                                    | Type   | Description                                                                                    |
| ------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------- |
| currencySymbol<mark style="color:red;">\*</mark>        | string | Must be "SOL"                                                                                  |
| action<mark style="color:red;">\*</mark>                | string | Must be "withdraw-stake"                                                                       |
| address<mark style="color:red;">\*</mark>               | string | Your wallet address                                                                            |
| stakeAccountPublicKey<mark style="color:red;">\*</mark> | string | Public key of your stake account. Public key can be extracted from "Create stake account" call |
| amount<mark style="color:red;">\*</mark>                | string | Amount to withdraw                                                                             |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```javascript
{
  network: string;
  amount: string;
  serializedTransaction: string;
}
```

{% endtab %}

{% tab title="400: Bad Request Example of error response." %}

```javascript
{
  "error": "NOT_SPECIFIED_AMOUNT"
}
```

{% endtab %}
{% endtabs %}


# Masternode

## Host a masternode

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/node/hosting`

This endpoint allows you to host new masternode.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name            | Type   | Description                    |
| --------------- | ------ | ------------------------------ |
| currencySymbol  | string | Must be "SYS"                  |
| collateralHash  | string | Hash of your collateral UTXO   |
| collateralIndex | number | Index of your collateral UTXO  |
| nodeName        | string | Name of your new masternode    |
| walletType      | string | "ledger" \| "trezor" \| "core" |

{% tabs %}
{% tab title="201 Masternode was successfully hosted." %}

```typescript
{
  id: string;
  ip: string;
  name: string;
  currencySymbol: string;
  createdAt: string;
  payoutFrequencySeconds: number | null;
  apr: string | null;
  instance: {
    version: string;
    status: string;
    uptimeSeconds: number | null;
    lastSeenAt: string | null;
  };
  address: {
    collateralAddress: string;
    collateralHash: string;
    collateralIndex: number;
    payeeAddress: string;
    balanceAmount: number;
    rewardsEarned: number;
    lastRewardAt: string | null;
  };
  settings: {
    walletType: 'ledger' | 'trezor' | 'core' | null;
  };
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```javascript
{
  "error": "INVALID_CURRENCY_SYMBOL"
}
```

{% endtab %}
{% endtabs %}

## Get UTXO

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/utxo/{address}`

This endpoint allows you to get list of all your collateral utxo.

#### Path Parameters

| Name                                      | Type   | Description             |
| ----------------------------------------- | ------ | ----------------------- |
| address<mark style="color:red;">\*</mark> | string | Your collateral address |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
[
  {
    hash: string;
    index: number;
  }
]
```

{% endtab %}
{% endtabs %}

## Get hosting state

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/state/{hash}-{index}`

This endpoint allows you to get hosting state of your collateral utxo.

#### Path Parameters

| Name                                    | Type   | Description                |
| --------------------------------------- | ------ | -------------------------- |
| hash<mark style="color:red;">\*</mark>  | string | Your collateral UTXO hash  |
| index<mark style="color:red;">\*</mark> | number | Your collateral UTXO index |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
{
  isAlreadyHosted: boolean;
  isAlreadyHostedOnAllnodes: boolean;
  isActivated: boolean;
  isBanned: boolean;
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "error": "INVALID_COLLATERAL_HASH_AND_INDEX"
}
```

{% endtab %}
{% endtabs %}

## Execute "protx register\_prepare" command and get output

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/node/{id}/deterministic/prepare`

This endpoint allows you to get results of "protx register\_submit" command executed on our full node.

#### Path Parameters

| Name                                 | Type   | Description                                                                  |
| ------------------------------------ | ------ | ---------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | Node you want to register. ID can be extracted from the “Get all nodes” call |

#### Query Parameters

| Name         | Type   | Description                              |
| ------------ | ------ | ---------------------------------------- |
| payeeAddress | string | Address for receiving masternode rewards |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200 " %}

```
{
  tx: string;
  collateralAddress: string;
  signMessage: string;
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "error": "INVALID_PAYEE_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Execute "protx register\_submit" command

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/node/{id}/deterministic/submit`

This endpoint allows you to execute "protx register\_submit" command on our full node with data provided through the API call. Registration in deterministic list will happen in 1 block after execution.

#### Path Parameters

| Name                                 | Type   | Description                                                                  |
| ------------------------------------ | ------ | ---------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | Node you want to register. ID can be extracted from the “Get all nodes” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name      | Type   | Description                                                      |
| --------- | ------ | ---------------------------------------------------------------- |
| signature | string | Signed "signMessage" from protx register\_prepare command output |
| tx        | string | "tx" from protx register\_prepare command output                 |

{% tabs %}
{% tab title="200 " %}

```
{
  hash: string;
}
```

{% endtab %}

{% tab title="400 " %}

```
{
  "error": "INVALID_SIGNATURE"
}
```

{% endtab %}
{% endtabs %}


# The Graph Staking

## Approve a token

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for approve tokens.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description         |
| ------------------------------------------------ | ------ | ------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "GRT"       |
| action<mark style="color:red;">\*</mark>         | string | Must be "approve"   |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "TOKEN_ALREADY_APPROVED"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Stake coins/tokens

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for staking coins/tokens to Allnodes indexer.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description         |
| ------------------------------------------------ | ------ | ------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "GRT"       |
| action<mark style="color:red;">\*</mark>         | string | Must be "stake"     |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address |
| amount<mark style="color:red;">\*</mark>         | string | Amount to delegate  |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_TOKENS"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Unbond coins/tokens

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for unbonding coins/tokens from Allnodes indexer.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description            |
| ------------------------------------------------ | ------ | ---------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "GRT"          |
| action<mark style="color:red;">\*</mark>         | string | Must be "unbond-stake" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address    |
| amount<mark style="color:red;">\*</mark>         | string | Amount to undelegate   |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_TOKENS"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}

## Withdraw stake (after unbonding period finished)

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get transaction params for withdraw stake from Allnodes indexer. \
\
**Unbonding period**: 28 epochs (28 days)

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description              |
| ------------------------------------------------ | ------ | ------------------------ |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "GRT"            |
| action<mark style="color:red;">\*</mark>         | string | Must be "withdraw-stake" |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address      |

{% tabs %}
{% tab title="200 Transaction params successfully generated." %}

```
{
  network: string;
  toAddress: string;
  amount: string;
  gasLimit: number;
  gasPrice: number;
  data: string;
}
```

{% endtab %}

{% tab title="400 Example of error response." %}

```
{
  "error": "NOT_ENOUGH_EPOCHS_PASSED"
}
```

{% endtab %}

{% tab title="404 Example of error response." %}

```
{
  "error": "INVALID_ADDRESS"
}
```

{% endtab %}
{% endtabs %}


# Tron Staking

Instructions: <https://help.allnodes.com/en/articles/8610811-tron-staking-api>

## Get votes

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get a list of all your votes for Tron validators.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description         |
| ------------------------------------------------ | ------ | ------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "TRX"       |
| action<mark style="color:red;">\*</mark>         | string | Must be "votes"     |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address |

{% tabs %}
{% tab title="200: OK " %}

```
[
  {
    voteAddress: string;
    voteCount: number;
  }
]
```

{% endtab %}
{% endtabs %}

## Freeze coins

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get a serialized unsigned transaction to freeze coins before staking.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                |
| ------------------------------------------------ | ------ | -------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "TRX"              |
| action<mark style="color:red;">\*</mark>         | string | Must be "freeze"           |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address        |
| amount<mark style="color:red;">\*</mark>         | number | Amount to freeze (integer) |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```
{
  visible: boolean;
  txID: string;
  raw_data_hex: string;
  raw_data: object;
}
```

{% endtab %}
{% endtabs %}

## Delegate coins

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get a serialized unsigned transaction for delegating staked coins to Allnodes validator.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                  |
| ------------------------------------------------ | ------ | ---------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "TRX"                |
| action<mark style="color:red;">\*</mark>         | string | Must be "delegate"           |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address          |
| amount<mark style="color:red;">\*</mark>         | number | Amount to delegate (integer) |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```
{
  visible: boolean;
  txID: string;
  raw_data_hex: string;
  raw_data: object;
}
```

{% endtab %}
{% endtabs %}

## Undelegate coins

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get a serialized unsigned transaction for undelegating staked coins from Allnodes validator.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                    |
| ------------------------------------------------ | ------ | ------------------------------ |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "TRX"                  |
| action<mark style="color:red;">\*</mark>         | string | Must be "undelegate"           |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address            |
| amount<mark style="color:red;">\*</mark>         | number | Amount to undelegate (integer) |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```
{
  visible: boolean;
  txID: string;
  raw_data_hex: string;
  raw_data: object;
}
```

{% endtab %}
{% endtabs %}

## Unfreeze coins

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get a serialized unsigned transaction to unfreeze coins after undelegating.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description                  |
| ------------------------------------------------ | ------ | ---------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "TRX"                |
| action<mark style="color:red;">\*</mark>         | string | Must be "unfreeze"           |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address          |
| amount<mark style="color:red;">\*</mark>         | number | Amount to unfreeze (integer) |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```
{
  visible: boolean;
  txID: string;
  raw_data_hex: string;
  raw_data: object;
}
```

{% endtab %}
{% endtabs %}

## Claim rewards

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/staking`

This endpoint allows you to get a serialized unsigned transaction for claiming rewards.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

#### Request Body

| Name                                             | Type   | Description               |
| ------------------------------------------------ | ------ | ------------------------- |
| currencySymbol<mark style="color:red;">\*</mark> | string | Must be "TRX"             |
| action<mark style="color:red;">\*</mark>         | string | Must be "claim"           |
| address<mark style="color:red;">\*</mark>        | string | Your wallet address       |
| amount<mark style="color:red;">\*</mark>         | number | Amount to claim (integer) |

{% tabs %}
{% tab title="200: OK Serialized transaction successfully generated." %}

```
{
  visible: boolean;
  txID: string;
  raw_data_hex: string;
  raw_data: object;
}
```

{% endtab %}
{% endtabs %}


