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

# Update an SRT Flow

> Rename a stream flow or bring its endpoint online or offline.

## Overview

Updates a flow. Only `label` and `active` can be changed. To change a flow's
mode, URLs, or failover setup, delete it and create a new one.

Setting `active` controls whether the flow's SRT endpoint is online. Inactive
flows keep their URLs and key, so you can take an endpoint offline between
events without reconfiguring your encoders.

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH "https://client.camb.ai/apis/flows/42" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "active": false }'
  ```

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

  response = requests.patch(
      "https://client.camb.ai/apis/flows/42",
      headers={"x-api-key": "YOUR_API_KEY"},
      json={"active": False},
  )

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

## Errors

* `404` - No flow with this ID belongs to your team.
* `422` - Validation error (e.g. a `label` already used by another of your team's flows).

## Related endpoints

* [Create an SRT Flow](create-flow)
* [Get an SRT Flow](get-flow)
* [Delete an SRT Flow](delete-flow)


## OpenAPI

````yaml patch /flows/{flow_id}
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://client.camb.ai/apis
security: []
paths:
  /flows/{flow_id}:
    patch:
      tags:
        - Apis
        - Streaming
      summary: Update Flow
      description: Rename a flow or bring its relay online/offline.
      operationId: update_flow_flows__flow_id__patch
      parameters:
        - name: flow_id
          in: path
          required: true
          schema:
            type: integer
            title: Flow Id
          description: Identifier of the flow.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FlowUpdateIn'
            example:
              active: false
      responses:
        '200':
          description: The updated flow.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlowOut'
        '404':
          description: Flow not found.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    FlowUpdateIn:
      type: object
      title: FlowUpdateIn
      description: >-
        Partial update of a flow. Only `label` and `active` can change; to
        change URLs, mode or failover, delete and recreate the flow.
      properties:
        label:
          anyOf:
            - type: string
            - type: 'null'
          title: Label
          description: New label (unique within your team).
        active:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Active
          description: >-
            Set `true` to bring the flow's relay online, `false` to take it
            offline.
    FlowOut:
      type: object
      title: FlowOut
      properties:
        id:
          type: integer
          title: ID
          description: Flow identifier.
        label:
          type: string
          title: Label
        mode:
          $ref: '#/components/schemas/FlowMode'
        failover:
          type: boolean
          title: Failover
        active:
          type: boolean
          title: Active
          description: Whether the flow's relay is currently online.
        team_id:
          type: integer
          title: Team ID
        key:
          type: string
          title: Key
          description: Access key embedded in the flow's URLs.
        play_url:
          type: string
          title: Play URL
          description: >-
            SRT URL the flow serves. Use it as `source_stream.url` or as a
            `target_streams[].url`, or play it directly.
        push_urls:
          type: array
          items:
            $ref: '#/components/schemas/PushUrl'
          title: Push URLs
          description: SRT URLs to push into (listener mode). Empty for caller flows.
        passphrase:
          anyOf:
            - type: string
            - type: 'null'
          title: Passphrase
          description: The flow's SRT encryption passphrase, when one is set.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    FlowMode:
      type: string
      enum:
        - caller
        - listener
      title: FlowMode
      description: >-
        `caller`: Camb.ai connects out to your SRT endpoint (`primary_url`) and
        re-serves it. `listener`: Camb.ai hosts an SRT endpoint that your
        encoder pushes to.
    PushUrl:
      type: object
      title: PushUrl
      properties:
        role:
          type: string
          enum:
            - primary
            - backup
          title: Role
          description: Which leg of the flow this URL feeds.
        url:
          type: string
          title: URL
          description: SRT URL to push to.
    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.

````