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

# Загрузка Item в Item Set

> Добавляет файлы в указанный набор элементов (Item Set).

<Callout emoji="📌">
  Необходим <code>item\_set\_id</code> из предыдущего шага.
</Callout>


## OpenAPI

````yaml PATCH /item-set/upload?item_set_id={item_set_id}
openapi: 3.1.0
info:
  title: SpellIt API
  description: >-
    API для обработки Items через создание проекта, загрузку Item Set и загрузку
    Items
  version: 1.0.0
servers:
  - url: https://api.spellit.ai/api/
security: []
paths:
  /item-set/upload?item_set_id={item_set_id}:
    patch:
      summary: Загрузить файлы в Item Set
      description: Добавляет файлы в указанный набор элементов (Item Set).
      parameters:
        - name: item_set_id
          in: path
          description: >-
            Уникальный идентификатор набора элементов (item_set_id), полученный
            на предыдущем шаге
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItemUpload'
      responses:
        '200':
          description: Успешная загрузка Items
          content:
            application/json:
              schema:
                type: array
                items:
                  type: array
                  items:
                    type: object
              examples:
                default:
                  value:
                    - - id_item_type: 1
                        created_at: '2025-05-27T10:12:42.535350+00:00'
                        id_base_user: 1
                        id_item_set: 272
                        status: added
                        id: 274
                        name: filename_091c9f.mp3
                        item_link: filelink
                        last_processing_date: null
                      - id_item: 274
                        id_processor: 1
                        created_at: '2025-05-27T10:12:46.436176+00:00'
                        is_default: false
                        id: 440
                        processing_parameters:
                          file_duration: 553.392
        '400':
          description: Неверные параметры запроса
          content:
            application/json:
              example:
                detail: id_project is required
        '401':
          description: Ошибка аутентификации
          content:
            application/json:
              example:
                detail: Invalid auth
        '422':
          description: Ошибка валидации
          content:
            application/json:
              example:
                detail: Invalid input data
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
      x-code-samples:
        - lang: curl
          source: >-
            curl -X PATCH
            'https://api.spellit.ai/api/item-set/upload?item_set_id=123' \
              -H 'API-Access-Key: your-api-key' \
              -F 'files=@audio1.mp3'
        - lang: python
          source: |-
            import requests

            url = 'https://api.spellit.ai/api/item-set/upload?item_set_id=123'
            headers = {'API-Access-Key': 'your-api-key'}
            files = [('files', open('audio1.mp3', 'rb'))]

            response = requests.patch(url, headers=headers, files=files)
            print(response.json())
        - lang: javascript
          source: >-
            const formData = new FormData();

            formData.append('files', new Blob(['audio1.mp3']));


            fetch('https://api.spellit.ai/api/item-set/upload?item_set_id=123',
            {
              method: 'PATCH',
              headers: {
                'API-Access-Key': 'your-api-key'
              },
              body: formData
            })
              .then(response => response.json())
              .then(data => console.log(data));
components:
  schemas:
    ItemUpload:
      type: object
      required:
        - files
      description: Структура запроса для загрузки файлов (Item'ов) в указанный item_set.
      properties:
        files:
          type: array
          description: Массив файлов или объектов, представляющих собой элементы обработки.
          items:
            type: object
            description: >-
              Один элемент (Item), содержащий данные или метаданные для
              загрузки.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: API-Access-Key
      description: API-ключ для доступа к эндпоинтам
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT-токен для авторизации (Bearer Token)

````