Delete Contacts
Remove contacts from your organization. Supports deleting a single contact or bulk deleting up to 1,000 contacts at once.
Delete Single Contact
Soft-delete a contact by ID.
Endpoint
DELETE /contacts/:id
Returns: 200 OK
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The contact ID to delete |
Response
{
"message": "Contact deleted"
}
Examples
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X DELETE "https://api.arsel.sa/v1/contacts/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a" \
-H "Authorization: Bearer $ARSEL_API_KEY"
const response = await fetch("https://api.arsel.sa/v1/contacts/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.ARSEL_API_KEY}`,
},
});
const data = await response.json();
if (!response.ok) {
throw new Error(`${data.name}: ${data.message}`);
}
console.log(data);
import os
import requests
response = requests.delete(
"https://api.arsel.sa/v1/contacts/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a",
headers={"Authorization": f"Bearer {os.environ['ARSEL_API_KEY']}"},
)
response.raise_for_status()
print(response.json())
using System.Net.Http.Headers;
var client = new HttpClient(); // share one instance across requests
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("ARSEL_API_KEY"));
var request = new HttpRequestMessage(HttpMethod.Delete, "https://api.arsel.sa/v1/contacts/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a");
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new HttpRequestException($"{(int)response.StatusCode}: {body}");
Console.WriteLine(body);
<?php
$ch = curl_init("https://api.arsel.sa/v1/contacts/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ARSEL_API_KEY"),
],
]);
$data = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
throw new Exception("{$data['name']}: {$data['message']}");
}
print_r($data);
Bulk Delete Contacts
Delete multiple contacts in a single request. Maximum 1,000 contacts per request.
Endpoint
POST /contacts/bulk-delete
Returns: 200 OK
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <your-api-key> | Yes |
Content-Type | application/json | Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
contact_ids | string[] | Yes | Array of contact IDs to delete. Min: 1, Max: 1,000. |
Response
{
"message": "Contacts deleted",
"deleted": 25
}
| Field | Type | Description |
|---|---|---|
deleted | number | Number of contacts that were deleted |
Examples
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X POST "https://api.arsel.sa/v1/contacts/bulk-delete" \
-H "Authorization: Bearer $ARSEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contact_ids": [
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a",
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6b",
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6c"
]
}'
const response = await fetch("https://api.arsel.sa/v1/contacts/bulk-delete", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ARSEL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
contact_ids: [
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a",
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6b",
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6c",
],
}),
});
const data = await response.json();
if (!response.ok) {
throw new Error(`${data.name}: ${data.message}`);
}
console.log(data);
import os
import requests
response = requests.post(
"https://api.arsel.sa/v1/contacts/bulk-delete",
headers={"Authorization": f"Bearer {os.environ['ARSEL_API_KEY']}"},
json={
"contact_ids": [
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a",
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6b",
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6c",
],
},
)
response.raise_for_status()
print(response.json())
using System.Net.Http.Headers;
using System.Text;
var client = new HttpClient(); // share one instance across requests
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("ARSEL_API_KEY"));
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.arsel.sa/v1/contacts/bulk-delete")
{
Content = new StringContent(
"""
{
"contact_ids": [
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a",
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6b",
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6c"
]
}
""",
Encoding.UTF8,
"application/json"),
};
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new HttpRequestException($"{(int)response.StatusCode}: {body}");
Console.WriteLine(body);
<?php
$ch = curl_init("https://api.arsel.sa/v1/contacts/bulk-delete");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ARSEL_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"contact_ids" => [
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a",
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6b",
"01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6c",
],
]),
]);
$data = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
throw new Exception("{$data['name']}: {$data['message']}");
}
print_r($data);
Error Responses
- 422 Validation Error
- 404 Not Found
- 401 Unauthorized
{
"status_code": 422,
"name": "validation_error",
"message": "contact_ids must contain no more than 1000 elements"
}
{
"status_code": 404,
"name": "not_found",
"message": "Contact not found"
}
{
"status_code": 401,
"name": "unauthorized",
"message": "Invalid API Key"
}