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

# Upload file

> multipart 上传图片/视频/音频，返回公网 url。

Upload an image, video, or audio reference and get a public `url` you can pass into create-task requests.

### Auth

```http theme={null}
Authorization: Bearer <your API Key>
```

### Request

`multipart/form-data` with field name `file`.

| Limit | Details |
| - | - |
| Size | Max **32MB** |
| Images | `.jpg` `.jpeg` `.png` `.webp` `.gif` `.bmp` `.avif` `.heic` `.heif` |
| Videos | `.mp4` `.mov` `.webm` `.mkv` `.avi` `.m4v` |
| Audio | `.mp3` `.wav` `.m4a` `.aac` `.ogg` `.flac` `.opus` |

### Response fields

| Field | Type | Description |
| - | - | - |
| `url` | string | Public URL for `images` / `videos` / `audios` |
| `name` | string | Original filename |
| `media_type` | string | `image` / `video` / `audio` |
| `bytes` | int | File size in bytes |

### Example

```bash theme={null}
curl -X POST 'https://sigrunai.com/v1/files' \
  -H 'Authorization: Bearer sk_xxx' \
  -F 'file=@./ref.png'
```

Success response:

```json theme={null}
{
  "code": 20000,
  "msg": "ok",
  "data": {
    "url": "https://cdn.sigrunai.com/openapi/files/xxxxxxxx.png",
    "name": "ref.png",
    "media_type": "image",
    "bytes": 123456
  }
}
```


## OpenAPI

````yaml POST /v1/files
openapi: 3.1.0
info:
  title: AI Platform OpenAPI
  description: 异步图片与视频生成。创建后轮询 task_id；结果 URL 约保留 3 天。
  version: 1.0.0
servers:
  - url: https://sigrunai.com
    description: AI Platform 生产环境
security:
  - bearerAuth: []
paths:
  /v1/files:
    post:
      tags:
        - Common
      summary: 上传文件
      description: multipart 上传图片/视频/音频，返回公网 url。
      operationId: uploadFile
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
      responses:
        '200':
          description: 上传成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadResponse'
components:
  schemas:
    FileUploadResponse:
      type: object
      properties:
        code:
          type: integer
          example: 20000
        msg:
          type: string
        data:
          type: object
          properties:
            url:
              type: string
              format: uri
            name:
              type: string
            media_type:
              type: string
              enum:
                - image
                - video
                - audio
            bytes:
              type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 控制台创建的 API Key，格式：Bearer sk_xxx

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.