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

# POST /v1/capsules/{id}/ping — Reset inactivity timer

> POST /v1/capsules/{id}/ping — Reset the capsule's inactivity timer to prevent auto-pause. Use as a keepalive for idle but active capsules.

Use this endpoint to reset the inactivity timer on a running capsule. When a capsule is created with a non-zero `timeout_sec`, Wrenn automatically pauses it after that many seconds with no exec calls. Calling ping updates the `last_active_at` timestamp, restarting the countdown. Use it as a keepalive when your application is holding a capsule open but not actively executing commands.

<Note>
  If `timeout_sec` is `0` (auto-pause disabled), this endpoint still accepts the request and returns `204` — it simply has no effect on the TTL.
</Note>

## Endpoint

```http theme={null}
POST https://app.wrenn.dev/api/v1/capsules/{id}/ping
```

## Authentication

Pass your API key in the `X-API-Key` header.

```http theme={null}
X-API-Key: wrn_your_key
```

## Path parameters

<ParamField path="id" type="string" required>
  The ID of the capsule to ping (e.g., `cl-abc123`). The capsule must be in `running` status.
</ParamField>

## Response

Returns `204 No Content` on success. The response body is empty. The capsule's `last_active_at` timestamp is updated server-side.

## curl

```bash theme={null}
curl --request POST \
  --url https://app.wrenn.dev/api/v1/capsules/cl-abc123/ping \
  --header 'X-API-Key: wrn_your_key'
```

## Python SDK

```python theme={null}
from wrenn import Capsule

capsule = Capsule.connect("cl-abc123")
capsule.ping()
```

You can set up a periodic keepalive in a background thread or async task:

```python theme={null}
import threading
import time
from wrenn import Capsule

def keepalive(capsule, interval=60):
    while True:
        time.sleep(interval)
        try:
            capsule.ping()
        except Exception:
            break

capsule = Capsule(template="minimal", wait=True)
t = threading.Thread(target=keepalive, args=(capsule,), daemon=True)
t.start()

# Your main logic here — the capsule won't auto-pause while keepalive runs
```

## Error responses

| Status             | Description                                                                  |
| ------------------ | ---------------------------------------------------------------------------- |
| `401 Unauthorized` | Missing or invalid `X-API-Key`.                                              |
| `404 Not Found`    | No capsule with the given ID exists in your team.                            |
| `409 Conflict`     | The capsule is not in `running` status. You can only ping a running capsule. |
