> ## 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 Contact List

> Permanently delete a contact list by ID using the AutoSend API.

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

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

  url = "https://api.autosend.com/v1/contact-lists/60d5ec49f1b2c72d9c8b4567"

  headers = {
      "Authorization": "Bearer <token>"
  }

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

  ```javascript JavaScript theme={null}
  fetch('https://api.autosend.com/v1/contact-lists/60d5ec49f1b2c72d9c8b4567', {
    method: 'DELETE',
    headers: {
      'Authorization': 'Bearer <token>'
    }
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
  ```

  ```php PHP theme={null}
  <?php

  $contactListId = '60d5ec49f1b2c72d9c8b4567';
  $url = "https://api.autosend.com/v1/contact-lists/{$contactListId}";

  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer <token>'
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  echo $response;
  ?>
  ```

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

  import (
      "fmt"
      "net/http"
  )

  func main() {
      url := "https://api.autosend.com/v1/contact-lists/60d5ec49f1b2c72d9c8b4567"

      req, _ := http.NewRequest("DELETE", url, nil)
      req.Header.Set("Authorization", "Bearer <token>")

      client := &http.Client{}
      resp, err := client.Do(req)
      if err != nil {
          fmt.Println("Error:", err)
          return
      }
      defer resp.Body.Close()

      fmt.Println("Response Status:", resp.Status)
  }
  ```

  ```java Java theme={null}
  import java.net.HttpURLConnection;
  import java.net.URL;

  public class DeleteContactList {
      public static void main(String[] args) {
          try {
              URL url = new URL("https://api.autosend.com/v1/contact-lists/60d5ec49f1b2c72d9c8b4567");
              HttpURLConnection con = (HttpURLConnection) url.openConnection();

              con.setRequestMethod("DELETE");
              con.setRequestProperty("Authorization", "Bearer <token>");

              int status = con.getResponseCode();
              System.out.println("Response Status: " + status);

              con.disconnect();
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  ```

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

  uri = URI('https://api.autosend.com/v1/contact-lists/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 response.body
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "message": "Contact list deleted successfully",
    "data": {
      "id": "60d5ec49f1b2c72d9c8b4567",
      "name": "Newsletter Subscribers",
      "description": "Weekly newsletter subscribers",
      "type": "list",
      "filterCriteria": null,
      "contactCount": 150,
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-01-20T14:45:00.000Z",
      "parentId": null
    }
  }
  ```
</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="contactListId" type="string" required>
  The unique identifier of the contact list to delete.

  Example: `"60d5ec49f1b2c72d9c8b4567"`
</ParamField>

<Note>
  You cannot delete a contact list that is currently used in active workflows. Remove the list from all workflows before deleting.
</Note>

### Response

<span className="text-sm">Contact list deleted successfully</span>

<ResponseField name="success" type="boolean">
  Indicates if the request was successful

  Example: `true`
</ResponseField>

<ResponseField name="message" type="string">
  Confirmation message

  Example: `"Contact list deleted successfully"`
</ResponseField>

<ResponseField name="data" type="object">
  The deleted contact list object

  <Expandable title="data">
    <ResponseField name="id" type="string">
      Unique identifier of the contact list

      Example: `"60d5ec49f1b2c72d9c8b4567"`
    </ResponseField>

    <ResponseField name="name" type="string">
      Name of the contact list

      Example: `"Newsletter Subscribers"`
    </ResponseField>

    <ResponseField name="description" type="string">
      Description of the contact list

      Example: `"Weekly newsletter subscribers"`
    </ResponseField>

    <ResponseField name="type" type="string">
      Type of the contact list - `list` or `segment`

      Example: `"list"`
    </ResponseField>

    <ResponseField name="filterCriteria" type="object | null">
      Filter criteria for segments. `null` for regular lists.
    </ResponseField>

    <ResponseField name="contactCount" type="number">
      Number of contacts in the list at the time of deletion

      Example: `150`
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      ISO 8601 timestamp of when the contact list was created

      Example: `"2024-01-15T10:30:00.000Z"`
    </ResponseField>

    <ResponseField name="updatedAt" type="string">
      ISO 8601 timestamp of when the contact list was last updated

      Example: `"2024-01-20T14:45:00.000Z"`
    </ResponseField>

    <ResponseField name="parentId" type="string | null">
      ID of the parent list if this is a sub-segment. `null` otherwise.
    </ResponseField>
  </Expandable>
</ResponseField>

#### Error Responses

<ResponseField name="400 - Contact list in use" type="object">
  Returned when the contact list is used in active workflow automations.

  ```json theme={null}
  {
    "success": false,
    "error": {
      "message": "Cannot delete contact list as it is used in active resources.",
      "code": "CANNOT_DELETE_CONTACT_LIST_IN_USE",
      "status": 400
    }
  }
  ```
</ResponseField>

<ResponseField name="404 - Contact list not found" type="object">
  Returned when no contact list with the given ID exists on the project.

  ```json theme={null}
  {
    "success": false,
    "error": {
      "message": "Contact list not found",
      "code": "CONTACT_LIST_NOT_FOUND",
      "status": 404
    }
  }
  ```
</ResponseField>


## OpenAPI

````yaml DELETE /contact-lists/{contactListId}
openapi: 3.1.0
info:
  title: AutoSend API
  description: AutoSend REST API for managing contact lists and segments
  version: 1.0.0
servers:
  - url: https://api.autosend.com/v1
security:
  - bearerAuth: []
paths:
  /contact-lists/{contactListId}:
    delete:
      summary: Delete Contact List
      description: >-
        Soft deletes a contact list by its ID. Cannot delete lists that are used
        in active workflows.
components: {}

````