> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.tabs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.tabs.com/_mcp/server.

# Delete an event

DELETE https://usage-events.prod.api.tabsplatform.com/v1/events/{idempotencyKey}

Deletes a usage event by creating a new deletion event that links back to the original event. Requires valid authentication. Events can only be deleted through the API within 45 days of being created; after that, delete them from the Events table in the Tabs app.

Reference: https://docs.tabs.com/api-reference/events/deleteEventByKey

## Authentication

- `Authorization` header (required) — API Key authentication via header

## Request

### Path parameters

- `idempotencyKey` (string, required) — Event key of the event that should be deleted

## Response

### 200

Event deleted successfully

- `success` (boolean, optional) — Indicates if the operation was successful
- `message` (string, optional) — Human-readable message about the operation result
- `data` (EventData, optional) — Event data wrapper

## Errors

### 400 Bad Request Error

Bad request - Event not found, created more than 45 days ago, or invalid idempotency key

- `success` (boolean, optional) — Indicates if the operation was successful
- `message` (string, optional) — Human-readable error message
- `error` (ErrorDetail, optional) — Detailed error information

### 401 Unauthorized Error

Unauthorized - Invalid or missing API key

- `statusCode` (integer, optional) — HTTP status code
- `message` (string, optional) — Error message
- `timestamp` (string, optional) — Timestamp when the error occurred
- `path` (string, optional) — Request path
- `method` (string, optional) — HTTP method

### 429 Too Many Requests Error

Too Many Requests - Rate limit exceeded

- `statusCode` (integer, optional) — HTTP status code
- `message` (string, optional) — Error message
- `timestamp` (string, optional) — Timestamp when the error occurred
- `path` (string, optional) — Request path
- `method` (string, optional) — HTTP method
- `retryAfter` (integer, optional) — Number of seconds to wait before retrying

### 500 Internal Server Error

Internal Server Error

- `success` (boolean, optional) — Indicates if the operation was successful
- `message` (string, optional) — Human-readable error message
- `error` (ErrorDetail, optional) — Detailed error information

## Types

### EventData

Event data wrapper

- `events` (EventResponse, optional) — Event response data

### ErrorDetail

Detailed error information

- `code` (integer, optional) — Error code
- `message` (string, optional) — Error message
- `details` (map from string to list of string, optional) — Map of field names to array of error messages

### EventResponse

Event response data

- `customerId` (string, optional) — Tabs Customer ID - must be a valid UUID v4
- `eventTypeId` (string, optional) — Type of event being recorded - must be a valid UUID v4
- `datetime` (datetime, optional) — Timestamp when the event occurred (UTC) (format: ISO-8601 datetime string)
- `idempotencyKey` (string, optional) — Unique key to prevent duplicate event processing - must be a valid UUID v4
- `value` (double, optional) — Numeric value of the event
- `differentiator` (string, optional) — Optional key to separate events with the same event type and customer into different invoice line items; differentiator will be appended to the description of the new invoice line item
- `invoiceSplitKey` (string, optional) — Optional key to split events into a new invoice; the split key will be appended to the new invoice number
- `parentEventId` (string, optional) — Parent event ID - the idempotency key of the original event that was deleted (only present in DELETE responses)
- `metadata` (map from string to EventResponseMetadata, optional) — Optional metadata in JSON format

### EventResponseMetadata

Optional metadata in JSON format

## Examples

**Response**

```json
{
  "success": true,
  "message": "Event deleted successfully",
  "data": {
    "events": {
      "customerId": "550e8400-e29b-41d4-a716-446655440000",
      "eventTypeId": "550e8400-e29b-41d4-a716-446655440000",
      "datetime": "2024-01-15T10:30:00Z",
      "idempotencyKey": "018c1234-5678-7abc-def0-123456789abc",
      "value": -1,
      "parentEventId": "018c1234-5678-7abc-def0-123456789000"
    }
  }
}
```

**SDK Code**

```python Success Response
import requests

url = "https://usage-events.prod.api.tabsplatform.com/v1/events/idempotencyKey"

headers = {"Authorization": "<apiKey>"}

response = requests.delete(url, headers=headers)

print(response.json())
```

```javascript Success Response
const url = 'https://usage-events.prod.api.tabsplatform.com/v1/events/idempotencyKey';
const options = {method: 'DELETE', headers: {Authorization: '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Success Response
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://usage-events.prod.api.tabsplatform.com/v1/events/idempotencyKey"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("Authorization", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Success Response
require 'uri'
require 'net/http'

url = URI("https://usage-events.prod.api.tabsplatform.com/v1/events/idempotencyKey")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Success Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://usage-events.prod.api.tabsplatform.com/v1/events/idempotencyKey")
  .header("Authorization", "<apiKey>")
  .asString();
```

```php Success Response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://usage-events.prod.api.tabsplatform.com/v1/events/idempotencyKey', [
  'headers' => [
    'Authorization' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Success Response
using RestSharp;

var client = new RestClient("https://usage-events.prod.api.tabsplatform.com/v1/events/idempotencyKey");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Success Response
import Foundation

let headers = ["Authorization": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://usage-events.prod.api.tabsplatform.com/v1/events/idempotencyKey")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```