fresh-painting-88343
07/29/2025, 8:18 PMtall-airline-16756
07/29/2025, 8:18 PMtall-airline-16756
07/29/2025, 8:19 PMwith_ttl method in livekit.api.AccessToken accepts a single input parameter:
• ttl (type: datetime.timedelta) - The time-to-live duration for the access token.
Here is an example of how to use it:
from livekit import api
import datetime
token = api.AccessToken() \
.with_ttl(datetime.timedelta(hours=2)) \
.with_identity("user-123") \
.to_jwt()
The method returns the AccessToken instance, allowing for method chaining. If you don’t call with_ttl, the token will use the default TTL of 6 hours.
Sources: README.mdfresh-painting-88343
07/29/2025, 8:20 PMtall-airline-16756
07/29/2025, 8:21 PM