{
  "openapi": "3.0.3",
  "info": {
    "title": "FastNEAR API - V0 Public Key Lookup",
    "version": "3.0.3",
    "description": "Fetch the account IDs that have registered a full-access public key, via the legacy V0 lookup path."
  },
  "paths": {
    "/v0/public_key/{public_key}": {
      "get": {
        "description": "Fetch the account IDs that have registered a full-access public key, via the legacy V0 lookup path.",
        "operationId": "lookup_by_public_key_v0",
        "parameters": [
          {
            "description": "NEAR public key or access-key handle in `ed25519:...`, `secp256k1:...`, `ml-dsa-65:...`, or `ml-dsa-65-hash:...` form.",
            "example": "ed25519:CCaThr3uokqnUs6Z5vVnaDcJdrfuTpYJHJWcAGubDjT",
            "in": "path",
            "name": "public_key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "account_ids": [
                    "root.near"
                  ],
                  "public_key": "ed25519:CCaThr3uokqnUs6Z5vVnaDcJdrfuTpYJHJWcAGubDjT"
                },
                "schema": {
                  "$ref": "#/components/schemas/PublicKeyLookupResponse"
                }
              }
            },
            "description": "Matching account IDs for the supplied full-access public key or access-key handle"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Bad Request"
          },
          "403": {
            "content": {
              "text/plain": {
                "example": "Invalid API key",
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "The supplied API key was not recognized."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Lookup full-access accounts by public key",
        "tags": [
          "public-key"
        ]
      }
    }
  },
  "servers": [
    {
      "description": "Mainnet",
      "url": "https://api.fastnear.com"
    },
    {
      "description": "Testnet",
      "url": "https://test.api.fastnear.com"
    }
  ],
  "security": [
    {},
    {
      "BearerAuth": []
    },
    {
      "ApiKeyAuth": []
    }
  ],
  "components": {
    "schemas": {
      "PublicKeyLookupResponse": {
        "additionalProperties": false,
        "properties": {
          "account_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "public_key": {
            "type": "string"
          }
        },
        "required": [
          "public_key",
          "account_ids"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "description": "FastNEAR API key as the `apiKey` query parameter. Handy for curl or clients that cannot set headers, but the key can end up in URLs, logs, and shell history.",
        "in": "query",
        "name": "apiKey",
        "type": "apiKey"
      },
      "BearerAuth": {
        "description": "FastNEAR API key as an `Authorization: Bearer` header. Preferred for backends, workers, and proxies because it keeps the key out of URLs and logs.",
        "scheme": "bearer",
        "type": "http"
      }
    }
  }
}
