Contact Lists
Delete Contact List
Permanently delete a contact list by ID using the AutoSend API.
DELETE
/
contact-lists
/
{contactListId}
curl --request DELETE \
--url https://api.autosend.com/v1/contact-lists/60d5ec49f1b2c72d9c8b4567 \
--header 'Authorization: Bearer <token>'
import requests
url = "https://api.autosend.com/v1/contact-lists/60d5ec49f1b2c72d9c8b4567"
headers = {
"Authorization": "Bearer <token>"
}
response = requests.delete(url, headers=headers)
print(response.json())
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
$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;
?>
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)
}
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();
}
}
}
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
{
"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
}
}
curl --request DELETE \
--url https://api.autosend.com/v1/contact-lists/60d5ec49f1b2c72d9c8b4567 \
--header 'Authorization: Bearer <token>'
import requests
url = "https://api.autosend.com/v1/contact-lists/60d5ec49f1b2c72d9c8b4567"
headers = {
"Authorization": "Bearer <token>"
}
response = requests.delete(url, headers=headers)
print(response.json())
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
$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;
?>
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)
}
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();
}
}
}
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
{
"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
}
}
Authorizations
Bearer authentication header of the form Bearer
<token>, where <token> is your auth token.Path Parameters
The unique identifier of the contact list to delete.Example:
"60d5ec49f1b2c72d9c8b4567"You cannot delete a contact list that is currently used in active workflows. Remove the list from all workflows before deleting.
Response
Contact list deleted successfullyThe deleted contact list object
Show data
Show data
ISO 8601 timestamp of when the contact list was last updatedExample:
"2024-01-20T14:45:00.000Z"Error Responses
Returned when the contact list is used in active workflow automations.
{
"success": false,
"error": {
"message": "Cannot delete contact list as it is used in active resources.",
"code": "CANNOT_DELETE_CONTACT_LIST_IN_USE",
"status": 400
}
}
Was this page helpful?
⌘I
curl --request DELETE \
--url https://api.autosend.com/v1/contact-lists/60d5ec49f1b2c72d9c8b4567 \
--header 'Authorization: Bearer <token>'
import requests
url = "https://api.autosend.com/v1/contact-lists/60d5ec49f1b2c72d9c8b4567"
headers = {
"Authorization": "Bearer <token>"
}
response = requests.delete(url, headers=headers)
print(response.json())
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
$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;
?>
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)
}
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();
}
}
}
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
{
"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
}
}