> For the complete documentation index, see [llms.txt](https://docs.mailtrap.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mailtrap.io/developers/email-marketing/email-campaigns/delete-an-email-campaign.md).

# Delete an email campaign

Soft-deletes an email campaign. Returns `204 No Content` on success.

Only `draft` campaigns can be deleted — deleting a campaign that is already scheduled/sending returns `422`. A campaign that has been started never returns to `draft`, so it can no longer be deleted. A `scheduled` campaign can be returned to `draft` first via the `cancel` or `reset` action endpoints.

```json
{"openapi":"3.1.0","info":{"title":"Email Campaigns","version":"2.0.0"},"tags":[{"name":"Email Campaigns","description":"Manage email campaigns"}],"servers":[{"description":"Mailtrap API","url":"https://mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"Pass the API token in the Api-Token header","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","description":"Pass the API token as a Bearer token in the Authorization header","scheme":"bearer"}},"parameters":{"email_campaign_id":{"name":"email_campaign_id","description":"Unique identifier of the email campaign","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1}}},"responses":{"UNAUTHENTICATED":{"description":"Authentication failed — missing or invalid API token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthenticatedResponse"}}}},"PERMISSION_DENIED":{"description":"The API token does not have permission to access this resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionDeniedResponse"}}}},"NOT_FOUND":{"description":"The requested email campaign was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}},"VALIDATION_ERROR":{"description":"The request was rejected due to validation errors.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponse"}}}},"RATE_LIMITED":{"description":"Too many requests. The public API is rate limited to 150 requests per 10 seconds per\nAPI token. Retry after the window resets (see the `x-ratelimit-reset` header).","headers":{},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitedResponse"}}}}},"schemas":{"UnauthenticatedResponse":{"type":"object","properties":{"error":{"type":"string"}}},"PermissionDeniedResponse":{"type":"object","properties":{"errors":{"type":"string"}}},"NotFoundResponse":{"type":"object","properties":{"error":{"type":"string"}}},"ValidationErrorResponse":{"type":"object","properties":{"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"RateLimitedResponse":{"type":"object","properties":{"error":{"type":"string"}}}}},"paths":{"/api/email_campaigns/{email_campaign_id}":{"delete":{"operationId":"deleteEmailCampaign","summary":"Delete an email campaign","description":"Soft-deletes an email campaign. Returns `204 No Content` on success.\n\nOnly `draft` campaigns can be deleted — deleting a campaign that is already\nscheduled/sending returns `422`. A campaign that has been started never returns to\n`draft`, so it can no longer be deleted. A `scheduled` campaign can be returned to\n`draft` first via the `cancel` or `reset` action endpoints.","tags":["Email Campaigns"],"parameters":[{"$ref":"#/components/parameters/email_campaign_id"}],"responses":{"204":{"description":"The email campaign was deleted. No response body."},"401":{"$ref":"#/components/responses/UNAUTHENTICATED"},"403":{"$ref":"#/components/responses/PERMISSION_DENIED"},"404":{"$ref":"#/components/responses/NOT_FOUND"},"422":{"$ref":"#/components/responses/VALIDATION_ERROR"},"429":{"$ref":"#/components/responses/RATE_LIMITED"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mailtrap.io/developers/email-marketing/email-campaigns/delete-an-email-campaign.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
