Skip to main content
DELETE
/
v2
/
history
/
clear
{
  "success": true,
  "cleared": {
    "sends": 150,
    "clicks": 45,
    "revenue": 32
  }
}
Permanently delete imported historical data from your account. You can selectively clear sends, clicks, and/or revenue records.
Important scoping differences:
  • Sends: Only records where imported=true are cleared. Records from normal API sends or scheduled sends are never affected.
  • Clicks: Clicks are cleared based on the message IDs of imported send records. Only clicks associated with imported messages are removed.
  • Revenue: All revenue records for the account are cleared, not just those from imported messages. This includes revenue from live sends.
This is a destructive operation that cannot be undone. Cleared data is permanently deleted and cannot be recovered. Always verify your selection and consider using the before_date parameter to limit the scope of deletion.

Authentication

X-Api-Key
string
required
Your Trackly SMS API key. Format: trk_[32-char-alphanumeric].

Body Parameters

entities
array
required
An array of entity types to clear. Valid values: sends, clicks, revenue. You may include one or more entity types.
before_date
datetime
Only clear records with timestamps before this ISO 8601 datetime. If omitted, all matching records are cleared regardless of date.
confirm
boolean
required
Safety confirmation flag. Must be set to true to proceed with deletion. Requests with confirm: false or a missing confirm field are rejected.

Response Fields

success
boolean
Whether the clear operation completed successfully.
cleared
object
An object with counts of cleared records by entity type. Only includes entities that were requested.
  • sends (integer) — Number of send records cleared.
  • clicks (integer) — Number of click records cleared.
  • revenue (integer) — Number of revenue records cleared.
cURL
curl -X DELETE https://app.tracklysms.com/api/v2/history/clear \
  -H "X-Api-Key: trk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "entities": ["sends", "clicks", "revenue"],
    "before_date": "2025-12-01T00:00:00Z",
    "confirm": true
  }'
Python
import requests

response = requests.delete(
    "https://app.tracklysms.com/api/v2/history/clear",
    headers={
        "X-Api-Key": "trk_your_api_key_here",
        "Content-Type": "application/json",
    },
    json={
        "entities": ["sends", "clicks", "revenue"],
        "before_date": "2025-12-01T00:00:00Z",
        "confirm": True,
    },
)

print(response.json())
Node.js
const response = await fetch("https://app.tracklysms.com/api/v2/history/clear", {
  method: "DELETE",
  headers: {
    "X-Api-Key": "trk_your_api_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    entities: ["sends", "clicks", "revenue"],
    before_date: "2025-12-01T00:00:00Z",
    confirm: true,
  }),
});

const data = await response.json();
console.log(data);
{
  "success": true,
  "cleared": {
    "sends": 150,
    "clicks": 45,
    "revenue": 32
  }
}

Error Codes

HTTP StatusError CodeDescription
400missing_entitiesThe entities field is required and must be a non-empty array.
400confirm_requiredThe confirm field must be set to true to proceed.
400invalid_entitiesOne or more entity types are not valid. Must be sends, clicks, or revenue.

Next Steps

Reporting Overview

Understand your analytics

Bulk Create Contacts

Re-import after clearing