> ## 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.

# Create subleases

> Правами субаренды заведует сам инвентарь.

До ленты владелец был полем `Inventory`, и редактировали его те, кому можно править
единицу. Гейт `crm.*_inventorysublease` не выдан ни одной роли, поэтому новая модель в
`models` заперла бы endpoint для всех, кроме суперпользователя.



## OpenAPI

````yaml /openapi/main.json post /v1/crm/subleases/
openapi: 3.0.3
info:
  title: Yume API — Основное
  version: 1.0.0
  description: Базовые сущности и бизнес-логика CRM.
servers:
  - url: https://api.yume.cloud
    description: Production
  - url: https://api.stage.yume.cloud
    description: Stage
security: []
paths:
  /v1/crm/subleases/:
    post:
      tags:
        - subleases
      summary: Create subleases
      description: >-
        Правами субаренды заведует сам инвентарь.


        До ленты владелец был полем `Inventory`, и редактировали его те, кому
        можно править

        единицу. Гейт `crm.*_inventorysublease` не выдан ни одной роли, поэтому
        новая модель в

        `models` заперла бы endpoint для всех, кроме суперпользователя.
      operationId: subleases_create
      parameters:
        - $ref: '#/components/parameters/TenantId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InventorySubleaseDetail'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/InventorySubleaseDetail'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/InventorySubleaseDetail'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InventorySubleaseDetail'
          description: ''
      security:
        - jwtAuth: []
components:
  parameters:
    TenantId:
      name: X-Tenant-Id
      in: header
      required: false
      schema:
        type: integer
      description: >-
        Компания, в контексте которой выполняется запрос — её id из `GET
        /v1/tenant/`. Пользователь должен состоять в этой компании: чужой id
        доступа к данным не даёт. Без заголовка компания определяется по домену
        запроса.
  schemas:
    InventorySubleaseDetail:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        inventory:
          type: integer
        user:
          type: integer
        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
  securitySchemes:
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````