---
"@context": https://schema.org
"@type": TechArticle
"@id": https://www.twilio.com/docs/api/errors/51121#article
headline: "51121: Twilsock: Token expiration time exceeds maximum"
url: https://www.twilio.com/docs/api/errors/51121
inLanguage: en
dateModified: 2026-06-08T12:04:59.000Z
author:
  "@type": Organization
  name: Twilio Developer Education Team
publisher:
  "@type": Organization
  name: Twilio
---

# 51121: Twilsock: Token expiration time exceeds maximum

Log Level: ERROR

## Description

This error occurs when Twilsock receives an Access Token whose `exp` value is beyond the allowed lifetime. Twilio Access Tokens are short-lived `JWT` credentials, and their maximum age is 24 hours.

### Possible causes

* Your application generated the token with a `ttl` value greater than 86400 seconds. Twilio interprets `ttl` in seconds and limits Access Tokens to 24 hours.
* The token's `exp` claim is set more than 24 hours after issuance. Twilio uses `exp` as the expiration timestamp and limits token age to 24 hours.
* Your token generation logic used the wrong time unit or an incorrect timestamp calculation, which caused the expiration to exceed the allowed range. Access Token lifetime values are expressed in seconds.

### Possible solutions

* Generate a new Access Token with a `ttl` of 86400 seconds or less. Use the shortest lifetime that fits your application.
* If you set claims directly, verify that `exp` is no more than 24 hours after `iat` and that all time values are in seconds.
* Use a Twilio helper library to create the token so the `JWT` structure and claims are generated correctly. Twilio recommends helper libraries when troubleshooting invalid Access Tokens.
* For long-lived SDK sessions, refresh the token before it expires instead of extending a single token beyond the 24-hour limit. Conversations SDK clients can request a new token and call `updateToken` before expiration.

#### Additional resources

* [Access Tokens](/docs/iam/access-tokens)
* [Issuing Sync Tokens](/docs/sync/identity-and-access-tokens)
* [Troubleshooting Invalid Access Tokens](https://help.twilio.com/articles/115015890207-Troubleshooting-Invalid-Access-Tokens)
