# TTL, EXPIRE, EXPIREAT, and PERSIST

This page covers the ToriiDB commands that read, set, and remove a key's expiry.

## Expiration

```text
TTL <key>
EXPIRE <key> <seconds>
EXPIREAT <key> <timestamp>
PERSIST <key>
```

| Command | Response rules |
|---|---|
| `TTL` | `(integer) -1` without expiry; `(nil)` when missing or expired |
| `EXPIRE` | `error: seconds must be a positive integer` for `<= 0` or non-integer; `(nil)` when missing |
| `EXPIREAT` | `error: timestamp must be a valid integer`; `(nil)` when missing |
| `PERSIST` | `(nil)` when missing |

## Related Pages

- [Expiration](/core-concepts-expiration)
- [Command Summary](/cli-reference)
- [SET, DEL, INCR](/cli-reference-write)
