---
"@context": https://schema.org
"@type": TechArticle
"@id": https://www.twilio.com/docs/api/errors/51006#article
headline: "51006: Client Connection: Connection expired"
url: https://www.twilio.com/docs/api/errors/51006
inLanguage: en
dateModified: 2026-06-09T11:00:42.000Z
author:
  "@type": Organization
  name: Twilio Developer Education Team
publisher:
  "@type": Organization
  name: Twilio
---

# 51006: Client Connection: Connection expired

Log Level: ERROR

## Description

The client connection expired because the Access Token used to authenticate the client is no longer valid. Twilio ends the connection when the token reaches the expiration time defined by the `exp` claim.

### Possible causes

* The Access Token expired before the client finished connecting or while the client was connected.
* Your application issued a token with an expiration time that is too short for the client session.
* The client did not refresh the Access Token before the current token expired.
* The device clock or your token generation logic caused the `exp` value to be set earlier than intended.

### Possible solutions

* Generate a new Access Token and reconnect the client.
* Refresh the Access Token before it expires, especially for long-lived client sessions.
* Review your token generation logic and confirm the `exp` claim allows enough time for the expected session length.
* If your app maintains persistent connections, implement token renewal in the client before expiration.
* Verify that the system time on the client device and the server generating tokens is accurate.

#### Additional resources

* [Access Tokens overview](/docs/iam/access-tokens)
* [Conversations SDKs and client initialization](/docs/conversations)
* [Programmable Chat documentation](/docs/chat)
