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

# Stop Video Stream Moderation

> Stop an active video stream processing task.

<Info>
  **Product**: Visual Intelligence — Live Video Content Moderation
  **Use case**: Real-time NSFW / violence / logo detection on a live video stream (RTMP/RTSP), results pushed to your callback every 5s
  **Mode**: Server-Pull (you give us a stream URL → we pull → results to your callback)
  **Host**: `https://mavi-backend.memories.ai/serve/api/v2`
  **Auth**: `Authorization: sk-mavi-...` (no `Bearer` prefix)
</Info>

<Warning>
  **Access Required**: To use this API endpoint, please contact us at [contact@memories.ai](mailto:contact@memories.ai) to enable stream processing features for your account.
</Warning>

This endpoint stops an active video stream processing task. Once stopped, no further callbacks will be sent, and resources will be released.

### Code Example

<CodeGroup>
  ```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}",
      "Content-Type": "application/json"
  }

  def stop_video_stream(task_id: str):
      url = f"{BASE_URL}/stream/stop"
      data = {"task_id": task_id}
      resp = requests.post(url, json=data, headers=HEADERS)
      return resp.json()

  # Usage example
  result = stop_video_stream("550e8400-e29b-41d4-a716-446655440000")
  print(result)
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios');

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

  const headers = {
      'Authorization': API_KEY,
      'Content-Type': 'application/json'
  };

  async function stopVideoStream(taskId) {
      const response = await axios.post(
          `${BASE_URL}/stream/stop`,
          { task_id: taskId },
          { headers }
      );
      return response.data;
  }

  // Usage example
  stopVideoStream('550e8400-e29b-41d4-a716-446655440000')
      .then(result => console.log(result));
  ```

  ```bash cURL theme={null}
  curl -X POST "https://mavi-backend.memories.ai/serve/api/v2/stream/stop" \
    -H "Authorization: sk-mavi-..." \
    -H "Content-Type: application/json" \
    -d '{
      "task_id": "550e8400-e29b-41d4-a716-446655440000"
    }'
  ```
</CodeGroup>

### Response

Returns the confirmation of the stopped stream.

<ResponseExample>
  ```json Response theme={null}
  {
    "code": 200,
    "message": "success",
    "data": {
      "task_id": "550e8400-e29b-41d4-a716-446655440000",
      "message": "Stream stopped successfully"
    }
  }
  ```

  ```json Callback Response theme={null}
  {
    "code": 200,
    "message": "SUCCESS",
    "data": {
      "status": 14,
      "message": "Stream stopped by user",
      "data": null,
      "token": null
    },
    "task_id": "f9c9b4caf3184ac4bcc46727d802e3d4"
  }
  ```
</ResponseExample>

### Request Parameters

| Parameter | Type   | Required | Description                                   |
| --------- | ------ | -------- | --------------------------------------------- |
| task\_id  | string | Yes      | The task ID returned when starting the stream |

### Response Parameters

| Parameter     | Type   | Description                                      |
| ------------- | ------ | ------------------------------------------------ |
| code          | string | Response code (200 indicates success)            |
| message       | string | Response message describing the operation result |
| data          | object | Response data object                             |
| data.task\_id | string | The task ID of the stopped stream                |
| data.message  | string | Confirmation message                             |

### Callback Response Parameters

A final callback is sent to your webhook URL after the stream is stopped.

| Parameter    | Type    | Description                             |
| ------------ | ------- | --------------------------------------- |
| code         | string  | Response code (200)                     |
| message      | string  | Response message ("SUCCESS")            |
| task\_id     | string  | The task ID of the stopped stream       |
| data         | object  | Wrapper object                          |
| data.status  | integer | Status code (14 indicates user stopped) |
| data.message | string  | "Stream stopped by user"                |
| data.data    | null    | No data for stop callbacks              |
| data.token   | null    | No token info for stop callbacks        |

### Important Notes

<Note>
  * **Immediate stop**: The stream stops immediately after this call
  * **Final callback**: A callback with status 14 is sent after stopping
  * **Resource cleanup**: All resources are automatically released
  * **No further charges**: No charges occur after the stream is stopped
  * **Safe to call**: Safe to call even if the stream has already ended
</Note>

### Error Responses

| HTTP Code | Description                        |
| --------- | ---------------------------------- |
| 400       | Invalid task\_id or task not found |
| 401       | Unauthorized - invalid API key     |
| 500       | Internal server error              |


## OpenAPI

````yaml visual-intelligence/stream/openapi.json POST /stream/stop
openapi: 3.0.0
info:
  title: Stream Processing API
  version: 2.0.0
  description: Real-time video and audio stream processing APIs
servers:
  - url: https://mavi-backend.memories.ai/serve/api/v2
    description: Production server
security: []
paths:
  /stream/stop:
    post:
      tags:
        - Video Stream
      summary: Stop Video Stream Moderation
      description: Stop an active video stream processing task
      operationId: stopVideoStream
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - task_id
              properties:
                task_id:
                  type: string
                  description: The task ID returned when starting the stream
                  example: 550e8400-e29b-41d4-a716-446655440000
      responses:
        '200':
          description: Stream stopped successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: 200
                  message:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      task_id:
                        type: string
                        example: 550e8400-e29b-41d4-a716-446655440000
                      message:
                        type: string
                        example: Stream stopped successfully
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````