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

# Upload files

> Accept multipart files, spool them to disk, start background storage uploads, and return immediately with a batch_upload_id. Poll GET /files/upload/{batch_upload_id} until uploads complete before submitting a batch.

Accept one or more audio files as multipart form data. Files are spooled to disk immediately and uploaded to storage in the background. The response returns `202 Accepted` with a `batch_upload_id` you can poll until uploads finish.

## Example

```bash theme={"system"}
curl -X POST "https://api.soket.ai/files/upload" \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -F "files=@/absolute/path/audio1.wav" \
  -F "files=@/absolute/path/audio2.mp3"
```

## Typical response

```json theme={"system"}
{
  "batch_upload_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "accepted",
  "total_files": 2,
  "spool_seconds": 0.42,
  "files": [
    {
      "file_id": "1374132b-b5db-4ec3-9cf1-f61f982e89b0",
      "filename": "audio1.wav",
      "size_bytes": 1048576,
      "estimated_duration_seconds": 65.5,
      "upload_status": "pending"
    }
  ]
}
```

Poll `GET /files/upload/{batch_upload_id}` until all files reach `upload_status: "completed"` before calling `POST /batch`.


## OpenAPI

````yaml POST /files/upload
openapi: 3.0.3
info:
  title: Dhrith ASR API
  version: 1.0.0
  description: >-
    Upload audio, submit batches, track progress, and fetch merged transcription
    results.
servers:
  - url: https://api.soket.ai/transcribe
    description: Batch transcription, status, results, and download
  - url: https://api.soket.ai
    description: File upload and management
security:
  - bearerAuth: []
paths:
  /files/upload:
    servers:
      - url: https://api.soket.ai
    post:
      summary: Upload files
      description: >-
        Accept multipart files, spool them to disk, start background storage
        uploads, and return immediately with a batch_upload_id. Poll GET
        /files/upload/{batch_upload_id} until uploads complete before submitting
        a batch.
      operationId: uploadFiles
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - files
              properties:
                files:
                  type: array
                  items:
                    type: string
                    format: binary
                  description: One or more audio files
      responses:
        '202':
          description: Upload accepted; background upload in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadAcceptedResponse'
        '400':
          description: Invalid request or file exceeds size limit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    UploadAcceptedResponse:
      type: object
      properties:
        batch_upload_id:
          type: string
        status:
          type: string
          example: accepted
        total_files:
          type: integer
        spool_seconds:
          type: number
        files:
          type: array
          items:
            $ref: '#/components/schemas/UploadedFileSummary'
    ErrorResponse:
      type: object
      properties:
        detail:
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
    UploadedFileSummary:
      type: object
      properties:
        file_id:
          type: string
        filename:
          type: string
        size_bytes:
          type: integer
        estimated_duration_seconds:
          type: number
        upload_status:
          type: string
          enum:
            - pending
            - uploading
            - completed
            - failed
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````