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

# Deprecate Flow

> Retires a Flow from circulation on Meta without deleting it, and without deleting the responses people already submitted. Not the same as `DELETE /v1/flows/{id}`: delete works only on a `DRAFT` and removes the row; deprecate acts on a Flow that reached Meta and only marks it.

`supersededByFlowId` closes the pair with `clonedFromFlowId`: the clone points backwards, the deprecation forwards. Since publishing is irreversible, that pointer is the only thing tying the versions of one form together over time.

`supersededBy` is echoed in the response **always**, `null` included — it is the only way to tell "the successor I sent was recorded" from "the field was dropped between my client and the row". A truncated body is 400, not an empty one, because an empty body is a legitimate request here. Permission `flows:manage`.

**Requires a number-scoped key.** A tenant-scoped key must name the number with the `x-whatsapp-number-id` header, or it gets 403 `TENANT_SCOPE_NOT_ALLOWED`.



## OpenAPI

````yaml openapi.json POST /v1/flows/{id}/deprecate
openapi: 3.1.0
info:
  title: Pilot Status API
  version: 1.0.0
  license:
    name: Pilot Status Terms of Service
    url: https://pilotstatus.com.br/terms
  description: >-
    Public REST API for Pilot Status. Authenticate with the `x-api-key: ps_...`
    header (or `x-api-key-id`). Base URL: https://pilotstatus.com.br
servers:
  - url: https://pilotstatus.com.br
security:
  - apiKey: []
  - apiKeyId: []
paths:
  /v1/flows/{id}/deprecate:
    post:
      tags:
        - Flows
      summary: Deprecate Flow
      description: >-
        Retires a Flow from circulation on Meta without deleting it, and without
        deleting the responses people already submitted. Not the same as `DELETE
        /v1/flows/{id}`: delete works only on a `DRAFT` and removes the row;
        deprecate acts on a Flow that reached Meta and only marks it.


        `supersededByFlowId` closes the pair with `clonedFromFlowId`: the clone
        points backwards, the deprecation forwards. Since publishing is
        irreversible, that pointer is the only thing tying the versions of one
        form together over time.


        `supersededBy` is echoed in the response **always**, `null` included —
        it is the only way to tell "the successor I sent was recorded" from "the
        field was dropped between my client and the row". A truncated body is
        400, not an empty one, because an empty body is a legitimate request
        here. Permission `flows:manage`.


        **Requires a number-scoped key.** A tenant-scoped key must name the
        number with the `x-whatsapp-number-id` header, or it gets 403
        `TENANT_SCOPE_NOT_ALLOWED`.
      operationId: post_flows_id_deprecate
      parameters:
        - name: id
          in: path
          required: true
          description: >-
            The **local** id of the Flow — the `id` field `GET /v1/flows`
            returns, never `metaFlowId`.
          schema:
            type: string
          example: cmf1a2b3c4d5e6f7g8h9i0j1
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                supersededByFlowId:
                  type: string
                  minLength: 1
                  description: >-
                    The **LOCAL** id of the successor Flow — the same `id` `GET
                    /v1/flows` returns, **not** the `metaFlowId`. Optional:
                    deprecating with no successor is legitimate. But
                    present-and-unusable is a different request from absent — an
                    empty or whitespace-only string is refused with 400
                    `FLOW_DEPRECATE_INVALID_SUCCESSOR` rather than dropped,
                    because a version chain that ends silently is invisible
                    afterwards. The successor is verified to belong to your
                    tenant; one that does not is 404.
                  example: cmf2b3c4d5e6f7g8h9i0j1k2
            example:
              supersededByFlowId: cmf2b3c4d5e6f7g8h9i0j1k2
      responses:
        '200':
          description: Flow deprecated
          content:
            application/json:
              example:
                flowId: cmf1a2b3c4d5e6f7g8h9i0j1
                deprecated: true
                supersededBy: cmf2b3c4d5e6f7g8h9i0j1k2
        '400':
          description: >-
            `FLOW_DEPRECATE_INVALID_SUCCESSOR`, `FLOW_BODY_INVALID`,
            `FLOW_UNKNOWN_FIELDS` (a misspelt `supersededByFlowId` lands here
            rather than passing as "no successor"), `FLOW_NUMBER_FROM_KEY`, or a
            Meta refusal
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Portuguese half
                  errorEN:
                    type: string
                    description: English half
                  code:
                    type: string
              example:
                error: >-
                  `supersededByFlowId`, quando enviado, tem de ser o id LOCAL
                  (não vazio) do Flow sucessor — o mesmo `id` que `GET
                  /api/v1/flows` devolve, e não o `metaFlowId`. Omita o campo
                  para depreciar sem sucessor.
                errorEN: >-
                  `supersededByFlowId`, when sent, must be the LOCAL (non-empty)
                  id of the successor Flow — the same `id` `GET /api/v1/flows`
                  returns, not the `metaFlowId`. Omit the field to deprecate
                  with no successor.
                code: FLOW_DEPRECATE_INVALID_SUCCESSOR
        '401':
          description: Missing or invalid `x-api-key` / `x-api-key-id` header
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Unauthorized
        '403':
          description: >-
            Tenant-scoped key used on a number-scoped endpoint, or the key's
            role lacks the permission
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Tenant-scoped keys cannot call number endpoints
                code: TENANT_SCOPE_NOT_ALLOWED
        '404':
          description: >-
            The Flow, or the `supersededByFlowId` you named, does not resolve
            inside your tenant
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Portuguese half
                  errorEN:
                    type: string
                    description: English half
                  code:
                    type: string
              example:
                error: Flow não encontrado para o número desta chave.
                errorEN: Flow not found for this key's number.
                code: FLOW_NOT_FOUND
        '409':
          description: >-
            The Flow has left `DRAFT`. Publishing is irreversible on Meta —
            clone it to start a new version
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Portuguese half
                  errorEN:
                    type: string
                    description: English half
                  code:
                    type: string
              example:
                error: >-
                  Este Flow já foi publicado na Meta e não pode mais ser
                  alterado. Clone-o para criar uma nova versão.
                errorEN: >-
                  This Flow is already published on Meta and can no longer be
                  changed. Clone it to create a new version.
                code: FLOW_NOT_DRAFT
        '422':
          description: >-
            The key's number is not a Meta (Cloud API) number, or has no WABA
            behind it
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Portuguese half
                  errorEN:
                    type: string
                    description: English half
                  code:
                    type: string
              example:
                error: >-
                  Flows existem apenas em números Meta (API Oficial). O número
                  desta chave não é Meta ou não tem uma WABA associada — use uma
                  chave de um número Meta.
                errorEN: >-
                  Flows only exist on Meta (Cloud API) numbers. This key's
                  number is not a Meta number, or has no WABA behind it — use a
                  key bound to a Meta number.
                code: FLOW_REQUIRES_META_NUMBER
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Too many requests
        '500':
          description: >-
            Internal error. Never carries the internal message — that belongs in
            the log
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Portuguese half
                  errorEN:
                    type: string
                    description: English half
                  code:
                    type: string
              example:
                error: Erro interno do servidor.
                errorEN: Internal server error.
                code: INTERNAL_ERROR
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your ps_ API key
    apiKeyId:
      type: apiKey
      in: header
      name: x-api-key-id
      description: API key id (alternative to x-api-key)

````