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

# Clear Execution Cache

> Clear the sandbox execution result cache to free memory using the HopX VM Agent API. Remove cached execution results to free resources, force re-execution, or reset cache statistics. Learn how to use POST /cache/clear endpoint to clear all cached results. Includes request examples and cache management.

Clear the execution result cache to free memory or force re-execution of previously cached code.

## Endpoint

```
POST /cache/clear
```

## Request

### Headers

```
Authorization: Bearer YOUR_JWT_TOKEN
```

### Example Request

```bash theme={null}
curl -X POST https://sandbox_abc123xyz.hopx.dev/cache/clear \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

## Response

### Success (200 OK)

```json theme={null}
{
  "message": "Cache cleared successfully",
  "cleared_entries": 25,
  "freed_bytes": 512000
}
```

## Status Codes

| Code | Description   |
| ---- | ------------- |
| 200  | Cache cleared |
| 401  | Unauthorized  |

## Use Cases

### Force Code Re-execution

```bash theme={null}
# Clear cache
curl -X POST https://sandbox_abc123xyz.hopx.dev/cache/clear \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

# Execute code (will not use cache)
curl -X POST https://sandbox_abc123xyz.hopx.dev/execute \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "print(\"Fresh execution\")",
    "language": "python"
  }'
```

## Related

* **SDK**: [sandbox.cache.clear()](/sdk/python/cache#clear) - Python SDK method
* [CLI System Commands](/cli/commands/system) - System operations from CLI

## Next Steps

* **[Get Cache Statistics](/api/vm-agent/get-cache-stats)** - View cache metrics
* **[Execute Code](/api/vm-agent/execute)** - Execute code
