> ## Documentation index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Search it with GET https://upstash.com/docs/search?q=<query>.
> Use these to discover all available pages before exploring further.

# TTL

> Return the expiration in seconds of a key.

## Arguments

<ParamField body="key" type="string" required>
  The key 
</ParamField>

## Response

<ResponseField type="integer" required>
  The number of seconds until this expires, negative if the key does not exist or does not have an expiration set.
</ResponseField>

<RequestExample>
```ts Example
const seconds = await redis.ttl(key);
```
</RequestExample>
