---
title: "TTL"
url: "https://docs.yugabyte.com/stable/yedis/api/ttl/"
---

# TTL

## Synopsis

**`TTL key`**

Returns the remaining time to live of a key that has a timeout, in seconds.

## Return value

Returns TTL in seconds, encoded as integer response.

## Examples

You can do this as shown below.

```sh
$ SET yugakey "Yugabyte"
```

```
"OK"
```

```sh
$ EXPIRE yugakey 10
```

```
(integer) 1
```

```sh
$ TTL yugakey
```

```
(integer) 10
```

## See also

[`set`](/stable/yedis/api/set/ "set"), [`expire`](/stable/yedis/api/expire/ "expire"), [`expireat`](/stable/yedis/api/expireat/ "expireat"), [`pttl`](/stable/yedis/api/pttl/ "pttl")
