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

# Delete Campaign

> Permanently delete a campaign by ID using the AutoSend API.

<RequestExample>
  ```bash cURL theme={null}
  curl --request DELETE \
    --url 'https://api.autosend.com/v1/campaigns/60d5ec49f1b2c72d9c8b4567' \
    --header 'Authorization: Bearer <token>'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.autosend.com/v1/campaigns/60d5ec49f1b2c72d9c8b4567"
  headers = {"Authorization": "Bearer <token>"}

  response = requests.delete(url, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.autosend.com/v1/campaigns/60d5ec49f1b2c72d9c8b4567',
    {
      method: 'DELETE',
      headers: {
        Authorization: 'Bearer <token>',
      },
    }
  );
  const data = await response.json();
  console.log(data);
  ```

  ```php PHP theme={null}
  <?php
  $curl = curl_init();
  curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.autosend.com/v1/campaigns/60d5ec49f1b2c72d9c8b4567',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => [
      'Authorization: Bearer <token>',
    ],
  ]);
  $response = curl_exec($curl);
  curl_close($curl);
  echo $response;
  ```

  ```go Go theme={null}
  package main

  import (
  	"fmt"
  	"io"
  	"net/http"
  )

  func main() {
  	req, _ := http.NewRequest("DELETE", "https://api.autosend.com/v1/campaigns/60d5ec49f1b2c72d9c8b4567", nil)
  	req.Header.Set("Authorization", "Bearer <token>")

  	client := &http.Client{}
  	resp, _ := client.Do(req)
  	defer resp.Body.Close()
  	body, _ := io.ReadAll(resp.Body)
  	fmt.Println(string(body))
  }
  ```

  ```java Java theme={null}
  import java.net.URI;
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;

  public class Main {
      public static void main(String[] args) throws Exception {
          HttpClient client = HttpClient.newHttpClient();
          HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create("https://api.autosend.com/v1/campaigns/60d5ec49f1b2c72d9c8b4567"))
              .header("Authorization", "Bearer <token>")
              .DELETE()
              .build();
          HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
          System.out.println(response.body());
      }
  }
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'uri'
  require 'json'

  uri = URI('https://api.autosend.com/v1/campaigns/60d5ec49f1b2c72d9c8b4567')
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  request = Net::HTTP::Delete.new(uri)
  request['Authorization'] = 'Bearer <token>'

  response = http.request(request)
  puts JSON.parse(response.body)
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "id": "60d5ec49f1b2c72d9c8b4567",
      "deleted": true
    }
  }
  ```
</ResponseExample>

### Authorizations

<ParamField path="Authorizations" type="string | header" required>
  Bearer authentication header of the form Bearer `<token>`, where `<token>` is your auth token.
</ParamField>

### Path Parameters

<ParamField path="campaignId" type="string" required>
  The id of the campaign to delete.
</ParamField>

### Response

<span className="text-sm">Returns a confirmation that the campaign was deleted.</span>

<ResponseField name="success" type="boolean">
  Indicates whether the request was successful.
</ResponseField>

<ResponseField name="data" type="object">
  Deletion confirmation payload.

  <Expandable title="data">
    <ResponseField name="campaignId" type="string">
      The ID of the campaign that was deleted.
    </ResponseField>

    <ResponseField name="deleted" type="boolean">
      Confirms the campaign was successfully deleted.
    </ResponseField>
  </Expandable>
</ResponseField>


## OpenAPI

````yaml DELETE /campaigns/{campaignId}
openapi: 3.1.0
info:
  title: Autosend Campaigns API
  version: 1.0.0
  description: API endpoints for managing marketing campaigns in Autosend.
servers:
  - url: https://api.autosend.com/v1
    description: Production
security:
  - BearerAuth: []
paths:
  /campaigns/{campaignId}:
    delete:
      tags:
        - Campaigns
      summary: Delete a campaign
      description: Permanently deletes a campaign by ID. MCP access allowed.
      operationId: deleteCampaign
      parameters:
        - name: campaignId
          in: path
          required: true
          schema:
            type: string
          description: Id of the campaign.
      responses:
        '200':
          description: Campaign deleted successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse'
        '404':
          description: Campaign not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SuccessResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
        code:
          type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form Bearer <token>, where <token>
        is your auth token.

````