# Delete

The Delete API allows you to remove data from Telemetry. You can delete specific rows based on a condition or remove an entire table. Be cautious when using this API, as deleting data is irreversible.

<mark style="color:green;">**DELETE**</mark> **`https://api.telemetry.sh/delete`**

**Headers**

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| Content-Type  | String | application/json  |
| Authorization | String | \<YOUR\_API\_KEY> |

**Body**

| Name  | Type              | Description                            |
| ----- | ----------------- | -------------------------------------- |
| table | String            | The table you want to delete data from |
| where | String (optional) | SQL clause for what rows to delete     |

### Example usage with cURL

To delete all rows older than 3 days from the table named `uber_rides` using cURL, you can use the following command:

```bash
API_KEY="YOUR_API_KEY"
WHERE_CONDITION="timestamp <= (now() - INTERVAL '3 day')"

curl -X DELETE https://api.telemetry.sh/delete \
  -H "Content-Type: application/json" \
  -H "Authorization: $API_KEY" \
  -d @- <<EOF
{
  "table": "uber_rides",
  "where": "$WHERE_CONDITION"
}
EOF
```

If you want to delete the entire `uber_rides` table, simply omit the `where` field:

```bash
API_KEY="YOUR_API_KEY"

curl -X DELETE https://api.telemetry.sh/delete \
  -H "Content-Type: application/json" \
  -H "Authorization: $API_KEY" \
  -d '{
    "table": "uber_rides"
  }'
```

#### Important Notes

* **Data Deletion:** Be careful when using the delete endpoint. If the `where` condition is not provided, the entire table will be deleted.
* **Irreversibility:** Once data is deleted, it cannot be recovered.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.telemetry.sh/api-reference/delete.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
