Avito User API

# API для получения баланса кошелька пользователя, истории операций и инфорации об авторизованном пользователе Описание API произведено в формате [**Swagger 3.0**](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md). Вы можете использовать данный файл для ознакомления с методами API, а также для генерации базового кода для работы с API на удобном для вас языке программирования с помощью утилиты [**Swagger Codegen**](https://swagger.io/swagger-codegen/) или online сервиса [**Swagger Editor**](https://editor.swagger.io/). **Авито API для бизнеса предоставляется согласно [Условиям использования](https://www.avito.ru/legal/pro_tools/public-api).** По всем вопросам работы с API необходимо обращаться в Службу Поддержки профессиональных инструментов: телефон: +7 495 777-10-66 email: supportautoload@avito.ru # Типы авторизации Для использования данного API запрос должен быть авторизован. В данный момент API Авито использует следующие механизмы авторизации. Подробнее о каждом механизме и его назначении можно прочитать в соответствующем разделе.

Documentation

📖
Documentation
https://developers.avito.ru/api-catalog/accounts-hierarchy/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/ads/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/auction/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/auth/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/autoload/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/autostrategy/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/autoteka/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/avito-promo/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/calltracking/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/cpa/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/cpxpromo/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/delivery-sandbox/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/item/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/job/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/messenger/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/order-management/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/promotion/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/ratings/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/realty-reports/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/sbc-gateway/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/stock-management/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/str/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/tariff/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/trxpromo/documentation
📖
Documentation
https://developers.avito.ru/api-catalog/user/documentation

Specifications

OpenAPI Specification

