{
  "openapi": "3.0.0",
  "info": {
    "title": "Stake Pool",
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "1.1.0"
  },
  "paths": {
    "/v1.1.0/stake-pool/health": {
      "$ref": "../Http/schema.json#/paths/Health"
    },
    "/v1.1.0/stake-pool/search": {
      "post": {
        "summary": "stake pool search",
        "operationId": "stakePoolSearch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchStakePoolRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "stake pools fetched",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "pageResults": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SearchStakePool"
                      }
                    },
                    "totalResultCount": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1.1.0/stake-pool/stats": {
      "post": {
        "summary": "stake pool stats",
        "operationId": "stakePoolStats",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StakePoolStats_body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stake pool stats fetched",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StakePoolStats"
                }
              }
            }
          },
          "400": {
            "description": "invalid request"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Undefined": {
        "required": [
          "__type"
        ],
        "type": "object",
        "properties": {
          "__type": {
            "type": "string",
            "enum": [
              "undefined"
            ]
          }
        }
      },
      "EpochRewards": {
        "type": "object",
        "required": [
          "activeStake",
          "epochLength",
          "epochNo",
          "leaderRewards",
          "memberActiveStake",
          "memberRewards",
          "pledge",
          "rewards"
        ],
        "properties": {
          "activeStake": {
            "$ref": "#/components/schemas/BigInt"
          },
          "epoch": {
            "type": "number"
          },
          "epochLength": {
            "type": "number"
          },
          "epochNo": {
            "type": "number"
          },
          "leaderRewards": {
            "$ref": "#/components/schemas/BigInt"
          },
          "memberActiveStake": {
            "$ref": "#/components/schemas/BigInt"
          },
          "memberROI": {
            "type": "number"
          },
          "memberRewards": {
            "$ref": "#/components/schemas/BigInt"
          },
          "pledge": {
            "$ref": "#/components/schemas/BigInt"
          },
          "rewards": {
            "$ref": "#/components/schemas/BigInt"
          }
        }
      },
      "StakePoolStats": {
        "type": "object",
        "properties": {
          "qty": {
            "type": "object",
            "properties": {
              "active": {
                "type": "number"
              },
              "retired": {
                "type": "number"
              },
              "retiring": {
                "type": "number"
              }
            }
          }
        }
      },
      "StakePoolStats_body": {
        "type": "object"
      },
      "SearchStakePoolRequest": {
        "required": [
          "pagination"
        ],
        "type": "object",
        "properties": {
          "epochRewards": {
            "type": "boolean"
          },
          "epochsLength": {
            "type": "number"
          },
          "filters": {
            "$ref": "#/components/schemas/SearchStakePoolRequest_filters"
          },
          "apyEpochsBackLimit": {
            "type": "number",
            "example": 10
          },
          "pagination": {
            "$ref": "#/components/schemas/SearchStakePoolRequest_pagination"
          }
        }
      },
      "IdentifierFilter": {
        "required": [
          "values"
        ],
        "type": "object",
        "properties": {
          "_condition": {
            "type": "string",
            "enum": [
              "and",
              "or"
            ]
          },
          "values": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IdentifierFilter_values"
            }
          }
        }
      },
      "SearchStakePool": {
        "required": [
          "cost",
          "id",
          "margin",
          "metrics",
          "owners",
          "pledge",
          "relays",
          "vrf"
        ],
        "type": "object",
        "properties": {
          "cost": {
            "$ref": "#/components/schemas/BigInt"
          },
          "epochRewards": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EpochRewards"
            }
          },
          "hexId": {
            "type": "string"
          },
          "margin": {
            "$ref": "#/components/schemas/Fraction"
          },
          "metadata": {
            "$ref": "#/components/schemas/StakePoolMetadata"
          },
          "metadataJson": {
            "$ref": "#/components/schemas/MetadataJson"
          },
          "metrics": {
            "$ref": "#/components/schemas/StakePoolMetrics"
          },
          "id": {
            "type": "string"
          },
          "owners": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pledge": {
            "$ref": "#/components/schemas/BigInt"
          },
          "relays": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StakePoolRelay"
            }
          },
          "rewardAccount": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/StakePoolStatus"
          },
          "vrf": {
            "type": "string"
          }
        }
      },
      "StakePoolRelay": {
        "type": "object",
        "properties": {
          "ipv4": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Undefined"
              },
              {
                "type": "string",
                "nullable": true
              }
            ]
          },
          "ipv6": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Undefined"
              },
              {
                "type": "string",
                "nullable": true
              }
            ]
          },
          "port": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Undefined"
              },
              {
                "type": "number",
                "nullable": true
              }
            ]
          },
          "dnsName": {
            "type": "string"
          },
          "hostname": {
            "type": "string"
          }
        }
      },
      "StakePoolMetadata": {
        "type": "object",
        "properties": {
          "ticker": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "homepage": {
            "type": "string"
          },
          "extDataUrl": {
            "type": "string"
          },
          "extSigUrl": {
            "type": "string"
          },
          "extVkey": {
            "type": "string"
          }
        }
      },
      "StakePoolMetrics": {
        "type": "object",
        "required": [
          "blocksCreated",
          "delegators",
          "lastRos",
          "livePledge",
          "ros",
          "saturation",
          "size",
          "stake"
        ],
        "properties": {
          "apy": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Undefined"
              },
              {
                "type": "number",
                "nullable": true
              }
            ]
          },
          "blocksCreated": {
            "type": "number"
          },
          "delegators": {
            "type": "number"
          },
          "lastRos": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Undefined"
              },
              {
                "type": "number",
                "nullable": true
              }
            ]
          },
          "livePledge": {
            "$ref": "#/components/schemas/BigInt"
          },
          "ros": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Undefined"
              },
              {
                "type": "number",
                "nullable": true
              }
            ]
          },
          "saturation": {
            "type": "number"
          },
          "size": {
            "$ref": "#/components/schemas/StakePoolMetricsSize"
          },
          "stake": {
            "$ref": "#/components/schemas/StakePoolMetricsStake"
          }
        }
      },
      "StakePoolMetricsStake": {
        "type": "object",
        "required": [
          "active",
          "live"
        ],
        "properties": {
          "active": {
            "$ref": "#/components/schemas/BigInt"
          },
          "live": {
            "$ref": "#/components/schemas/BigInt"
          }
        }
      },
      "StakePoolMetricsSize": {
        "type": "object",
        "required": [
          "active",
          "live"
        ],
        "properties": {
          "active": {
            "type": "number"
          },
          "live": {
            "type": "number"
          }
        }
      },
      "StakePoolStatus": {
        "type": "string",
        "enum": [
          "active",
          "activating",
          "retired",
          "retiring"
        ]
      },
      "Fraction": {
        "required": [
          "denominator",
          "numerator"
        ],
        "type": "object",
        "properties": {
          "numerator": {
            "type": "number"
          },
          "denominator": {
            "type": "number"
          }
        }
      },
      "BigInt": {
        "required": [
          "value",
          "__type"
        ],
        "type": "object",
        "properties": {
          "value": {
            "type": "string"
          },
          "__type": {
            "type": "string",
            "enum": [
              "bigint"
            ]
          }
        }
      },
      "SearchStakePoolRequest_filters": {
        "type": "object",
        "properties": {
          "_condition": {
            "type": "string",
            "enum": [
              "and",
              "or"
            ]
          },
          "identifier": {
            "$ref": "#/components/schemas/IdentifierFilter"
          },
          "pledgeMet": {
            "type": "boolean"
          },
          "status": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StakePoolStatus"
            }
          }
        }
      },
      "SearchStakePoolRequest_pagination": {
        "required": [
          "limit",
          "startAt"
        ],
        "type": "object",
        "properties": {
          "startAt": {
            "type": "number",
            "example": 1
          },
          "limit": {
            "type": "number",
            "example": 5
          }
        }
      },
      "IdentifierFilter_values": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "pool1euf2nh92ehqfw7rpd4s9qgq34z8dg4pvfqhjmhggmzk95gcd402"
          },
          "name": {
            "type": "string",
            "example": "Keiths PiTest"
          },
          "ticker": {
            "type": "string",
            "example": "KPIT"
          }
        }
      },
      "MetadataJson": {
        "type": "object",
        "properties": {
          "hash": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        }
      }
    }
  }
}
