---
updatedAt: 2026-06-10T09:39:45.000Z
agentTools:
  projectIndex: https://docs.aurorasendcloud.com/llms.txt
---

# Delete Email Template

Delete templates by invokeName (single) or, when invokeName is absent, batch-delete all templates of the API_USER whose update_time falls in [startDate 00:00:00, endDate 23:59:59]. invokeName takes priority when both are supplied.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Email",
    "description": "Revised snapshot of official v1.4 Email Template OpenAPI, synced to asc-api source behavior (TemplateController / TemplateEntityChecker / BaseEntityChecker / Template-SqlMap.xml). Revision notes: A1 business failures keep HTTP 200 and are carried by statusCode + result=false; 400 error-code tables added for all 5 operations; no method restriction is declared — the framework accepts any HTTP method on these paths. A2 list dataList items never contain templateStat (wrapper2 in TemplateController never emits it) and contain only name/invokeName/templateType/gmtCreated/gmtUpdated; list is always sorted by gmt_created desc. A3 get info.data = name/invokeName/templateType/gmtCreated/gmtUpdated/html/text/subject/contentSummary: templateStat removed (never emitted), text and contentSummary added (official page omitted them). A4 add info.data uses the same wrapper as get: templateStat removed, text/contentSummary added; templates are force-approved on add (TemplateController sets isVerify=VERIFY_PASS), so queried templates are always in approved state. A5 invokeName maxLength=64 (Template.MAX_INVOKENAME_LENGTH, 40202 when exceeded); no charset restriction — hyphens and special characters are accepted (165 No.4110/8308). A6 name maxLength=64 (40208, 165 No.12719); empty string passes the checker on add/update and clears/sets the value (source TODO documents the ambiguity). A7 subject 1-512 chars (40210; 40209 when missing on add). A8 html: non-empty on add (40211/40212), JavaScript rejected with 40231; update semantics corrected: OMIT a field to keep the original value (iBATIS isNotNull), an empty-string html is rejected with 40212 — official 'leave empty to keep original' wording was wrong (165 No.12712). A9 text optional; empty string rejected with 40214. A10 templateType enum [0,1] (40203/40204). A11 editorMode (add only) enum [0,3] (40232/40233), defaults to 0 (RTE); 3 = Code. A12 delete additionally supports batch delete by startDate+endDate (yyyy-MM-dd, expanded to start-of-day/end-of-day against update_time) when invokeName is absent; 40230 when both blank, 40007/40008 on bad dates; invokeName takes priority when both present. A13 add rejects duplicate invokeName with 40220 and enforces a 1000-template ceiling with 40219. A14 update additionally accepts text, resets review state to approved and refreshes gmtModified as side effects; 40216 when invokeName not found. A15 list start/limit bounds and defaults (0 / 100, 40002/40004), invokeName filter is exact match (SQL =), and an undocumented editorMode filter is consumed as source_method by the list SQL. A16 success message casing is 'Request successful' (StatusCode.GLOBAL_SUCCESS)."
  },
  "servers": [
    {
      "url": "https://api.aurorasendcloud.com/",
      "description": "Singapore Region\n- Base URL: https://api.aurorasendcloud.com/\n"
    },
    {
      "url": "https://api-us.aurorasendcloud.com/",
      "description": "US (Silicon Valley) Region\n- Base URL: https://api-us.aurorasendcloud.com/\n"
    },
    {
      "url": "https://api-hk.aurorasendcloud.com/",
      "description": "CN (Hong Kong SAR) Region\n- Base URL: https://api-hk.aurorasendcloud.com/\n"
    }
  ],
  "tags": [
    {
      "name": "Email Template",
      "description": "Interfaces for querying, adding, updating, and deleting email templates"
    }
  ],
  "paths": {
    "/api/template/delete": {
      "post": {
        "summary": "Delete Email Template",
        "description": "Delete templates by invokeName (single) or, when invokeName is absent, batch-delete all templates of the API_USER whose update_time falls in [startDate 00:00:00, endDate 23:59:59]. invokeName takes priority when both are supplied.",
        "operationId": "delete-email-template",
        "tags": [
          "Email Template"
        ],
        "security": [
          {
            "apiUser": [],
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "apiUser",
                  "apiKey"
                ],
                "properties": {
                  "apiUser": {
                    "type": "string",
                    "description": "Authentication credential; invalid credentials return 40005."
                  },
                  "apiKey": {
                    "type": "string",
                    "description": "Authentication credential; invalid credentials return 40005."
                  },
                  "invokeName": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "Calling name of the template to delete. Longer than 64 chars → 40202. When blank, startDate+endDate must be supplied (both blank → 40230). No template found → 40216 (single mode only)."
                  },
                  "startDate": {
                    "type": "string",
                    "format": "date",
                    "description": "UNDOCUMENTED on the official page: batch mode lower bound, format strictly yyyy-MM-dd (date-only; appending time yourself fails parsing). Bad/missing value in batch mode → 40007."
                  },
                  "endDate": {
                    "type": "string",
                    "format": "date",
                    "description": "UNDOCUMENTED on the official page: batch mode upper bound, format strictly yyyy-MM-dd, expanded to end-of-day. Bad/missing value in batch mode → 40008."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request processed. Business failures still return HTTP 200 with result=false and a 4xx statusCode.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "statusCode": {
                      "type": "integer",
                      "description": "Response status code (200 indicates success)",
                      "example": 200
                    },
                    "message": {
                      "type": "string",
                      "description": "Prompt message for request result",
                      "example": "Request successful"
                    },
                    "result": {
                      "type": "boolean",
                      "description": "Whether the request was processed successfully",
                      "example": true
                    },
                    "info": {
                      "type": "object",
                      "description": "Deletion result statistics (only on success; failure responses carry an empty/absent info — do not assert info.count on failure paths, 165 No.6508).",
                      "properties": {
                        "count": {
                          "type": "integer",
                          "description": "Number of templates deleted (0 = nothing matched, e.g. batch window without matches)",
                          "example": 1
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "missingBoth": {
                    "value": {
                      "statusCode": 40230,
                      "message": "invokeName or (startDate and endDate) cannot be empty",
                      "result": false
                    }
                  },
                  "notFound": {
                    "value": {
                      "statusCode": 40216,
                      "message": "The template corresponding to the template call name does not exist",
                      "result": false
                    }
                  }
                }
              }
            }
          }
        },
        "x-readme": {
          "error-codes": [
            {
              "code": 40005,
              "when": "apiUser/apiKey missing or invalid"
            },
            {
              "code": 40230,
              "when": "invokeName and startDate+endDate are all blank"
            },
            {
              "code": 40202,
              "when": "invokeName longer than 64 characters"
            },
            {
              "code": 40216,
              "when": "invokeName does not match any template of this API_USER (single mode)"
            },
            {
              "code": 40007,
              "when": "startDate blank or not yyyy-MM-dd (batch mode)"
            },
            {
              "code": 40008,
              "when": "endDate blank or not yyyy-MM-dd (batch mode)"
            }
          ]
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiUser": {
        "type": "apiKey",
        "in": "query",
        "name": "apiUser",
        "description": "Authentication parameter (API_USER, obtained from the SendCloud console)"
      },
      "apiKey": {
        "type": "apiKey",
        "in": "query",
        "name": "apiKey",
        "description": "Authentication parameter (API_KEY, obtained from the SendCloud console)"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```

# Sibling pages

* [Get Email Templates List](https://docs.aurorasendcloud.com/reference/get-email-templates-list.md)
* [Get Email Template](https://docs.aurorasendcloud.com/reference/get-email-template.md)
* [Add Email Template](https://docs.aurorasendcloud.com/reference/add-email-template.md)
* [Update Email Template](https://docs.aurorasendcloud.com/reference/update-email-template.md)