Delete a Campaign

SMS V3 APIs

Remove a campaign and its numbers from your account. A campaign that is running cannot be deleted.

DELETEhttps://telcomw.com/api/v3/campaigns/42

Put the campaign_id in the URL. There is no body. Your API key goes in the X-API-Key header.

Parameters

Parameter Sent in Required Description
X-API-Key header YES Your API key, sent as a header. You can also send it as Authorization: Bearer YOUR_API_KEY.
campaign_id path YES The id of the campaign.

Example request

curl --location --request DELETE 'https://telcomw.com/api/v3/campaigns/42' \
  --header 'X-API-Key: YOUR_API_KEY'
curl --location --request DELETE "https://telcomw.com/api/v3/campaigns/42" ^
  --header "X-API-Key: YOUR_API_KEY"
<?php

$headers = [
    'X-API-Key: YOUR_API_KEY',
];

$ch = curl_init('https://telcomw.com/api/v3/campaigns/42');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

print_r(json_decode($response, true));
const axios = require('axios');

axios.request({
  method: 'delete',
  url: 'https://telcomw.com/api/v3/campaigns/42',
  headers: {
    'X-API-Key': 'YOUR_API_KEY'
  }
}).then((res) => console.log(res.data))
  .catch((err) => console.error(err.response ? err.response.data : err.message));
import requests

headers = {
    'X-API-Key': 'YOUR_API_KEY'
}

response = requests.request('DELETE', 'https://telcomw.com/api/v3/campaigns/42', headers=headers)
print(response.json())

Response

The response is JSON.

Deleted (200)

{
  "success": true,
  "request_id": "req_5f2c9a1d0e7b4a63",
  "data": {
    "campaign_id": 42,
    "deleted": true
  }
}

Running (409)

{
  "success": false,
  "request_id": "req_5f2c9a1d0e7b4a63",
  "error": {
    "code": "CAMPAIGN_RUNNING",
    "message": "A campaign that is running cannot be deleted."
  }
}

Fields explained

FieldDescription
data.deletedtrue when the campaign was removed. The messages it already sent stay in your delivery reports.