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

# Split Video

> Split a video into multiple segments

<Info>
  **Product**: Visual Agents
  **Use case**: Managed endpoints powering Memories.ai's open-source video search and editing agents (queries, video clipping/editing, screenplay extraction)
  **Host**: `https://mavi-backend.memories.ai/serve/api/v2`
  **Auth**: `Authorization: sk-mavi-...` (no `Bearer` prefix)
</Info>

This endpoint splits a video asset into multiple smaller video segments. Unlike [Scene Detection](/visual-agents/video-clip) which only identifies scene boundaries (frame ranges), Video Split actually creates separate downloadable video files for each segment.

<Warning>
  This is an **async endpoint**. You must configure a webhook URL in [Webhooks Settings](https://api-platform.memories.ai/webhooks) before calling this endpoint, otherwise you will not receive the processing results. See [Webhooks Configuration Guide](/visual-intelligence/getting-started/webhooks) for details.
</Warning>

<Note>
  **Pricing:**

  * \$0.02/second of video
</Note>

### Code Examples

<CodeGroup>
  ```javascript fetch theme={null}
  const BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2";
  const API_KEY = "sk-mavi-...";

  const response = await fetch(`${BASE_URL}/video/split`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': API_KEY
    },
    body: JSON.stringify({
      asset_id: 're_657739295220518912'
    })
  });

  const data = await response.json();
  console.log(data);
  ```

  ```javascript axios theme={null}
  import axios from 'axios';

  const BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2";
  const API_KEY = "sk-mavi-...";

  const response = await axios.post(`${BASE_URL}/video/split`, {
    asset_id: 're_657739295220518912'
  }, {
    headers: {
      'Authorization': API_KEY
    }
  });

  console.log(response.data);
  ```

  ```python Python theme={null}
  import requests

  BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2"
  API_KEY = "sk-mavi-..."
  HEADERS = {
      "Authorization": f"{API_KEY}"
  }

  def video_split(asset_id):
      url = f"{BASE_URL}/video/split"
      data = {"asset_id": asset_id}
      response = requests.post(url, json=data, headers=HEADERS)
      return response.json()

  # Usage example
  result = video_split("re_657739295220518912")
  print(result)
  ```
</CodeGroup>

### Request Body

| Field     | Type   | Required | Description                 |
| --------- | ------ | -------- | --------------------------- |
| asset\_id | string | Yes      | The video asset ID to split |

### Response

Returns task information for the video split operation.

<ResponseExample>
  ```json Response theme={null}
  {
    "code": 200,
    "msg": "success",
    "data": {
      "task_id": "f432bc84bfd141d1b05c1d24af0abe6a"
    },
    "failed": false,
    "success": true
  }
  ```

  ```json Callback Response theme={null}
  {
    "code": 200,
    "message": "SUCCESS",
    "data": {
      "splits": [
        {
          "asset_id": "re_666934884455964673",
          "create_time": "1768468867505",
          "extension": "mp4",
          "file_size": 49164198,
          "modify_time": "1768468867505",
          "original_filename": "segment_video_79e54dd3_0000",
          "upload_status": "SUCCESS"
        },
        {
          "asset_id": "re_666934888084037633",
          "create_time": "1768468868370",
          "extension": "mp4",
          "file_size": 56074135,
          "modify_time": "1768468868370",
          "original_filename": "segment_video_79e54dd3_0001",
          "upload_status": "SUCCESS"
        },
        {
          "asset_id": "re_666934893062676481",
          "create_time": "1768468869557",
          "extension": "mp4",
          "file_size": 28377039,
          "modify_time": "1768468869557",
          "original_filename": "segment_video_79e54dd3_0002",
          "upload_status": "SUCCESS"
        }
      ]
    },
    "task_id": "41cf434821fd42368232b3d9ade53d2c"
  }
  ```
</ResponseExample>

### Response Parameters

| Parameter     | Type    | Description                                      |
| ------------- | ------- | ------------------------------------------------ |
| code          | string  | Response code indicating the result status       |
| msg           | string  | Response message describing the operation result |
| data          | object  | Response data object containing task information |
| data.task\_id | string  | Unique identifier of the video split task        |
| success       | boolean | Indicates whether the operation was successful   |
| failed        | boolean | Indicates whether the operation failed           |

### Callback Response Parameters

When the video splitting is complete, a callback will be sent to your configured webhook URL.

| Parameter                         | Type    | Description                                                                |
| --------------------------------- | ------- | -------------------------------------------------------------------------- |
| code                              | string  | Response code (200 indicates success)                                      |
| message                           | string  | Status message (e.g., "SUCCESS")                                           |
| data                              | object  | Response data object containing the split video segments                   |
| data.splits                       | array   | Array of video segment objects created from the original video             |
| data.splits\[].asset\_id          | string  | Unique asset ID for this video segment                                     |
| data.splits\[].create\_time       | string  | Creation timestamp in milliseconds                                         |
| data.splits\[].extension          | string  | File extension of the video segment (e.g., "mp4")                          |
| data.splits\[].file\_size         | integer | Size of the video segment in bytes                                         |
| data.splits\[].modify\_time       | string  | Last modification timestamp in milliseconds                                |
| data.splits\[].original\_filename | string  | Generated filename for the segment (format: segment\_video\_{id}\_{index}) |
| data.splits\[].upload\_status     | string  | Upload status of the segment (e.g., "SUCCESS")                             |
| task\_id                          | string  | The task ID associated with this video split request                       |

### Understanding the Callback Response

The callback response contains an array of video segments, each representing a portion of the original video with its own asset ID and metadata.

**Response Structure:**

```
callback_response
├── code: 200
├── message: "SUCCESS"
├── data
│   └── splits: [array of video segments]
│       └── [
│           {
│             asset_id: "re_666934884455964673",
│             create_time: "1768468867505",
│             extension: "mp4",
│             file_size: 49164198,
│             modify_time: "1768468867505",
│             original_filename: "segment_video_79e54dd3_0000",
│             upload_status: "SUCCESS"
│           },
│           {
│             asset_id: "re_666934888084037633",
│             create_time: "1768468868370",
│             extension: "mp4",
│             file_size: 56074135,
│             modify_time: "1768468868370",
│             original_filename: "segment_video_79e54dd3_0001",
│             upload_status: "SUCCESS"
│           },
│           ...
│         ]
└── task_id: "41cf434821fd42368232b3d9ade53d2c"
```

**How to access the data:**

* All video segments: `callback_response.data.splits`
* Number of segments: `callback_response.data.splits.length`
* First segment asset ID: `callback_response.data.splits[0].asset_id`
* First segment file size: `callback_response.data.splits[0].file_size`
* First segment filename: `callback_response.data.splits[0].original_filename`
* Task ID: `callback_response.task_id`

**Segment Filename Format:**
Each segment filename follows the pattern `segment_video_{id}_{index}`, where:

* `segment_video_` is the prefix for split video segments
* `{id}` is a unique identifier for this split operation
* `{index}` is the sequential segment number (0-indexed)

### Notes

* Video splitting is processed asynchronously
* Returns a task\_id that can be used to track the split progress
* Use the task\_id to query the status and results of video splitting
* Original video remains unchanged
* Useful for creating shorter clips from long videos


## OpenAPI

````yaml POST /video/split
openapi: 3.1.0
info:
  title: MAVI API Reference
  description: REST APIs for memory management, search, and entity operations
  version: v1.0.1
servers:
  - url: https://mavi-backend.memories.ai/serve/api/v2
security:
  - ApiKeyAuth: []
paths:
  /video/split:
    post:
      summary: Split Video
      operationId: video_split
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                asset_id:
                  type: string
                  description: The video asset ID to split
                  example: re_657739295220518912
              required:
                - asset_id
      responses:
        '200':
          description: Video split initiated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: 200
                    description: Response code indicating the result status
                  msg:
                    type: string
                    example: success
                    description: Response message describing the operation result
                  data:
                    type: object
                    properties:
                      task_id:
                        type: string
                        example: f432bc84bfd141d1b05c1d24af0abe6a
                        description: Unique identifier of the video split task
                    description: Response data object containing task information
                  success:
                    type: boolean
                    example: true
                    description: Indicates whether the operation was successful
                  failed:
                    type: boolean
                    example: false
                    description: Indicates whether the operation failed
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````