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

# Delete Template

> Delete a WhatsApp message template from Meta and remove it from the Connexease workspace.

## What it does

Deletes a single template. The template is first read from Meta to resolve its name, then deleted on Meta by `name` + template ID — so only the language version identified by `source_id` is removed, not every language sharing that name.

<Warning>
  **Deletion cannot be undone.** Meta removes the template permanently. Re-creating it starts a new review cycle (`PENDING`) and produces a new `sourceId`. Messages that still reference a deleted template will fail to send.
</Warning>

***

## Endpoint

```text theme={null}
DELETE /api/v1/wa/{app_id}/templates/{source_id}
```

There are no query or body parameters.

### Headers

<ParamField header="Authorization" type="string" required>
  Secret key in `Bearer sk_...` format. See [Secret Key authentication](/essentials/authentication#secret-key).
</ParamField>

### Path parameters

<ParamField path="app_id" type="string" required>
  Application ID. Must belong to the organization (otherwise `404`).
</ParamField>

<ParamField path="source_id" type="string" required>
  The template's Meta ID — the `sourceId` returned by [Get Templates](/public-api-reference/template/get-templates) or [Create Template](/public-api-reference/template/create-template).
</ParamField>

***

## Response

Success returns HTTP `200` with an envelope that carries no payload: `{ "isSuccess": true }`.

<ResponseField name="isSuccess" type="boolean">
  `true` when the template was deleted on Meta and soft-deleted locally.
</ResponseField>

<ResponseField name="data" type="null">
  This endpoint has no payload. `data` is null and, like every null field, is dropped from the response.
</ResponseField>

<Note>
  Deleting one language version does not delete the other versions of the same template name — call the endpoint once per `sourceId`.
</Note>

***

## Examples

<AccordionGroup>
  <Accordion title="Demo 1 — delete a template">
    ```text theme={null}
    DELETE /api/v1/wa/app_7poyXj8GXuv76e/templates/842802041844912
    Authorization: Bearer sk_...
    ```

    ```json theme={null}
    { "isSuccess": true }
    ```
  </Accordion>

  <Accordion title="Demo 2 — delete one language version only">
    `order_confirmation` exists in both `en` and `tr`. Each language version has its own `sourceId`, so deleting the English one leaves the Turkish one untouched.

    ```text theme={null}
    DELETE /api/v1/wa/app_7poyXj8GXuv76e/templates/842802041844912
    Authorization: Bearer sk_...
    ```

    ```json theme={null}
    { "isSuccess": true }
    ```

    To remove the Turkish one as well, repeat the call with its own ID:

    ```text theme={null}
    DELETE /api/v1/wa/app_7poyXj8GXuv76e/templates/1560534655590931
    Authorization: Bearer sk_...
    ```
  </Accordion>

  <Accordion title="Demo 3 — verify the deletion">
    After deleting, list the templates again; the record is gone.

    ```text theme={null}
    GET /api/v1/wa/app_7poyXj8GXuv76e/templates?search=order_confirmation
    Authorization: Bearer sk_...
    ```

    ```json theme={null}
    {
      "data": [],
      "pagingMetadata": { "hasNext": false, "hasPrevious": false, "pageSize": 0 },
      "isSuccess": true
    }
    ```
  </Accordion>

  <Accordion title="Demo 4 — error: unknown template → 404">
    ```text theme={null}
    DELETE /api/v1/wa/app_7poyXj8GXuv76e/templates/000000000000000
    Authorization: Bearer sk_...
    ```

    ```json theme={null}
    { "errors": { "code": "META_075", "group": "NOT_FOUND", "description": "Template with 000000000000000 not found in Meta." }, "isSuccess": false }
    ```
  </Accordion>

  <Accordion title="Demo 5 — error: foreign app_id → 404">
    ```text theme={null}
    DELETE /api/v1/wa/app_FOREIGN/templates/842802041844912
    Authorization: Bearer sk_...
    ```

    ```json theme={null}
    { "errors": { "code": "APPLICATION_004", "group": "NOT_FOUND", "description": "Application(s) not found for this organization: app_FOREIGN" }, "isSuccess": false }
    ```
  </Accordion>
</AccordionGroup>

***

## Errors

<ResponseField name="errors" type="object">
  Error details with `code`, `group`, and `description`; `isSuccess` is `false`.
</ResponseField>

### Auth / tenant

| HTTP | Code                      | When                                          |
| ---- | ------------------------- | --------------------------------------------- |
| 401  | `ORGANIZATION_SECRET_010` | Secret key is missing.                        |
| 401  | `ORGANIZATION_SECRET_011` | Secret key is invalid.                        |
| 404  | `APPLICATION_004`         | `app_id` does not belong to the organization. |

### Meta-side (template lookup + delete)

The lookup and the delete share the same error mapping, so a failure in either step surfaces the same codes.

| HTTP | Code       | When                                                              |
| ---- | ---------- | ----------------------------------------------------------------- |
| 404  | `META_075` | `source_id` does not exist on Meta (already deleted or wrong ID). |
| 401  | `META_034` | Token invalid/expired (190).                                      |
| 403  | `META_035` | Permission denied (10 / 200–299).                                 |
| 429  | `META_036` | Rate limit (4 / 80007).                                           |
| 400  | `META_037` | Invalid parameter (100).                                          |
| 502  | `META_004` | General/fallback error while reading or deleting the template.    |

Example error response (404 unknown template):

```json theme={null}
{ "errors": { "code": "META_075", "group": "NOT_FOUND", "description": "Template with 000000000000000 not found in Meta." }, "isSuccess": false }
```
