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

> ## Agent Instructions
> Integrating Pilot Status end to end? Follow https://docs.pilotstatus.com.br/guides/integrate-with-ai.md (pt-BR: https://docs.pilotstatus.com.br/pt-BR/guides/integrate-with-ai.md). No step requires contacting support: every credential is shown in the dashboard or in an API response, and a lost one is regenerated, not recovered.
> Webhook signing secret: shown ONCE in the Signing secret window right after creating the webhook on /webhooks, and in the `secret` field of the POST /v1/webhooks response (MCP: webhooks_create). Lost it: Edit Webhook → Generate a new secret, POST /v1/webhooks/{id}/rotate-secret, or webhooks_rotate_secret (the old one stops working at once). Verify `x-pilot-status-signature` = hex HMAC-SHA256 of the raw request body keyed with that secret.
> Meta verify token (number connected with the user's own Meta app credentials): Meta Number Created! window after connecting, then the number's card on Numbers (workspace Owner), or webhook.verifyToken in the POST /v1/numbers/meta response. It is not the webhook signing secret.
> REST auth: `x-api-key: ps_...` header, never Authorization: Bearer. MCP: https://mcp.pilotstatus.com.br/mcp (148 tools, OAuth 2.1 or x-api-key); Code Mode: https://mcp.pilotstatus.com.br/code. Destructive MCP tools return a preview and a confirm_token: show the preview and call again only after the user's explicit yes. Over OAuth, revealing or creating ps_ API keys is workspace Owner only.

# Eliminar plantilla

> Elimina la plantilla por id en el alcance del número vinculado. Para plantillas de Meta, también la elimina de Meta (WABA). 404 TEMPLATE_NOT_FOUND si no existe o no pertenece al número. Devuelve { deleted: true, id }. Cuando Meta rechaza la eliminación, o ningún número del workspace en esa WABA tiene un token de Meta, devuelve 409 META_TEMPLATE_DELETE_REFUSED y no se elimina nada; entonces `?force_local=true` elimina solo la fila local (la plantilla sigue en Meta y la próxima sincronización la trae de vuelta). Una plantilla sin WABA (número que no es de Meta) se elimina solo localmente. Requiere una clave con alcance de número. Efecto secundario real e irreversible.

Meta elimina plantillas **por nombre**: se eliminan en Meta todas las versiones de idioma de ese nombre en la WABA. Llama primero con `?dry_run=true` para ver qué se eliminará; la herramienta MCP `templates_delete` siempre lo hace y pide confirmación.

Permiso `templates:manage`: `OWNER` o `ADMIN` para claves de cuenta y tokens OAuth; las claves de número y de workspace no tienen verificación de rol. Una clave de workspace, clave de cuenta o token OAuth debe indicar el número en `x-whatsapp-number-id`.

**Requiere una clave con alcance de número.**



## OpenAPI

````yaml openapi.es.json DELETE /v1/templates/{id}
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: >-
    API REST pública de Pilot Status. Autentícate con el encabezado `x-api-key:
    ps_...` (o `x-api-key-id`). URL base: https://pilotstatus.com.br
servers:
  - url: https://pilotstatus.com.br
security:
  - apiKey: []
  - apiKeyId: []
paths:
  /v1/templates/{id}:
    delete:
      tags:
        - Templates
      summary: Eliminar plantilla
      description: >-
        Elimina la plantilla por id en el alcance del número vinculado. Para
        plantillas de Meta, también la elimina de Meta (WABA). 404
        TEMPLATE_NOT_FOUND si no existe o no pertenece al número. Devuelve {
        deleted: true, id }. Cuando Meta rechaza la eliminación, o ningún número
        del workspace en esa WABA tiene un token de Meta, devuelve 409
        META_TEMPLATE_DELETE_REFUSED y no se elimina nada; entonces
        `?force_local=true` elimina solo la fila local (la plantilla sigue en
        Meta y la próxima sincronización la trae de vuelta). Una plantilla sin
        WABA (número que no es de Meta) se elimina solo localmente. Requiere una
        clave con alcance de número. Efecto secundario real e irreversible.


        Meta elimina plantillas **por nombre**: se eliminan en Meta todas las
        versiones de idioma de ese nombre en la WABA. Llama primero con
        `?dry_run=true` para ver qué se eliminará; la herramienta MCP
        `templates_delete` siempre lo hace y pide confirmación.


        Permiso `templates:manage`: `OWNER` o `ADMIN` para claves de cuenta y
        tokens OAuth; las claves de número y de workspace no tienen verificación
        de rol. Una clave de workspace, clave de cuenta o token OAuth debe
        indicar el número en `x-whatsapp-number-id`.


        **Requiere una clave con alcance de número.**
      operationId: delete_templates_id
      parameters:
        - name: id
          in: path
          required: true
          description: Id de la plantilla a eliminar (no se acepta el nombre).
          schema:
            type: string
          example: tpl_01HZX...
        - name: dry_run
          in: query
          required: false
          description: >-
            `true` no elimina nada y devuelve una vista previa de lo que haría
            la eliminación: `action` (`DELETE_ON_META_AND_LOCAL` o
            `DELETE_LOCAL_ONLY`), la `template`, su `waba`, el número cuyo token
            de Meta realiza la eliminación (`via_number`, `null` cuando ninguno
            tiene token: la eliminación sería rechazada) y `warnings`. Mismo
            permiso y alcance que la eliminación. Funciona para cualquier
            plantilla: `DELETE_LOCAL_ONLY` (con `waba` y `via_number` en null)
            para una plantilla sin WABA. Solo la cadena exacta `true` muestra la
            vista previa; cualquier otro valor realiza la eliminación real.
          schema:
            type: boolean
            default: false
          example: true
        - name: force_local
          in: query
          required: false
          description: >-
            `true` elimina la fila local incluso cuando Meta rechaza la
            eliminación o no se puede contactar (ningún número con token de Meta
            en la WABA). La plantilla sigue en Meta y su nombre sigue reservado;
            la próxima sincronización de un número en esa WABA trae la fila de
            vuelta. Úsalo solo después de un `409 META_TEMPLATE_DELETE_REFUSED`.
          schema:
            type: boolean
            default: false
          example: true
      responses:
        '200':
          description: Eliminar plantilla
          content:
            application/json:
              examples:
                deleted:
                  value:
                    deleted: true
                    id: tpl_01HZX...
                dryRun:
                  value:
                    dry_run: true
                    action: DELETE_ON_META_AND_LOCAL
                    template:
                      id: tpl_01HZX...
                      name: promo
                      category: MARKETING
                      source: META
                      meta_status: APPROVED
                      meta_language: pt_BR
                      meta_template_id: '1234567890123456'
                    waba:
                      id: '1581714517011340'
                      name: Acme
                    via_number:
                      id: wn_01HZX...
                      number: '+5511999990000'
                      display_name: Acme
                    warnings:
                      - >-
                        Irreversible: the template is deleted on Meta and in
                        Pilot Status. Meta does not let the same name be reused
                        for about 30 days.
                      - >-
                        Meta deletes by name: every language version of "promo"
                        on this WABA is deleted on Meta, not only this one.
        '401':
          description: Encabezado `x-api-key` / `x-api-key-id` ausente o inválido
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Unauthorized
        '403':
          description: >-
            Clave de workspace/cuenta o token OAuth sin `x-whatsapp-number-id`
            (`TENANT_SCOPE_NOT_ALLOWED`), un rol de usuario sin
            `templates:manage` (`PERMISSION_DENIED`), o un número fuera de una
            concesión OAuth (`NUMBER_NOT_IN_GRANT`)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              examples:
                TENANT_SCOPE_NOT_ALLOWED:
                  value:
                    error: >-
                      This endpoint acts on a single WhatsApp number: send the
                      x-whatsapp-number-id header naming the number to act on
                      (its id or instance id from GET /v1/numbers) | Este
                      endpoint atua sobre um único número de WhatsApp: envie o
                      header x-whatsapp-number-id indicando o número desejado (o
                      id dele ou o id da instância, obtidos em GET /v1/numbers)
                    code: TENANT_SCOPE_NOT_ALLOWED
                PERMISSION_DENIED:
                  value:
                    error: >-
                      Your workspace role does not allow this action
                      (templates:manage).
                    code: PERMISSION_DENIED
        '404':
          description: >-
            Plantilla no encontrada en el alcance de la clave (también cuando
            `{id}` es un nombre de plantilla: solo se acepta el id)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Template not found
                code: TEMPLATE_NOT_FOUND
        '409':
          description: >-
            Meta rechazó la eliminación, o no se pudo contactar: no se eliminó
            nada. `error` está en inglés, `errorPT` en portugués.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  Template "promo" was NOT deleted: Meta refused the deletion.
                  Reason: … It still exists on your WABA, consuming quota and
                  keeping the name reserved (re-creating a template with the
                  same name will fail). Fix the token's permission on that WABA
                  and try again, or delete the template in Meta Business
                  Manager.
                errorPT: >-
                  O template "promo" NÃO foi excluído: a Meta recusou a
                  exclusão. Motivo: … 
                code: META_TEMPLATE_DELETE_REFUSED
                template_name: promo
                can_force_local_delete: true
        '429':
          description: Límite de solicitudes excedido
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Too many requests
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Tu API key ps_
    apiKeyId:
      type: apiKey
      in: header
      name: x-api-key-id
      description: Id de la API key (alternativa a x-api-key)

````

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