{
 "openapi": "3.1.0",
 "info": {
  "title": "Реестр реестров: открытый API",
  "version": "1.0.0",
  "description": "Каталог государственных реестров России и проверка компании по ИНН. Только чтение, без ключа, CORS открыт. Лимит 120 запросов в минуту с IP, проверка по ИНН 6 в минуту. MCP для ИИ-агентов: POST https://reestr-reestrov.ru/api/mcp (streamable HTTP). API «Допуски контрагента» с ключом описан отдельно: https://reestr-reestrov.ru/api/v1/openapi.json",
  "contact": {
   "name": "ООО «Стадика»",
   "email": "info@stadika.ru",
   "url": "https://reestr-reestrov.ru/o-proekte/"
  },
  "license": {
   "name": "CC BY 4.0 (данные каталога)",
   "url": "https://creativecommons.org/licenses/by/4.0/"
  }
 },
 "servers": [
  {
   "url": "https://reestr-reestrov.ru"
  }
 ],
 "externalDocs": {
  "url": "https://reestr-reestrov.ru/open-data/#api",
  "description": "Описание на сайте"
 },
 "paths": {
  "/api/": {
   "get": {
    "operationId": "getIndex",
    "summary": "Индекс эндпоинтов",
    "responses": {
     "200": {
      "description": "Индекс",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/api/registries": {
   "get": {
    "operationId": "searchRegistries",
    "summary": "Поиск и фильтры по реестрам",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "description": "Слова для поиска",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "agency",
      "in": "query",
      "description": "id ведомства (через запятую)",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "category",
      "in": "query",
      "description": "biz, it, finance, property, people, health, edu, cert, prof, security",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "access",
      "in": "query",
      "description": "open, partial, closed",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "has_api",
      "in": "query",
      "description": "Только с API или платной выгрузкой",
      "schema": {
       "type": "boolean"
      }
     },
     {
      "name": "has_opendata",
      "in": "query",
      "description": "Только с открытыми данными",
      "schema": {
       "type": "boolean"
      }
     },
     {
      "name": "by_inn",
      "in": "query",
      "description": "Только с поиском по ИНН",
      "schema": {
       "type": "boolean"
      }
     },
     {
      "name": "law",
      "in": "query",
      "description": "id закона из /api/laws",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "okved",
      "in": "query",
      "description": "Код ОКВЭД 2: реестры, обязательные для этого вида деятельности",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "year_from",
      "in": "query",
      "description": "Создан не раньше",
      "schema": {
       "type": "integer"
      }
     },
     {
      "name": "year_to",
      "in": "query",
      "description": "Создан не позже",
      "schema": {
       "type": "integer"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "description": "Сколько вернуть",
      "schema": {
       "type": "integer",
       "default": 20,
       "maximum": 100
      }
     },
     {
      "name": "offset",
      "in": "query",
      "description": "Сдвиг",
      "schema": {
       "type": "integer",
       "default": 0
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Список",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/RegistryList"
        }
       }
      }
     },
     "429": {
      "description": "Превышен лимит, см. Retry-After"
     }
    }
   }
  },
  "/api/registries/{id}": {
   "get": {
    "operationId": "getRegistry",
    "summary": "Паспорт реестра",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "description": "id реестра",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Карточка",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Registry"
        }
       }
      }
     },
     "404": {
      "description": "Не найдено"
     },
     "429": {
      "description": "Превышен лимит, см. Retry-After"
     }
    }
   }
  },
  "/api/agencies": {
   "get": {
    "operationId": "listAgencies",
    "summary": "Ведомства",
    "responses": {
     "200": {
      "description": "Список",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/api/agencies/{id}": {
   "get": {
    "operationId": "getAgency",
    "summary": "Ведомство и его реестры",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "description": "id ведомства",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Ведомство",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Не найдено"
     },
     "429": {
      "description": "Превышен лимит, см. Retry-After"
     }
    }
   }
  },
  "/api/laws": {
   "get": {
    "operationId": "listLaws",
    "summary": "Законы",
    "responses": {
     "200": {
      "description": "Список",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/api/laws/{id}": {
   "get": {
    "operationId": "getLaw",
    "summary": "Закон и реестры по нему",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "description": "id закона, например 99-fz-2011",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Закон",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Не найдено"
     },
     "429": {
      "description": "Превышен лимит, см. Retry-After"
     }
    }
   }
  },
  "/api/scenarios": {
   "get": {
    "operationId": "listScenarios",
    "summary": "Подборки реестров под задачу",
    "responses": {
     "200": {
      "description": "Список",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/api/okved/{code}": {
   "get": {
    "operationId": "registriesForOkved",
    "summary": "Обязательные реестры для вида деятельности ОКВЭД 2",
    "parameters": [
     {
      "name": "code",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "example": "86.21"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Реестры",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Неверный код"
     }
    }
   }
  },
  "/api/check": {
   "get": {
    "operationId": "checkInn",
    "summary": "Проверка компании или ИП по ИНН (ЕГРЮЛ/ЕГРИП, МСП, Федресурс, операторы ПДн, РНП, лицензии)",
    "parameters": [
     {
      "name": "inn",
      "in": "query",
      "description": "10 или 12 цифр",
      "schema": {
       "type": "string"
      },
      "required": true
     }
    ],
    "responses": {
     "200": {
      "description": "Результат",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Check"
        }
       }
      }
     },
     "400": {
      "description": "Неверный ИНН"
     },
     "429": {
      "description": "Превышен лимит, см. Retry-After"
     }
    }
   }
  },
  "/api/mcp": {
   "post": {
    "operationId": "mcp",
    "summary": "MCP (Model Context Protocol), streamable HTTP, JSON-RPC 2.0. Инструменты: search_registries, get_registry, check_inn, registries_for_okved, list_agencies, list_sources, query_registry, check_permits",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object"
       },
       "example": {
        "jsonrpc": "2.0",
        "id": 1,
        "method": "tools/list"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON-RPC ответ",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "202": {
      "description": "Уведомление принято"
     }
    }
   }
  }
 },
 "components": {
  "schemas": {
   "RegistryBrief": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "short_name": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "agency": {
      "type": "string"
     },
     "agency_id": {
      "type": "string"
     },
     "category": {
      "type": "string"
     },
     "year": {
      "type": "integer"
     },
     "access": {
      "type": "string"
     },
     "has_api": {
      "type": "boolean"
     },
     "has_opendata": {
      "type": "boolean"
     },
     "by_inn": {
      "type": "boolean"
     },
     "check_url": {
      "type": "string"
     },
     "url": {
      "type": "string"
     }
    }
   },
   "RegistryList": {
    "type": "object",
    "properties": {
     "total": {
      "type": "integer"
     },
     "limit": {
      "type": "integer"
     },
     "offset": {
      "type": "integer"
     },
     "items": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/RegistryBrief"
      }
     }
    }
   },
   "Registry": {
    "allOf": [
     {
      "$ref": "#/components/schemas/RegistryBrief"
     },
     {
      "type": "object",
      "properties": {
       "law": {
        "type": "string"
       },
       "law_ref": {
        "type": "object"
       },
       "official_url": {
        "type": "string"
       },
       "category_name": {
        "type": "string"
       },
       "agency_info": {
        "type": "object"
       },
       "details": {
        "type": "string"
       }
      }
     }
    ]
   },
   "Check": {
    "type": "object",
    "properties": {
     "inn": {
      "type": "string"
     },
     "egrul": {
      "type": "object"
     },
     "msp": {
      "type": "object"
     },
     "bankrot": {
      "type": "object"
     },
     "pdn": {
      "type": "object"
     },
     "rnp": {
      "type": "object"
     },
     "lic": {
      "type": "object"
     },
     "fssp_url": {
      "type": "string"
     },
     "checked_at": {
      "type": "string"
     }
    }
   }
  }
 }
}
