---
# @generated by sylphx-gen. Do not edit.
title: "Cancel exec on a lease"
description: "`sandboxes.leases.cancel_exec` (POST /v1/{name}:cancelExec): Requests cancellation of the existing execution key."
type: reference
product: sandboxes
summary: "Requests cancellation of the existing execution key."
updated: 2026-09-28
nav: false
---

Requests cancellation of the existing execution key. This acknowledgement means the request was recorded, not that the process has stopped. Observe the exact original ExecLease request for its confirmed terminal result. An already completed result wins; an unknown outcome remains unknown.

- **Path** `POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/leases/lease:cancelExec`
- **Scope** `sandboxes:exec`
- **Effect** `write` — a successful call changes state.
- **Collection** [leases](/docs/api/leases)

## Request

| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | The name of the lease. Required. |
| `idempotency_key` | `string` | The execution key from the original ExecLease request. Required. |

## Response

The call answers with an empty object.

## Errors

- [`UNAUTHENTICATED`](/docs/api/errors/UNAUTHENTICATED) — No valid key or token was presented.
- [`PERMISSION_DENIED`](/docs/api/errors/PERMISSION_DENIED) — The key lacks the method's permission.
- [`RESOURCE_NOT_FOUND`](/docs/api/errors/RESOURCE_NOT_FOUND) — The named Resource does not exist or is not visible.
- [`STALE_GENERATION`](/docs/api/errors/STALE_GENERATION) — The call named a lease generation or control epoch that is no longer current.

Every error arrives in the body [Errors](/docs/platform/errors) describes.

## Examples

**cURL**

```curl
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/leases/lease:cancelExec" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"idempotency_key":"…"}'
```

**TypeScript**

```ts
await sylphx.sandboxes.leases.cancelExec({ idempotencyKey: '…', name: 'orgs/acme/projects/shop/envs/production/leases/lease' })
```

**Rust**

```rust
let mut req = sylphx::sandboxes::CancelExecLeaseRequest::default();
req.idempotency_key = "…".to_string();
req.name = "orgs/acme/projects/shop/envs/production/leases/lease".to_string();
sx.sandboxes().leases().cancel_exec(req).await?;
```

**CLI**

```bash
sylphx sandboxes leases cancel-exec orgs/acme/projects/shop/envs/production/leases/lease
```

**MCP**

```json
{ "method_id": "sandboxes.leases.cancel_exec", "args": {"idempotency_key":"…","name":"orgs/acme/projects/shop/envs/production/leases/lease"} }
```
