openapi: 3.0.2
info:
  title: API parser-api.com ГИБДД проверка авто
  description: Сервис поддерживает три типа запросов для проверки автомобилей через ГИБДД.
  version: 1.0.0
servers:
  - url: https://parser-api.com/parser/gibdd_api
tags:
  - name: Проверка автомобилей
    description: Запросы для проверки ДТП, розыска и ограничений автомобилей.

paths:
  /accident:
    get:
      tags:
        - Проверка автомобилей
      summary: Проверка на участие в ДТП
      description: Для проверки на участие в дорожно-транспортных происшествиях используйте следующий запрос.
      parameters:
        - name: key
          in: query
          required: true
          schema:
            type: string
          description: Ключ доступа к API.
        - name: vin
          in: query
          required: false
          schema:
            type: string
          description: VIN номер автомобиля.
        - name: bodyNumber
          in: query
          required: false
          schema:
            type: string
          description: Номер кузова.
        - name: chassisNumber
          in: query
          required: false
          schema:
            type: string
          description: Номер шасси.
      responses:
        '200':
          description: Успешный ответ
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: integer
                    description: Флаг успешного выполнения запроса (1 - успех).
                  accidents:
                    type: array
                    items:
                      type: object
                      properties:
                        model:
                          type: string
                          description: Модель.
                        mark:
                          type: string
                          description: Марка.
                        vehicleYear:
                          type: string
                          description: Год выпуска.
                        accidentType:
                          type: string
                          description: Тип ДТП.
                        regionName:
                          type: string
                          description: Регион ДТП.
                        vehicleDamageState:
                          type: string
                          description: Состояние.
                        accidentDatetime:
                          type: string
                          description: Дата и время ДТП.
                        damageSvg:
                          type: string
                          format: uri
                          description: SVG схема повреждений.
                        damageDescription:
                          type: array
                          items:
                            type: string
                          description: Описание повреждений.
                        vehicleSort:
                          type: string
                          description: Номер ТС в ДТП.
                        vehicleAmount:
                          type: string
                          description: Всего ТС в ДТП.
                        accidentPlace:
                          type: string
                          description: Место ДТП.
                        ownerOkopf:
                          type: string
                          description: Категория владельца.
              example:
                success: 1
                accidents:
                  - model: "Nexia"
                    mark: "DAEWOO"
                    vehicleYear: "2012"
                    accidentType: "Столкновение"
                    regionName: "Тульская область"
                    vehicleDamageState: "Повреждено"
                    accidentDatetime: "22.09.2016 07:50"
                    damageSvg: "https://parser-api.com/parser/gibdd_api/?damage_svg=01,08"
                    damageDescription: ["ПЕРЕДНИЙ БАМПЕР", "КАПОТ", "РЕШЕТКА РАДИАТОРА"]
                    vehicleSort: "1"
                    vehicleAmount: "2"
                    accidentPlace: "Краснодарский край, Краснодар, Карасунский"
                    ownerOkopf: "ФИЗИЧЕСКИЕ ЛИЦА"
        '400':
          $ref: '#/components/responses/ValidationError'
        '403':
          $ref: '#/components/responses/AccessError'

  /wanted:
    get:
      tags:
        - Проверка автомобилей
      summary: Проверка нахождения в розыске
      description: Для проверки нахождения в розыске используйте следующий запрос.
      parameters:
        - name: key
          in: query
          required: true
          schema:
            type: string
          description: Ключ доступа к API.
        - name: vin
          in: query
          required: false
          schema:
            type: string
          description: VIN номер автомобиля.
        - name: bodyNumber
          in: query
          required: false
          schema:
            type: string
          description: Номер кузова.
        - name: chassisNumber
          in: query
          required: false
          schema:
            type: string
          description: Номер шасси.
      responses:
        '200':
          description: Успешный ответ
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: integer
                    description: Флаг успешного выполнения запроса (1 - успех).
                  searches:
                    type: array
                    items:
                      type: object
                      properties:
                        region:
                          type: string
                          description: Регион розыска.
                        model:
                          type: string
                          description: Модель.
                        model_year:
                          type: string
                          description: Год выпуска.
                        search_date:
                          type: string
                          description: Дата начала розыска.
              example:
                success: 1
                searches:
                  - region: "город Санкт-Петербург"
                    model: "ВМW520D"
                    model_year: "2008"
                    search_date: "29.10.2016"
        '400':
          $ref: '#/components/responses/ValidationError'
        '403':
          $ref: '#/components/responses/AccessError'

  /restrict:
    get:
      tags:
        - Проверка автомобилей
      summary: Проверка наличия ограничений
      description: Для проверки наличия ограничений используйте следующий запрос.
      parameters:
        - name: key
          in: query
          required: true
          schema:
            type: string
          description: Ключ доступа к API.
        - name: vin
          in: query
          required: false
          schema:
            type: string
          description: VIN номер автомобиля.
        - name: bodyNumber
          in: query
          required: false
          schema:
            type: string
          description: Номер кузова.
        - name: chassisNumber
          in: query
          required: false
          schema:
            type: string
          description: Номер шасси.
      responses:
        '200':
          description: Успешный ответ
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: integer
                    description: Флаг успешного выполнения запроса (1 - успех).
                  restrictions:
                    type: array
                    items:
                      type: object
                      properties:
                        model:
                          type: string
                          description: Модель.
                        model_year:
                          type: string
                          description: Год выпуска.
                        restriction_date:
                          type: string
                          description: Дата наложения ограничения.
                        region:
                          type: string
                          description: Регион.
                        restriction_name:
                          type: string
                          description: Тип ограничения.
                        organization_name:
                          type: string
                          description: Кто наложил ограничение.
                        reasons:
                          type: string
                          description: Причины ограничения.
                        phone:
                          type: string
                          description: Контактный телефон.
                        gid:
                          type: string
                          description: Ключ ФИС ГИБДД-М.
              example:
                success: 1
                restrictions:
                  - model: "АФ 77А3ВJ"
                    model_year: "2012"
                    restriction_date: "23.10.2015"
                    region: "Белгородская область"
                    restriction_name: "Запрет на регистрационные действия"
                    organization_name: "Судебный пристав"
                    reasons: "Документ: 76981200/2327 от 20.03.2019, Иванов Иван Иванович, СПИ: 3270100000152, ИП: 3049/16/23027-ИП от 28.01.2016"
                    phone: "+7(111)552-11-11"
                    gid: "77#SP0004193780"
        '400':
          $ref: '#/components/responses/ValidationError'
        '403':
          $ref: '#/components/responses/AccessError'

components:
  schemas: {}
  responses:
    ValidationError:
      description: Ошибка валидации запроса
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
              error_code:
                type: integer
          example:
            error: "Empty vin"
            error_code: 40001
    AccessError:
      description: Ошибка ограничения доступа
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
              error_code:
                type: integer
          examples:
            InvalidAccessKey:
              value:
                error: "Invalid access key"
                error_code: 40301
            SubscriptionExpired:
              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