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

# Replace a flow

> **Beta.** The request and response shapes may still change.

Overwrite a flow in place. The body is the whole flow, not a patch: the `recipes` you send replace the existing references entirely.

The flow identifier does not change, so a flow already wired into your product can have its recipes swapped without touching the calling code.

The body is the whole flow: the `recipes` you send replace the existing references entirely, so send the full list even when adding one.

The identifier doesn't change. This is what makes a flow the right thing to hard-code in your product - you can retire a recipe, add a shadow one beside it, or reorder the references without a deploy on your side.

Replacing a flow that does not exist answers `404` rather than creating it.


## OpenAPI

````yaml put /v2/watch/management/flows/{flow_id}
openapi: 3.1.0
info:
  title: Prelude API
  version: 2.0.0
  description: The Prelude API allows you to send messages to your users.
  contact:
    email: support@prelude.so
servers:
  - url: https://api.prelude.dev
    description: Production server
security:
  - apiToken: []
tags:
  - name: Notify
    description: Send transactional and marketing messages with compliance enforcement.
  - name: Transactional
    description: Send transactional messages (deprecated - use Notify API instead).
  - name: Verify
    description: Verify phone numbers.
  - name: Watch
    description: Evaluate email addresses and phone numbers for trustworthiness.
  - name: Lookup
    description: >-
      Retrieve detailed information about a phone number including carrier data,
      line type, and portability status.
paths:
  /v2/watch/management/flows/{flow_id}:
    put:
      tags:
        - Watch
      summary: Replace a flow
      description: >-
        **Beta.** The request and response shapes may still change.


        Overwrite a flow in place. The body is the whole flow, not a patch: the
        `recipes` you send replace the existing references entirely.


        The flow identifier does not change, so a flow already wired into your
        product can have its recipes swapped without touching the calling code.
      operationId: replaceWatchFlow
      parameters:
        - name: flow_id
          in: path
          required: true
          schema:
            type: string
            examples:
              - flo_01jc0t6fwwfgfsq1md24mhyztj
          description: The flow identifier.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WatchFlowRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WatchFlow'
        '400':
          description: KO
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    WatchFlowRequest:
      type: object
      properties:
        name:
          type: string
          maxLength: 128
          description: The moment this flow guards.
          examples:
            - signup
        recipes:
          type: array
          minItems: 1
          items:
            type: string
          description: >-
            The recipes that run when this flow is evaluated. At least one is
            required, and each must exist.
          examples:
            - - rcp_01jc0t6fwwfgfsq1md24mhyztj
      required:
        - name
        - recipes
    WatchFlow:
      type: object
      properties:
        id:
          type: string
          examples:
            - flo_01jc0t6fwwfgfsq1md24mhyztj
          description: The flow identifier. Pass it as `flow_id` when you evaluate.
        name:
          type: string
          examples:
            - signup
        recipes:
          type: array
          items:
            type: string
          examples:
            - - rcp_01jc0t6fwwfgfsq1md24mhyztj
      required:
        - id
        - name
        - recipes
    Error:
      type: object
      properties:
        code:
          type: string
          description: The error code.
          examples:
            - invalid_phone_number
        message:
          type: string
          examples:
            - >-
              The provided phone number is invalid. Provide a valid E.164 phone
              number.
          description: A human-readable message describing the error.
        type:
          type: string
          examples:
            - bad_request
          description: The error type.
        request_id:
          type: string
          examples:
            - 3d19215e-2991-4a05-a41a-527314e6ff6a
          description: >-
            A string that identifies this specific request. Report it back to us
            to help us diagnose your issues.
        param:
          type: string
          examples:
            - phone_number
          description: The parameter the error refers to, when it applies to a single one.
      required:
        - code
        - message
        - type
  securitySchemes:
    apiToken:
      type: http
      scheme: bearer

````