openapi: 3.0.2
info:
  title: API проверки плательщиков налога на профессиональный доход (НПД)
  description: |
    Сервис позволяет проверить является ли физическое лицо или ИП плательщиком налога на профессиональный доход по ИНН. Все запросы требуют указания ключа доступа (`key`).
  version: 1.0.0
servers:
  - url: https://parser-api.com/parser/nalog_npd_api
paths:
  /:
    get:
      summary: Проверка статуса плательщика НПД
      description: Для проверки статуса плательщика налога на профессиональный доход необходимо указать ИНН физического лица.
      parameters:
        - name: key
          in: query
          required: true
          schema:
            type: string
          description: Ключ доступа (обязательный).
        - name: inn
          in: query
          required: true
          schema:
            type: string
            pattern: '^\d{12}$'
          description: ИНН физического лица, 12 цифр (обязательный).
        - name: date
          in: query
          required: false
          schema:
            type: string
            format: date
          description: Дата, на которую запрашиваются данные в формате YYYY-MM-DD (необязательный, по умолчанию текущая дата).
      responses:
        '200':
          description: Успешная валидация и обработка запроса.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: integer
                    description: Флаг успешности выполнения запроса. При получении 0 сделайте повторный запрос сразу же или через несколько минут.
                    example: 1
                  found:
                    type: integer
                    enum:
                      - 0
                      - 1
                    description: Является ли запрошенный ИНН плательщиком налога на профессиональный доход. 1 - является, 0 - не является.
                    example: 1
              examples:
                isNpd:
                  value:
                    success: 1
                    found: 1
                notNpd:
                  value:
                    success: 1
                    found: 0
        '400':
          description: Ошибка валидации запроса.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Подробное описание ошибки.
                    example: Field inn 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
