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

# Delete an execution

DELETE https://clients.infonite.tech/api/executions/handler/v1/{execution_id}/delete

Delete an execution and everything retrieved under it.

This is a purge, not an archive: the execution, its state, its records and its attachments are removed and cannot be recovered. **Call it as soon as you have stored what you need** — the fastest way to protect somebody's financial data is not to be holding it.

**Irreversible, and it takes the data with it.** After this call the id answers `404` exactly like one that never existed — not a *deleted* marker, not an empty result. Read [the results](api:GET/executions/results/\{execution_id}/customer/v1/profile) first.

| Status | Meaning                                                                                                                                                                   |
| :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `204`  | Gone. No body.                                                                                                                                                            |
| `404`  | No such execution for your application, or it was already deleted.                                                                                                        |
| `409`  | **It is still running.** Only a closed execution can be deleted — [stop it](api:DELETE/executions/handler/v1/\{execution_id}/abort) first, or wait for the `ended` event. |

Executions you never delete are removed on their own after the platform's retention period, but that is a safety net rather than a policy: data minimisation is yours to drive, and this is the call that drives it.

**Server to server only.** This call is authorised with your application secret: it belongs in your backend, never in a browser, a mobile app or anything your customer can read.

Reference: https://infonite.dev/api-reference/direct-executions/direct-executions-api/handling-the-state/direct-executions-v-1-handler-delete

## Authentication

- `X-APP-SECRET` header (required) — Application Secret

## Servers

- `https://clients.infonite.tech/api` (Legacy Server, default)
- `https://clients.infonite.io/api` (Production Server)

## Request

### Path parameters

- `execution_id` (string, required) — The execution, as the acceptance response returned it.

## Response

### 204

**204 No Content**Gone — the execution, its state and the records it retrieved. From here on the id answers `404` exactly like one that never existed. No body.

## Errors

### 404 Not Found Error

**404 Not Found**No execution with that id for your application, or it was already deleted.

- `detail` (string, required) — Error message

### 409 Conflict Error

**409 Conflict**It is still running. Only a closed execution can be deleted — stop it first with [Stop an execution](api:DELETE/executions/handler/v1/\{execution_id}/abort), or wait for it to end.

- `detail` (string, required) — Error message

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of object, optional)
  - `loc` (list of string or integer, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any, optional)
  - `ctx` (object, optional)

## Examples

**SDK Code**

```python
import requests

url = "https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/delete"

headers = {"X-APP-SECRET": "<apiKey>"}

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

print(response.json())
```

```javascript
const url = 'https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/delete';
const options = {method: 'DELETE', headers: {'X-APP-SECRET': '<apiKey>'}};

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

```go
package main

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

func main() {

	url := "https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/delete"

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

	req.Header.Add("X-APP-SECRET", "<apiKey>")

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

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

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

}
```

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

url = URI("https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/delete")

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

request = Net::HTTP::Delete.new(url)
request["X-APP-SECRET"] = '<apiKey>'

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

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

HttpResponse<String> response = Unirest.delete("https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/delete")
  .header("X-APP-SECRET", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/delete', [
  'headers' => [
    'X-APP-SECRET' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/delete");
var request = new RestRequest(Method.DELETE);
request.AddHeader("X-APP-SECRET", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-APP-SECRET": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36/delete")! 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()
```