{
  "openapi": "3.0.0",
  "info": {
    "title": "Stakin Dashboard API",
    "version": "1.0.0",
    "description": "\n  <div>\n    <h3>Authenticating requests</h3>\n    <p>1. Go to the accounts page <a href=\"/account\" target=\"_blank\">account page</a>.</p>\n    <p>2. Generate/copy the API Key from the \"API Key\" section.</p>\n    <p>3. Once you have the API Key, you must pass it via the <code>X-API-Key</code> header on every request.</p>\n    <br />\n    <p>NOTE: If you want to play with the endpoints here in Swagger, you can configure the API Key by clicking the \"Authorize\" button.</p>\n    <h3>About addresses</h3>\n    <p>The address data returned by the endpoints is always associated with the account that the API Key belongs to. If you want to track a specific address, you should first add it to your account either through the Dashboard UI or via this API. This will enable us to optimize your data, keep it as up-to-date as possible, and track any issues related to the addresses.</p>\n    <p>The fields ending in <code>*Value</code> correspond to the value of the tokens in the currency configured under the account (which by default is USD).</p>\n  </div>\n"
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "ApiErrorResponse": {
        "properties": {
          "success": {
            "title": "ApiErrorResponse.success",
            "enum": [false],
            "type": "boolean"
          },
          "error": {
            "title": "ApiErrorResponse.error",
            "type": "string"
          }
        },
        "required": ["success", "error"],
        "additionalProperties": false,
        "title": "ApiErrorResponse",
        "type": "object"
      },
      "ApiAddressShort": {
        "properties": {
          "id": {
            "title": "ApiAddressShort.id",
            "type": "string"
          },
          "name": {
            "title": "ApiAddressShort.name",
            "type": "string"
          },
          "address": {
            "title": "ApiAddressShort.address",
            "type": "string"
          },
          "chainId": {
            "title": "ApiAddressShort.chainId",
            "type": "string"
          },
          "token": {
            "title": "ApiAddressShort.token",
            "type": "string"
          },
          "currency": {
            "title": "ApiAddressShort.currency",
            "type": "string"
          }
        },
        "required": ["id", "name", "address", "chainId", "token", "currency"],
        "additionalProperties": false,
        "title": "ApiAddressShort",
        "type": "object"
      },
      "ApiAddress": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiAddressShort"
          },
          {
            "properties": {
              "tokenValue": {
                "$ref": "#/components/schemas/MaybeValue",
                "title": "tokenValue",
                "description": "Then token value/price in the currency configured under the account.."
              },
              "date": {
                "title": "date",
                "description": "Represents the time the data was retrieved from the blockchain.",
                "type": "string"
              },
              "stakingInfo": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ApiStakingInfo",
                    "title": "stakingInfo"
                  },
                  {
                    "$ref": "#/components/schemas/ApiEthereumStakinInfo",
                    "title": "stakingInfo"
                  }
                ],
                "title": "stakingInfo"
              }
            },
            "required": ["tokenValue", "date", "stakingInfo"],
            "additionalProperties": false,
            "type": "object"
          }
        ],
        "title": "ApiAddress"
      },
      "ApiStakingInfo": {
        "properties": {
          "available": {
            "title": "ApiStakingInfo.available",
            "description": "The amount of tokens available to be staked/transferred",
            "type": "number"
          },
          "availableValue": {
            "$ref": "#/components/schemas/MaybeValue",
            "title": "ApiStakingInfo.availableValue",
            "description": "The amount of tokens available to be staked/transferred in the currency configured under the account.."
          },
          "total": {
            "title": "ApiStakingInfo.total",
            "description": "The total amount of tokens. Take into acount staked, available and rewards.",
            "type": "number"
          },
          "totalValue": {
            "$ref": "#/components/schemas/MaybeValue",
            "title": "ApiStakingInfo.totalValue",
            "description": "The total amount of tokens in the currency configured under the account.. Take into acount staked, available and rewards."
          },
          "totalRewards": {
            "title": "ApiStakingInfo.totalRewards",
            "description": "The total rewards obtained across all delegations.",
            "type": "number"
          },
          "totalRewardsValue": {
            "$ref": "#/components/schemas/MaybeValue",
            "title": "ApiStakingInfo.totalRewardsValue",
            "description": "The total rewards obtained across all delegations in the currency configured under the account.."
          },
          "totalStaked": {
            "title": "ApiStakingInfo.totalStaked",
            "description": "The total amount of tokens staked across all delegations.",
            "type": "number"
          },
          "totalStakedValue": {
            "$ref": "#/components/schemas/MaybeValue",
            "title": "ApiStakingInfo.totalStakedValue",
            "description": "The total amount of tokens staked across all delegations in the currency configured under the account.."
          },
          "delegations": {
            "items": {
              "$ref": "#/components/schemas/ApiDelegation",
              "title": "ApiStakingInfo.delegations.[]"
            },
            "title": "ApiStakingInfo.delegations",
            "type": "array"
          }
        },
        "required": [
          "available",
          "availableValue",
          "total",
          "totalValue",
          "totalRewards",
          "totalRewardsValue",
          "totalStaked",
          "totalStakedValue",
          "delegations"
        ],
        "additionalProperties": false,
        "title": "ApiStakingInfo",
        "type": "object"
      },
      "ApiEthereumStakinInfo": {
        "properties": {
          "totalStaked": {
            "title": "ApiEthereumStakinInfo.totalStaked",
            "type": "number"
          },
          "totalStakedValue": {
            "$ref": "#/components/schemas/MaybeValue",
            "title": "ApiEthereumStakinInfo.totalStakedValue"
          },
          "totalRewards": {
            "title": "ApiEthereumStakinInfo.totalRewards",
            "type": "number"
          },
          "totalRewardsValue": {
            "$ref": "#/components/schemas/MaybeValue",
            "title": "ApiEthereumStakinInfo.totalRewardsValue"
          },
          "total": {
            "title": "ApiEthereumStakinInfo.total",
            "type": "number"
          },
          "totalValue": {
            "$ref": "#/components/schemas/MaybeValue",
            "title": "ApiEthereumStakinInfo.totalValue"
          },
          "validatorStatus": {
            "title": "ApiEthereumStakinInfo.validatorStatus",
            "type": "string"
          }
        },
        "required": [
          "totalStaked",
          "totalStakedValue",
          "totalRewards",
          "totalRewardsValue",
          "total",
          "totalValue",
          "validatorStatus"
        ],
        "additionalProperties": false,
        "title": "ApiEthereumStakinInfo",
        "type": "object"
      },
      "ApiDelegation": {
        "properties": {
          "staked": {
            "title": "ApiDelegation.staked",
            "description": "The amount of tokens staked in the validator.",
            "type": "number"
          },
          "stakedValue": {
            "$ref": "#/components/schemas/MaybeValue",
            "title": "ApiDelegation.stakedValue",
            "description": "The amount of tokens staked in the validator in the currency configured under the account.."
          },
          "rewards": {
            "title": "ApiDelegation.rewards",
            "description": "The amount of as rewards obtained from the validator.",
            "type": "number"
          },
          "rewardsValue": {
            "$ref": "#/components/schemas/MaybeValue",
            "title": "ApiDelegation.rewardsValue",
            "description": "The amount of as rewards obtained from the validator in the currency configured under the account.."
          },
          "validatorAddress": {
            "title": "ApiDelegation.validatorAddress",
            "type": "string"
          },
          "validatorImgUrl": {
            "title": "ApiDelegation.validatorImgUrl",
            "nullable": true,
            "type": "string"
          },
          "validatorMoniker": {
            "title": "ApiDelegation.validatorMoniker",
            "nullable": true,
            "type": "string"
          },
          "validatorWebsiteUrl": {
            "title": "ApiDelegation.validatorWebsiteUrl",
            "nullable": true,
            "type": "string"
          },
          "validatorCommissionPercent": {
            "title": "ApiDelegation.validatorCommissionPercent",
            "nullable": true,
            "type": "number"
          }
        },
        "required": [
          "staked",
          "stakedValue",
          "rewards",
          "rewardsValue",
          "validatorAddress",
          "validatorImgUrl",
          "validatorMoniker",
          "validatorWebsiteUrl",
          "validatorCommissionPercent"
        ],
        "additionalProperties": false,
        "title": "ApiDelegation",
        "type": "object"
      },
      "CreateAddressInput": {
        "properties": {
          "chainId": {
            "title": "CreateAddressInput.chainId",
            "type": "string"
          },
          "address": {
            "title": "CreateAddressInput.address",
            "type": "string"
          },
          "name": {
            "title": "CreateAddressInput.name",
            "description": "Gives an arbitrary name to the address.",
            "type": "string"
          }
        },
        "required": ["chainId", "address"],
        "additionalProperties": false,
        "title": "CreateAddressInput",
        "type": "object"
      },
      "Chain": {
        "properties": {
          "id": {
            "title": "Chain.id",
            "type": "string"
          },
          "name": {
            "title": "Chain.name",
            "type": "string"
          }
        },
        "required": ["id", "name"],
        "additionalProperties": false,
        "title": "Chain",
        "type": "object"
      },
      "ApiChainAggregation": {
        "properties": {
          "token": {
            "title": "ApiChainAggregation.token",
            "type": "string"
          },
          "currency": {
            "title": "ApiChainAggregation.currency",
            "type": "string"
          },
          "tokenValue": {
            "$ref": "#/components/schemas/MaybeValue",
            "title": "ApiChainAggregation.tokenValue"
          },
          "chainId": {
            "title": "ApiChainAggregation.chainId",
            "description": "The chain aggregated.",
            "type": "string"
          },
          "addressesCount": {
            "title": "ApiChainAggregation.addressesCount",
            "type": "number"
          },
          "totalStaked": {
            "title": "ApiChainAggregation.totalStaked",
            "type": "number"
          },
          "totalStakedValue": {
            "$ref": "#/components/schemas/MaybeValue",
            "title": "ApiChainAggregation.totalStakedValue"
          },
          "totalRewards": {
            "title": "ApiChainAggregation.totalRewards",
            "type": "number"
          },
          "totalRewardsValue": {
            "$ref": "#/components/schemas/MaybeValue",
            "title": "ApiChainAggregation.totalRewardsValue"
          },
          "total": {
            "title": "ApiChainAggregation.total",
            "type": "number"
          },
          "totalValue": {
            "$ref": "#/components/schemas/MaybeValue",
            "title": "ApiChainAggregation.totalValue"
          }
        },
        "required": [
          "token",
          "currency",
          "tokenValue",
          "chainId",
          "addressesCount",
          "totalStaked",
          "totalStakedValue",
          "totalRewards",
          "totalRewardsValue",
          "total",
          "totalValue"
        ],
        "additionalProperties": false,
        "title": "ApiChainAggregation",
        "type": "object"
      },
      "ApiAddressesResponse": {
        "properties": {
          "data": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/ApiAddress",
                  "title": "ApiAddressesResponse.data.[]"
                },
                "title": "ApiAddressesResponse.data.[]",
                "type": "array"
              },
              {
                "items": {
                  "$ref": "#/components/schemas/ApiAddressShort",
                  "title": "ApiAddressesResponse.data.[]"
                },
                "title": "ApiAddressesResponse.data.[]",
                "type": "array"
              }
            ],
            "title": "ApiAddressesResponse.data"
          },
          "pagination": {
            "properties": {
              "offset": {
                "title": "ApiAddressesResponse.pagination.offset",
                "type": "number"
              },
              "limit": {
                "title": "ApiAddressesResponse.pagination.limit",
                "type": "number"
              },
              "total": {
                "title": "ApiAddressesResponse.pagination.total",
                "type": "number"
              }
            },
            "required": ["offset", "limit", "total"],
            "additionalProperties": false,
            "title": "ApiAddressesResponse.pagination",
            "type": "object"
          }
        },
        "required": ["data", "pagination"],
        "additionalProperties": false,
        "title": "ApiAddressesResponse",
        "type": "object"
      },
      "MaybeValue": {
        "title": "MaybeValue",
        "nullable": true,
        "type": "number"
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/api/v1/addresses/{addressId}": {
      "get": {
        "summary": "Get address by id",
        "description": "Get an address by its id. You can discover the address ids by calling the GET /api/v1/addresses?type=short endpoint.",
        "parameters": [
          {
            "in": "path",
            "name": "addressId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The address id"
          }
        ],
        "responses": {
          "200": {
            "description": "The address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiAddress"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Address not found"
          }
        }
      },
      "delete": {
        "summary": "Delete address by id",
        "parameters": [
          {
            "in": "path",
            "name": "addressId",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The address id"
          }
        ],
        "responses": {
          "204": {
            "description": "Address deleted"
          },
          "404": {
            "description": "Address not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/addresses": {
      "get": {
        "summary": "Get all addresses",
        "description": "Returns all addresses registered under the account. Pass the 'type' query parameter to get the full or short version of the addresses.",
        "parameters": [
          {
            "in": "query",
            "name": "chainId",
            "schema": {
              "type": "string"
            },
            "required": false,
            "description": "Filters addresses by chain id."
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string",
              "enum": ["full", "short"],
              "default": "full"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "number",
              "default": 0
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "number",
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "All addresses, either the full or short version depending of the 'type' query parameter.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiAddressesResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      },
      "post": {
        "summary": "Create an address",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAddressInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The address just created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiAddressShort"
                }
              }
            }
          },
          "400": {
            "description": "Bad request"
          },
          "403": {
            "description": "Unauthorized"
          },
          "405": {
            "description": "Method not allowed"
          },
          "409": {
            "description": "Conflict"
          }
        }
      }
    },
    "/api/v1/aggregations": {
      "get": {
        "summary": "Get chain aggregations",
        "responses": {
          "200": {
            "description": "Addresses data aggregated by chain.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApiChainAggregation"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/chains": {
      "get": {
        "summary": "Get all supported chains",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Chain"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/test-authorization": {
      "get": {
        "description": "You can test your API Key by calling this endpoint.",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    }
  },
  "tags": []
}