avito-user-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  contact:
    email: supportautoload@avito.ru
  description: 'API для взаимодействия с иерархией аккаунтов в Авито

    **Авито API для бизнеса предоставляется согласно [Условиям использования](https://www.avito.ru/legal/pro_tools/public-api).**

    '
  title: Иерархия Аккаунтов Access User API
  version: '1'
servers:
- url: https://api.avito.ru/
tags:
- description: '# API для получения баланса кошелька пользователя, истории операций и инфорации об авторизованном пользователе

    Описание API произведено в формате [**Swagger 3.0**](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md).

    Вы можете использовать данный файл для ознакомления с методами API, а также для генерации базового кода для работы с API на удобном для вас языке программирования с помощью утилиты [**Swagger Codegen**](https://swagger.io/swagger-codegen/) или online сервиса [**Swagger Editor**](https://editor.swagger.io/).


    **Авито API для бизнеса предоставляется согласно [Условиям использования](https://www.avito.ru/legal/pro_tools/public-api).**

    По всем вопросам работы с API необходимо обращаться в Службу Поддержки профессиональных инструментов:

    <li>телефон: <b>+7 495 777-10-66</b></li>

    <li>email: <a href="mailto:supportautoload@avito.ru">supportautoload@avito.ru</a></li>


    # Типы авторизации


    Для использования данного API запрос должен быть авторизован. В данный момент API Авито использует следующие механизмы авторизации.


    <!-- ReDoc-Inject: <security-definitions> -->


    Подробнее о каждом механизме и его назначении можно прочитать в соответствующем разделе.

    '
  name: User
  x-displayName: Пользователь
paths:
  /core/v1/accounts/operations_history/:
    parameters:
    - $ref: '#/components/parameters/authHeader'
    post:
      description: 'Возвращает список операций пользователя (списания/пополнение кошелька - деньги и бонусы) за определенный временной период (задается пользователем)

        '
      operationId: postOperationsHistory
      requestBody:
        content:
          application/json:
            example:
              dateTimeFrom: '2020-04-01T00:00:00'
              dateTimeTo: '2020-04-08T00:00:00'
            schema:
              $ref: '#/components/schemas/RequestOperationsHistory'
      responses:
        '200':
          content:
            application/json:
              example:
                operations:
                - amountBonus: 0
                  amountRub: 119
                  amountTotal: 119
                  itemId: 1853257996
                  operationName: Резервирование средств. Услуга «Сделать XL объявлением» для объявления №1853257996
                  operationType: резервирование средств под услугу
                  serviceId: 16
                  serviceName: Сделать XL объявлением
                  serviceType: vas
                  updatedAt: '2020-04-27T10:51:50.012436+03:00'
              schema:
                $ref: '#/components/schemas/ResponseOperationsHistory'
          description: Успешный ответ
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/authError'
          description: Требуется аутентификация
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serviceError'
          description: Внутренняя ошибка метода API
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serviceUnavailableError'
          description: Метод API временно недоступен
      security:
      - AuthorizationCode:
        - user_operations:read
      - ClientCredentials: []
      summary: Получение истории операций пользователя
      tags:
      - User
  /core/v1/accounts/self:
    parameters:
    - $ref: '#/components/parameters/authHeader'
    get:
      description: 'Возвращает идентификатор пользователя и его регистрационные данные

        '
      operationId: getUserInfoSelf
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserInfoSelf'
          description: Успешный ответ
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/authError'
          description: Требуется аутентификация
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/forbiddenError'
          description: Неверный Token/Oauth Scope
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serviceError'
          description: Внутренняя ошибка метода API
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serviceUnavailableError'
          description: Метод API временно недоступен
      security:
      - AuthorizationCode:
        - user:read
      - ClientCredentials: []
      summary: Получение информации об авторизованном пользователе
      tags:
      - User
  /core/v1/accounts/{user_id}/balance/:
    parameters:
    - $ref: '#/components/parameters/authHeader'
    - $ref: '#/components/parameters/userId'
    get:
      description: 'Возвращает сумму реальных денежных средств в кошельке, а также сумму бонусных средств

        '
      operationId: getUserBalance
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Balance'
          description: Успешный ответ
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/authError'
          description: Требуется аутентификация
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/forbiddenError'
          description: Неверный Token/Oauth Scope
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
          description: Неверный user_id в запросе
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serviceError'
          description: Внутренняя ошибка метода API
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serviceUnavailableError'
          description: Метод API временно недоступен
      security:
      - AuthorizationCode:
        - user_balance:read
      - ClientCredentials: []
      summary: Получение баланса кошелька пользователя
      tags:
      - User
components:
  schemas:
    ResponseOperationsHistoryItem:
      properties:
        amountBonus:
          description: Сумма бонусов
          type: number
        amountRub:
          description: Сумма реальных денег
          type: number
        amountTotal:
          description: Сумма операции всего
          type: number
        itemId:
          description: ID объявления
          type: integer
        operationName:
          description: Название операции
          type: string
        operationType:
          description: Тип операции
          enum:
          - списание в счёт кредита
          - постоплата
          - внесение CPA аванса
          - возврат CPA аванса
          - аванс
          - возврат аванса
          - списание средств с кошелька в доход (не за оказанные услуги)
          - сжигание бонусов
          - резервирование под автостратегию
          - возврат зарезервированных средств под автостатегию на кошелек
          - резервирование средств под услугу
          - возврат зарзервированных средств на баланс кошелька
          - признание выручки
          - списание остатка
          - сторно
          - опротестовано
          - чарджбэк
          type: string
        paidAt:
          description: Дата/время оплаты операции
          type: string
        serviceId:
          description: Код типа услуги
          type: integer
        serviceName:
          description: Название конкретного типа услуги
          type: string
        serviceType:
          description: Тип услуги
          enum:
          - vas
          - perf_vas
          - lf
          - cv
          - tariff
          - subscription
          - cpa
          - bundle
          type: string
        updatedAt:
          description: Дата/время совершения операции
          type: string
      type: object
    serviceError:
      properties:
        error:
          properties:
            code:
              description: Код ошибки
              example: 500
              format: int32
              type: integer
            message:
              description: Описание ошибки
              example: Error while processing request. Please, contact support
              type: string
          required:
          - code
          - message
          type: object
      type: object
    Balance:
      properties:
        bonus:
          description: Сумма бонусных средств
          format: float
          type: number
        real:
          description: Сумма реальных денежных средств
          format: float
          type: number
      type: object
    serviceUnavailableError:
      properties:
        error:
          properties:
            code:
              description: Код ошибки
              example: 503
              format: int32
              type: integer
            message:
              description: Описание ошибки
              example: Service temporarily unavailable. Please, contact support
              type: string
          required:
          - code
          - message
          type: object
      type: object
    RequestOperationsHistory:
      properties:
        dateTimeFrom:
          description: Время выборки от. Не далее одного года в прошлое от текущего момента.
          format: date-time
          type: string
        dateTimeTo:
          description: Время выборки до (диапазон между dateTimeFrom и dateTimeTo должен быть не более одной недели)
          format: date-time
          type: string
      required:
      - dateTimeFrom
      - dateTimeTo
      type: object
    ResponseOperationsHistory:
      properties:
        result:
          properties:
            operations:
              items:
                $ref: '#/components/schemas/ResponseOperationsHistoryItem'
              type: array
          type: object
      type: object
    authError:
      properties:
        error:
          properties:
            code:
              description: Код ошибки
              example: 401
              format: int32
              type: integer
            message:
              description: Сообщение об ошибке
              example: Unauthorized
              type: string
          required:
          - code
          - message
          type: object
      type: object
    forbiddenError:
      properties:
        error:
          properties:
            code:
              description: Код ошибки
              example: 403
              format: int32
              type: integer
            message:
              description: Сообщение об ошибке
              example: Forbidden
              type: string
          required:
          - code
          - message
          type: object
      type: object
    notFoundError:
      properties:
        error:
          properties:
            code:
              description: Код ошибки
              example: 404
              format: int32
              type: integer
            message:
              description: Сообщение об ошибке
              example: Not found
              type: string
          required:
          - code
          - message
          type: object
      type: object
    UserInfoSelf:
      properties:
        email:
          description: Email пользователя
          example: example@domain.com
          type: string
        id:
          description: Идентификатор пользователя
          example: 94235311
          format: int32
          type: integer
        name:
          description: Имя пользователя
          example: Петр
          type: string
        phone:
          description: первый верифицированный телефон пользователя
          example: 71112223344
          type: string
        phones:
          description: все верифицированные номера телефонов
          items:
            example: '71112223344'
            type: string
          type: array
        profile_url:
          description: Ссылка на профиль пользователя
          example: https://avito.ru/user/7d04cdc3a12726eee72c6851c953ac54/profile
          type: string
      type: object
  parameters:
    authHeader:
      description: Токен для авторизации
      in: header
      name: Authorization
      required: true
      schema:
        example: Bearer ACCESS_TOKEN
        type: string
    userId:
      description: Идентификатор пользователя (клиента)
      in: path
      name: user_id
      required: true
      schema:
        format: int64
        type: integer
  securitySchemes:
    AuthorizationCode:
      description: Это API использует OAuth 2 с механизмом authorization_code. Используйте его для доступа к данным других пользователей при разработке стороннего приложения. [Подробнее](/api-catalog/auth/documentation#tag/ApplicationAccess)
      flows:
        authorizationCode:
          authorizationUrl: https://avito.ru/oauth
          scopes:
            ah:access: Взаимодействие с иерархией аккаунтов
          tokenUrl: https://api.avito.ru/token
      type: oauth2
    ClientCredentials:
      description: Это API использует OAuth 2 с механизмом client_credentials. Используйте его для доступа к возможностям своей личной учетной записи. [Подробнее](#tag/Access)
      flows:
        clientCredentials:
          scopes: {}
          tokenUrl: https://api.avito.ru/token
      type: oauth2