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

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

Overwrite a recipe in place. The body is the whole recipe, not a patch: rules and parameters you omit are cleared.

The submitted recipe is validated exactly as a creation is, and re-pinned to today's signal vocabulary - a recipe follows the vocabulary it was last published against, so an edit is what moves it forward. Moving a recipe between `DRAFT`, `SHADOW`, `LIVE` and `INACTIVE` is this endpoint too.

The body is the whole recipe, not a patch: rules and parameters you omit are cleared. Read the recipe first if you are changing one field.

This is also how a recipe moves through its lifecycle - send the same body with a new `status` to promote a `SHADOW` recipe to `LIVE`, or to take a `LIVE` one back to `INACTIVE`.


## OpenAPI

````yaml put /v2/watch/management/recipes/{recipe_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/recipes/{recipe_id}:
    put:
      tags:
        - Watch
      summary: Replace a recipe
      description: >-
        **Beta.** The request and response shapes may still change.


        Overwrite a recipe in place. The body is the whole recipe, not a patch:
        rules and parameters you omit are cleared.


        The submitted recipe is validated exactly as a creation is, and
        re-pinned to today's signal vocabulary - a recipe follows the vocabulary
        it was last published against, so an edit is what moves it forward.
        Moving a recipe between `DRAFT`, `SHADOW`, `LIVE` and `INACTIVE` is this
        endpoint too.
      operationId: replaceWatchRecipe
      parameters:
        - name: recipe_id
          in: path
          required: true
          schema:
            type: string
            examples:
              - rcp_01jc0t6fwwfgfsq1md24mhyztj
          description: The recipe identifier.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WatchRecipeRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WatchRecipe'
        '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:
    WatchRecipeRequest:
      type: object
      properties:
        name:
          type: string
          maxLength: 128
          examples:
            - signup_proxy_abuse
        status:
          type: string
          enum:
            - DRAFT
            - SHADOW
            - LIVE
            - INACTIVE
          description: >
            Whether the recipe takes part in an evaluation, and whether its
            verdict counts.
             * `DRAFT` - Not yet in service. It does not evaluate.
             * `SHADOW` - Evaluates and is reported, so you can watch a threshold against live traffic before trusting it.
             * `LIVE` - Evaluates, and its verdict counts toward the evaluation-level answer.
             * `INACTIVE` - Taken back out of service. It does not evaluate.
          examples:
            - SHADOW
        threshold:
          type: integer
          format: int64
          description: >-
            The score at which the recipe flags. The weights of the rules that
            triggered are summed, and the recipe flags when the total reaches
            this value. A threshold of `0` flags every evaluation.
          examples:
            - 70
        rules:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/WatchRecipeRule'
          description: >-
            The rules this recipe scores over, with their weights. At least one
            is required.
        parameters:
          type: object
          additionalProperties:
            type: string
          description: >
            This recipe's configuration: keys and their values, referenced in an
            expression as `param.<key>`, fixed until the recipe is replaced. Use
            them for the country list or the limit a shared rule should apply
            here, so the same rule can serve two recipes tuned differently.


            A key is lower snake_case, at most 64 characters, and at most 32 may
            be declared. Values are strings - the only type either supports
            today.


            Every key needs a value. An empty value is refused - omit the key
            instead.
          examples:
            - blocked_countries: RU,BY
              max_attempts: '5'
      required:
        - name
        - status
        - threshold
        - rules
    WatchRecipe:
      type: object
      properties:
        id:
          type: string
          examples:
            - rcp_01jc0t6fwwfgfsq1md24mhyztj
          description: The recipe identifier. Reference it in a flow's `recipes` to run it.
        name:
          type: string
          examples:
            - signup_proxy_abuse
        status:
          type: string
          enum:
            - DRAFT
            - SHADOW
            - LIVE
            - INACTIVE
        threshold:
          type: integer
          format: int64
          examples:
            - 70
        rules:
          type: array
          items:
            $ref: '#/components/schemas/WatchRecipeRule'
        parameters:
          type: object
          additionalProperties:
            type: string
          examples:
            - blocked_countries: RU,BY
              max_attempts: '5'
      required:
        - id
        - name
        - status
        - threshold
        - rules
    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
    WatchRecipeRule:
      type: object
      description: >-
        One rule's place in a recipe - what it contributes to the score, and
        whether it can settle the verdict on its own.
      properties:
        rule_id:
          type: string
          examples:
            - rul_01jc0t6fwwfgfsq1md24mhyztj
          description: A rule you authored, or one from the managed listing.
        weight:
          type: integer
          format: int64
          examples:
            - 40
          description: >-
            What this rule adds to the recipe's score when it triggers. A rule
            that does not trigger, or that could not run, adds nothing.
        overrides:
          type: string
          enum:
            - PASS
            - FLAG
          description: >
            Makes this rule's outcome the recipe's verdict when it triggers,
            bypassing the score. Omit it in the ordinary case, where the rule
            contributes its weight and the total decides.


            It exists because a weighted score cannot express a certainty:
            saying "this alone is conclusive" through the weights means picking
            a number above every threshold the recipe might later be given,
            which stops being true the moment the threshold moves. The weight
            still applies and the score is still reported - an overriding rule
            overrides the conclusion, it does not erase the evidence.


            If overriding rules with different verdicts both trigger, `PASS`
            wins over `FLAG`, whatever the order of `rules`.
          examples:
            - FLAG
      required:
        - rule_id
        - weight
  securitySchemes:
    apiToken:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.