> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yume.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Get history



## OpenAPI

````yaml /openapi/metrics.json get /v1/crm/metrics/discounts/history/
openapi: 3.0.3
info:
  title: Yume API — Аналитика
  version: 1.0.0
  description: Системные метрики, аналитика и отчётность.
servers:
  - url: https://api.yume.cloud
    description: Production
  - url: https://api.stage.yume.cloud
    description: Stage
security: []
paths:
  /v1/crm/metrics/discounts/history/:
    get:
      tags:
        - discounts
      summary: Get history
      operationId: discounts_history_list
      parameters:
        - name: ordering
          required: false
          in: query
          description: Which field to use when ordering the results.
          schema:
            type: string
        - name: page
          required: false
          in: query
          description: A page number within the paginated result set.
          schema:
            type: integer
        - name: pageSize
          required: false
          in: query
          description: Number of results to return per page.
          schema:
            type: integer
        - name: search
          required: false
          in: query
          description: A search term.
          schema:
            type: string
        - $ref: '#/components/parameters/TenantId'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedMetricsOrderDiscountHistoryList'
          description: ''
      security:
        - jwtAuth: []
components:
  parameters:
    TenantId:
      name: X-Tenant-Id
      in: header
      required: false
      schema:
        type: integer
      description: >-
        Компания, в контексте которой выполняется запрос — её id из `GET
        /v1/tenant/`. Пользователь должен состоять в этой компании: чужой id
        доступа к данным не даёт. Без заголовка компания определяется по домену
        запроса.
  schemas:
    PaginatedMetricsOrderDiscountHistoryList:
      type: object
      required:
        - count
        - results
      properties:
        count:
          type: integer
          example: 123
        next:
          type: string
          nullable: true
          format: uri
          example: http://api.example.org/accounts/?page=4
        previous:
          type: string
          nullable: true
          format: uri
          example: http://api.example.org/accounts/?page=2
        results:
          type: array
          items:
            $ref: '#/components/schemas/MetricsOrderDiscountHistory'
    MetricsOrderDiscountHistory:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        request:
          allOf:
            - $ref: '#/components/schemas/BaseOrderRequest'
          readOnly: true
        client:
          allOf:
            - $ref: '#/components/schemas/BaseClient'
          readOnly: true
        inventory:
          allOf:
            - $ref: '#/components/schemas/BaseInventory'
          readOnly: true
        created_at:
          type: string
          format: date-time
          readOnly: true
          title: Создан
        updated_at:
          type: string
          format: date-time
          readOnly: true
          title: Обновлен
        type:
          allOf:
            - $ref: '#/components/schemas/MetricsOrderDiscountHistoryTypeEnum'
          title: Тип
          minimum: -32768
          maximum: 32767
        discount_amount:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,2})?$
        start_at:
          type: string
          format: date
          nullable: true
          title: Начало периода
        end_at:
          type: string
          format: date
          nullable: true
          title: Конец периода
        scheduled:
          type: boolean
          title: По расписанию
        scheduled_amount:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,2})?$
          title: Сумма по расписанию
        destination:
          allOf:
            - $ref: '#/components/schemas/DestinationEnum'
          title: Применяется к
          minimum: -32768
          maximum: 32767
        reason:
          type: string
          nullable: true
          title: Причина
          maxLength: 512
        tenant:
          type: integer
        request_inventory:
          type: integer
          nullable: true
          title: Позиция аренды
        request_service:
          type: integer
          nullable: true
          title: Позиция услуги
        discount:
          type: integer
          nullable: true
          title: Скидка
        created_by:
          type: integer
          nullable: true
          title: Создал
      required:
        - client
        - created_at
        - id
        - inventory
        - request
        - updated_at
    BaseOrderRequest:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        status:
          allOf:
            - $ref: '#/components/schemas/BaseOrderRequestStatusEnum'
          title: Статус
          minimum: 0
          maximum: 32767
        rent_start:
          type: string
          format: date-time
          title: Начало аренды
        rent_fact_start:
          type: string
          format: date-time
          nullable: true
          title: Факт выдачи
        rent_end:
          type: string
          format: date-time
          title: Конец аренды
        rent_fact_end:
          type: string
          format: date-time
          nullable: true
          title: Факт возврата
        price:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,2})?$
        discount_amount:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,2})?$
        price_discount:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,2})?$
        price_inventory:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,2})?$
        price_service:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,2})?$
        discount_inventory_amount:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,2})?$
          title: Скидка на инвентарь
        discount_service_amount:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,2})?$
        payment_status:
          allOf:
            - $ref: '#/components/schemas/PaymentStatusEnum'
          title: Статус оплаты
          minimum: 0
          maximum: 32767
        paid_amount:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,2})?$
        penalty_amount:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,2})?$
        rental_point:
          type: integer
          nullable: true
          title: Точка проката
        created_at:
          type: string
          format: date-time
          readOnly: true
          title: Создан
        updated_at:
          type: string
          format: date-time
          readOnly: true
          title: Обновлен
        deleted:
          type: boolean
          title: Удалено
        plus_id:
          type: integer
          maximum: 9223372036854776000
          minimum: -9223372036854776000
          format: int64
          nullable: true
          title: Идентификатор Plus
        extra: {}
      required:
        - created_at
        - id
        - rent_end
        - rent_start
        - updated_at
    BaseClient:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        name:
          type: string
          title: Название
          maxLength: 512
        type:
          allOf:
            - $ref: '#/components/schemas/Type433Enum'
          title: Тип
          minimum: 0
          maximum: 2147483647
        avatar:
          type: string
          format: uri
          nullable: true
          title: Фото
        agreement_id:
          type: string
          readOnly: true
          nullable: true
        signed:
          type: boolean
        sign_date:
          type: string
          format: date
          nullable: true
        sign_expires:
          type: string
          format: date
          nullable: true
        phone:
          type: string
          title: Телефон
          maxLength: 32
        email:
          type: string
          format: email
          nullable: true
          maxLength: 254
        legal_type:
          nullable: true
          title: Форма организации
          minimum: 0
          maximum: 2147483647
          oneOf:
            - $ref: '#/components/schemas/LegalTypeEnum'
            - $ref: '#/components/schemas/NullEnum'
        extra:
          title: Доп. данные
      required:
        - agreement_id
        - id
        - name
        - phone
    BaseInventory:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        group:
          type: integer
          nullable: true
          title: Группа инвентаря
        name:
          type: string
          title: Название
          maxLength: 255
        unique_id:
          type: string
          nullable: true
          title: Артикул
          maxLength: 255
        category:
          type: integer
          nullable: true
          title: Категория
        image:
          type: string
          format: uri
          nullable: true
          title: Изображение
        extra:
          title: Доп. данные
        subleases:
          type: array
          items:
            $ref: '#/components/schemas/InventorySublease'
          readOnly: true
        state:
          type: integer
          nullable: true
          title: Состояние
        disabled:
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/DisabledEnum'
            - $ref: '#/components/schemas/NullEnum'
        rental_point:
          type: integer
          nullable: true
          title: Точка проката
      required:
        - id
        - name
        - subleases
    MetricsOrderDiscountHistoryTypeEnum:
      enum:
        - 0
        - 1
      type: integer
      description: |-
        * `0` - Из справочника
        * `1` - Разовая
    DestinationEnum:
      enum:
        - 0
        - 1
        - 2
        - 3
      type: integer
      description: |-
        * `0` - Аренда
        * `1` - Инвентарь
        * `2` - Услуга
        * `3` - Доставка
    BaseOrderRequestStatusEnum:
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
        - 5
        - 6
      type: integer
      description: |-
        * `0` - Запрос
        * `1` - Забронировано
        * `2` - В аренде
        * `3` - Отменено
        * `4` - Завершено
        * `5` - Должник
        * `6` - Просрочка
    PaymentStatusEnum:
      enum:
        - 0
        - 1
        - 2
      type: integer
      description: |-
        * `0` - Ожидается оплата
        * `1` - Оплата произведена
        * `2` - Частичная оплата
    Type433Enum:
      enum:
        - 0
        - 1
      type: integer
      description: |-
        * `0` - Физ. лицо
        * `1` - Юр. лицо
    LegalTypeEnum:
      enum:
        - 0
        - 1
        - 2
        - 3
      type: integer
      description: |-
        * `0` - ИП
        * `1` - ТОО
        * `2` - АО
        * `3` - ПК
    NullEnum:
      enum:
        - null
    InventorySublease:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        inventory:
          type: integer
          title: Инвентарь
        user:
          type: integer
          title: Владелец субаренды
        percent:
          type: string
          format: decimal
          pattern: ^-?\d{0,3}(?:\.\d{0,2})?$
          title: Процент субаренды
        start_at:
          type: string
          format: date-time
          nullable: true
          title: Начало периода
        end_at:
          type: string
          format: date-time
          nullable: true
          title: Конец периода
        is_current:
          type: boolean
          readOnly: true
        created_at:
          type: string
          format: date-time
          readOnly: true
          title: Создан
      required:
        - created_at
        - id
        - inventory
        - is_current
        - percent
        - user
    DisabledEnum:
      enum:
        - 0
        - 1
        - 2
      type: integer
      description: |-
        * `0` - удалить
        * `1` - Архив
        * `2` - Списано
  securitySchemes:
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````