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



## OpenAPI

````yaml /openapi/document.json post /v2/documents/
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:
  /v2/documents/:
    post:
      summary: Create documents
      operationId: root_create
      parameters:
        - $ref: '#/components/parameters/TenantId'
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/DocumentV2'
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentV2'
          description: ''
      security:
        - jwtAuth: []
components:
  parameters:
    TenantId:
      name: X-Tenant-Id
      in: header
      required: false
      schema:
        type: integer
      description: >-
        Компания, в контексте которой выполняется запрос — её id из `GET
        /v1/tenant/`. Пользователь должен состоять в этой компании: чужой id
        доступа к данным не даёт. Без заголовка компания определяется по домену
        запроса.
  schemas:
    DocumentV2:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        uuid:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
        source:
          allOf:
            - $ref: '#/components/schemas/SourceEnum'
          default: 0
        created_by:
          type: integer
          readOnly: true
          nullable: true
        template:
          type: integer
          nullable: true
          title: Шаблон
        signed:
          type: boolean
          readOnly: true
          title: Подписано
        created_at:
          type: string
          format: date-time
          readOnly: true
          title: Создан
        updated_at:
          type: string
          format: date-time
          readOnly: true
          title: Обновлен
        content_type:
          type: string
          nullable: true
        object_id:
          type: integer
          nullable: true
        regenerate:
          type: boolean
          writeOnly: true
          default: false
        resign:
          type: boolean
          writeOnly: true
          default: false
        file:
          type: string
          format: uri
          writeOnly: true
        files:
          type: array
          items:
            $ref: '#/components/schemas/DocumentFile'
          readOnly: true
        signs:
          type: array
          items:
            $ref: '#/components/schemas/DocumentSign'
          readOnly: true
        content:
          type: string
          writeOnly: true
          nullable: true
        links:
          type: array
          items:
            $ref: '#/components/schemas/DocumentLink'
          readOnly: true
      required:
        - created_at
        - created_by
        - files
        - id
        - links
        - signed
        - signs
        - updated_at
        - uuid
    SourceEnum:
      enum:
        - 0
        - 1
      type: integer
      description: |-
        * `0` - Сформирован
        * `1` - Загружен
    DocumentFile:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        file:
          type: string
          format: uri
        type:
          allOf:
            - $ref: '#/components/schemas/Type36bEnum'
          minimum: 0
          maximum: 32767
        extra: {}
      required:
        - file
        - id
    DocumentSign:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        uuid:
          type: string
          format: uuid
          readOnly: true
        method:
          allOf:
            - $ref: '#/components/schemas/MethodEnum'
          minimum: 0
          maximum: 32767
        method_allowed:
          type: array
          items:
            type: integer
            maximum: 32767
            minimum: 0
        signer:
          allOf:
            - $ref: '#/components/schemas/Signer'
          readOnly: true
        status:
          allOf:
            - $ref: '#/components/schemas/StatusToEnum'
          minimum: 0
          maximum: 32767
        created_at:
          type: string
          format: date-time
          readOnly: true
          title: Создан
        updated_at:
          type: string
          format: date-time
          readOnly: true
          title: Обновлен
        stages:
          type: array
          items:
            $ref: '#/components/schemas/DocumentSignStage'
          readOnly: true
      required:
        - created_at
        - id
        - signer
        - stages
        - updated_at
        - uuid
    DocumentLink:
      type: object
      properties:
        content_type:
          type: string
          title: Имя класса модели
          readOnly: true
        content_type_label:
          type: string
          readOnly: true
        object_id:
          type: integer
          maximum: 9223372036854776000
          minimum: 0
          format: int64
          title: ID объекта
        role:
          allOf:
            - $ref: '#/components/schemas/RoleEnum'
          title: Роль
        role_label:
          type: string
          readOnly: true
        label:
          type: string
          readOnly: true
        url:
          type: string
          readOnly: true
      required:
        - content_type
        - content_type_label
        - label
        - object_id
        - role_label
        - url
    Type36bEnum:
      enum:
        - 0
        - 1
        - 2
        - 3
      type: integer
      description: |-
        * `0` - Оригинал
        * `1` - Наложение
        * `2` - Электронная подпись
        * `3` - Подпись
    MethodEnum:
      enum:
        - 0
        - 1
        - 2
      type: integer
      description: |-
        * `0` - Вручную
        * `1` - sms
        * `2` - eGov
    Signer:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        name:
          type: string
          maxLength: 255
        phone:
          type: string
          nullable: true
          maxLength: 32
        email:
          type: string
          format: email
          nullable: true
          maxLength: 254
        type:
          $ref: '#/components/schemas/SignerTypeEnum'
        outer_id:
          type: integer
          maximum: 9223372036854776000
          minimum: -9223372036854776000
          format: int64
          nullable: true
      required:
        - id
        - name
    StatusToEnum:
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
        - 5
      type: integer
      description: |-
        * `0` - черновик
        * `1` - готово
        * `2` - просмотр
        * `3` - подтверждение
        * `4` - отклонено
        * `5` - подписано
    DocumentSignStage:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        status_from:
          allOf:
            - $ref: '#/components/schemas/StatusToEnum'
          minimum: 0
          maximum: 32767
        status_to:
          allOf:
            - $ref: '#/components/schemas/StatusToEnum'
          minimum: 0
          maximum: 32767
        created_at:
          type: string
          format: date-time
          readOnly: true
        meta: {}
      required:
        - created_at
        - id
        - status_from
        - status_to
    RoleEnum:
      enum:
        - main
        - secondary
      type: string
      description: |-
        * `main` - Основная
        * `secondary` - Дополнительная
    SignerTypeEnum:
      enum:
        - company
        - client
      type: string
      description: |-
        * `company` - Компания
        * `client` - Клиент
  securitySchemes:
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````