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

# Delete a Stream

> Delete a stream, stopping it if it is live.

## Overview

Deletes a stream. If the stream is live, processing stops and outputs are
finalised; a scheduled stream is cancelled. The stream's status becomes `4`
(ended).

Deleting does not erase the stream's history: you can still call
[`GET /stream/{stream_id}`](get-stream-status) afterwards to read its final
state. Streams stop on their own at their `end_time`; use this endpoint to end
one earlier.

<Note>
  A deleted stream cannot be restarted. To run the same setup again, create a
  new stream with the same payload, or use [flows](create-flow) as your
  endpoints so encoders and viewers keep the same URLs across runs.
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE "https://client.camb.ai/apis/stream/1234" \
    -H "x-api-key: YOUR_API_KEY"
  ```

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

  response = requests.delete(
      "https://client.camb.ai/apis/stream/1234",
      headers={"x-api-key": "YOUR_API_KEY"},
  )

  response.raise_for_status()
  print(response.json())
  ```
</RequestExample>

## Errors

* `404` - No stream with this ID belongs to your team.
* `422` - Invalid `stream_id`.

## Related endpoints

* [Create a Stream](create-new-stream)
* [Get Stream Status](get-stream-status)
* [Update a Stream](update-stream)


## OpenAPI

````yaml delete /stream/{stream_id}
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://client.camb.ai/apis
security: []
paths:
  /stream/{stream_id}:
    delete:
      tags:
        - Apis
        - Streaming
      summary: Delete Stream
      description: >-
        Delete a stream. If the stream is live, processing stops and outputs are
        finalised; a scheduled stream is cancelled. The stream's status becomes
        `4` (ended) and its record remains readable via `GET
        /stream/{stream_id}`. A deleted stream cannot be restarted.
      operationId: destroy_stream_stream__stream_id__delete
      parameters:
        - name: stream_id
          in: path
          required: true
          schema:
            type: integer
            title: Stream Id
          description: Identifier of the stream to delete.
      responses:
        '200':
          description: Deletion confirmation.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Delete Stream Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        The `x-api-key` is a custom header required for authenticating requests
        to our API. Include this header in your request with the appropriate API
        key value to securely access our endpoints. You can find your API key(s)
        in the 'API' section of our studio website.

````