openapi: 3.0.2
info:
  title: API поиска ИНН физических лиц
  description: Сервис позволяет найти ИНН физического лица по паспортным данным. Все запросы требуют указания ключа доступа (`key`).
  version: 1.0.0
servers:
  - url: https://parser-api.com/parser/nalog_inn_api
paths:
  /:
    get:
      summary: Поиск ИНН по паспортным данным
      description: Для поиска ИНН физического лица необходимо указать ФИО, дату рождения и паспортные данные.
      parameters:
        - name: key
          in: query
          required: true
          schema:
            type: string
          description: Ключ доступа (обязательный).
        - name: firstName
          in: query
          required: true
          schema:
            type: string
          description: Имя (обязательный).
        - name: patronymic
          in: query
          required: false
          schema:
            type: string
          description: Отчество (необязательный).
        - name: lastName
          in: query
          required: true
          schema:
            type: string
          description: Фамилия (обязательный).
        - name: dob
          in: query
          required: true
          schema:
            type: string
            format: date
          description: Дата рождения в формате YYYY-MM-DD (обязательный).
        - name: passportSeries
          in: query
          required: true
          schema:
            type: string
            pattern: '^\d{4}$'
          description: Серия паспорта, 4 цифры (обязательный).
        - name: passportNumber
          in: query
          required: true
          schema:
            type: string
            pattern: '^\d{6}$'
          description: Номер паспорта, 6 цифр (обязательный).
      responses:
        '200':
          description: Успешная валидация и обработка запроса.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: integer
                    description: Флаг успешности выполнения запроса. При получении 0 сделайте повторный запрос сразу же или через несколько минут.
                    example: 1
                  inn:
                    type: string
                    description: ИНН физического лица.
                    example: "240135834492"
              examples:
                success:
                  value:
                    success: 1
                    inn: "240135834492"
        '400':
          description: Ошибка валидации запроса.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Подробное описание ошибки.
                    example: Field firstName is required
                  error_code:
                    type: integer
                    description: Код ошибки.
                    example: 40001
        '403':
          description: Ограничение доступа к сервису.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Подробное описание ошибки.
                    example: Invalid access key
                  error_code:
                    type: integer
                    description: Код ошибки.
                    example: 40301
              examples:
                invalidKey:
                  value:
                    error: Invalid access key
                    error_code: 40301
                expiredSubscription:
                  value:
                    error: The subscription period has expired
                    error_code: 40302
                invalidIP:
                  value:
                    error: Invalid IP
                    error_code: 40303
                dayLimitExceeded:
                  value:
                    error: Day limit of requests exceeded
                    error_code: 40304
                monthLimitExceeded:
                  value:
                    error: Month limit of requests exceeded
                    error_code: 40305
