> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galadriel.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Terminate Lease

> Terminate an active lease early

## Path Parameters

<ParamField path="lease_id" type="string" required>
  The lease ID to terminate
</ParamField>

## Response

<ResponseField name="lease_id" type="string">
  The terminated lease ID
</ResponseField>

<ResponseField name="terminated_at" type="string">
  When the lease was terminated
</ResponseField>

<ResponseField name="refund_amount" type="number">
  Prorated refund for unused time
</ResponseField>

<Note>
  Termination is immediate. All pods will be deleted and access will be revoked within 60 seconds.
</Note>

<Warning>
  This action cannot be undone. Consider reselling unused time instead to recover more money.
</Warning>

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE https://api.galadriel.com/v1/leases/lse_xyz123 \
    -H "Authorization: Bearer YOUR_API_TOKEN"
  ```

  ```python Python theme={null}
  import requests

  response = requests.delete(
      "https://api.galadriel.com/v1/leases/lse_xyz123",
      headers={"Authorization": "Bearer YOUR_API_TOKEN"}
  )

  result = response.json()
  print(f"Lease terminated: {result['lease_id']}")
  print(f"Refund: ${result['refund_amount']}")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.galadriel.com/v1/leases/lse_xyz123',
    {
      method: 'DELETE',
      headers: {
        'Authorization': 'Bearer YOUR_API_TOKEN'
      }
    }
  );

  const result = await response.json();
  console.log(`Lease terminated: ${result.lease_id}`);
  console.log(`Refund: $${result.refund_amount}`);
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "lease_id": "lse_xyz123",
    "status": "terminated",
    "terminated_at": "2025-11-11T18:00:00Z",
    "original_end_time": "2025-11-12T14:00:00Z",
    "hours_used": 4.0,
    "hours_remaining": 20.0,
    "rate": 1.40,
    "refund_amount": 448.00,
    "refunded_at": "2025-11-11T18:00:01Z"
  }
  ```
</ResponseExample>

## What Happens on Termination

1. **Immediate**: All running pods are deleted
2. **Within 60 seconds**:
   * Kubeconfig is invalidated
   * SSH access is revoked
   * Namespace is cleaned up
3. **Within 5 minutes**: Refund is credited to your account

## Alternative: Resell Instead

Consider reselling unused time to recover more money:

```bash theme={null}
# Instead of terminating
curl -X DELETE https://api.galadriel.com/v1/leases/lse_xyz123

# Resell for better recovery
curl -X POST https://api.galadriel.com/v1/leases/lse_xyz123/resell \
  -d '{"limit_price": 1.20}'
```

See the [Reselling Guide](/marketplace/reselling) for details.
