> Calendly developer docs. For page Markdown, append .md to any URL.
> Index: https://developer.calendly.com/llms.txt
> API catalog: https://developer.calendly.com/.well-known/api-catalog
> OpenAPI: https://developer.calendly.com/openapi/calendly-api.yaml
> OAuth authorization server: https://calendly.com/.well-known/oauth-authorization-server
> MCP protected resource: https://mcp.calendly.com/.well-known/oauth-protected-resource
> Scheduling MCP endpoint: https://mcp.calendly.com
> Docs search MCP: https://developer.calendly.com/_mcp/server

# Delete Scheduled Event Data

POST https://api.calendly.com/data_compliance/deletion/events
Content-Type: application/json

> This endpoint requires an Enterprise subscription.

> `data_compliance:write`

To submit a request to remove scheduled events data within a time range for your organization, use this endpoint. Requests for data deletion can take up to 7 days to complete.

Time range can be no greater than 24 months and must occur in the past.

Reference: https://developer.calendly.com/api-docs/calendly-api/data-compliance/delete-scheduled-event-data

## Authentication

- `Authorization` header (bearer token, required) — OAuth 2.0
- `Authorization` header (bearer token, required) — Personal Access Token

## Request

### Body (application/json)

This endpoint expects an object.

- `start_time` (string, required) — The scheduled events UTC timestamp at which data deletion should begin.
- `end_time` (string, required) — The scheduled events UTC timestamp at which data deletion should end.

## Response

### 202

Accepted

## Errors

### 400 Bad Request Error

Request is not valid

- `title` (enum, required)
  - Allowed values: `Internal Server Error`
- `message` (enum, required)
  - Allowed values: `The server encountered an unexpected condition that prevented it from fulfilling the request.`
- `details` (list of ErrorResponseDetailsItem, optional)

### 401 Unauthorized Error

Cannot authenticate caller

- `title` (enum, required)
  - Allowed values: `Internal Server Error`
- `message` (enum, required)
  - Allowed values: `The server encountered an unexpected condition that prevented it from fulfilling the request.`
- `details` (list of ErrorResponseDetailsItem, optional)

### 403 Forbidden Error

Forbidden or insufficient scope

- `Delete-scheduled-event-dataRequestForbiddenError`

### 404 Not Found Error

Requested resource not found

- `title` (enum, required)
  - Allowed values: `Internal Server Error`
- `message` (enum, required)
  - Allowed values: `The server encountered an unexpected condition that prevented it from fulfilling the request.`
- `details` (list of ErrorResponseDetailsItem, optional)

### 500 Internal Server Error

An error has occurred on the server

- `title` (enum, required)
  - Allowed values: `Internal Server Error`
- `message` (enum, required)
  - Allowed values: `The server encountered an unexpected condition that prevented it from fulfilling the request.`
- `details` (list of ErrorResponseDetailsItem, optional)

## Types

### ErrorResponseDetailsItem

- `message` (string, required)
- `parameter` (string, optional)
- `code` (string, optional)

### DataComplianceError

Forbidden

- `details` (list of ErrorResponseDetailsItem, optional)
- `message` (string, optional)
- `title` (enum, optional)
  - Allowed values: `Permission Denied`

### InsufficientScopeError

Caller does not have required oauth scopes

- `title` (enum, required)
  - Allowed values: `Insufficient scope`
- `message` (enum, required)
  - Allowed values: `This operation requires the scopes listed in the 'required_scopes' array.`
- `required_scopes` (list of string, required)

## Examples

**Request**

```json
{
  "start_time": "2019-01-02T03:04:05.678123Z",
  "end_time": "2021-01-01T02:04:05.678123Z"
}
```

**Response**

```json
{}
```

**SDK Code**

```python Delete scheduled event data request
import requests

url = "https://api.calendly.com/data_compliance/deletion/events"

payload = {
    "start_time": "2019-01-02T03:04:05.678123Z",
    "end_time": "2021-01-01T02:04:05.678123Z"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Delete scheduled event data request
const url = 'https://api.calendly.com/data_compliance/deletion/events';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"start_time":"2019-01-02T03:04:05.678123Z","end_time":"2021-01-01T02:04:05.678123Z"}'
};

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

```go Delete scheduled event data request
package main

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

func main() {

	url := "https://api.calendly.com/data_compliance/deletion/events"

	payload := strings.NewReader("{\n  \"start_time\": \"2019-01-02T03:04:05.678123Z\",\n  \"end_time\": \"2021-01-01T02:04:05.678123Z\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Delete scheduled event data request
require 'uri'
require 'net/http'

url = URI("https://api.calendly.com/data_compliance/deletion/events")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"start_time\": \"2019-01-02T03:04:05.678123Z\",\n  \"end_time\": \"2021-01-01T02:04:05.678123Z\"\n}"

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

```java Delete scheduled event data request
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.calendly.com/data_compliance/deletion/events")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"start_time\": \"2019-01-02T03:04:05.678123Z\",\n  \"end_time\": \"2021-01-01T02:04:05.678123Z\"\n}")
  .asString();
```

```php Delete scheduled event data request
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.calendly.com/data_compliance/deletion/events', [
  'body' => '{
  "start_time": "2019-01-02T03:04:05.678123Z",
  "end_time": "2021-01-01T02:04:05.678123Z"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Delete scheduled event data request
using RestSharp;

var client = new RestClient("https://api.calendly.com/data_compliance/deletion/events");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"start_time\": \"2019-01-02T03:04:05.678123Z\",\n  \"end_time\": \"2021-01-01T02:04:05.678123Z\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Delete scheduled event data request
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "start_time": "2019-01-02T03:04:05.678123Z",
  "end_time": "2021-01-01T02:04:05.678123Z"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.calendly.com/data_compliance/deletion/events")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```