Skip to main content

Create Client Token to join a room.

POST 
/rooms/:room_id/actions/generate_join_client_token

Synchronously create an Client Token to join a Room. Client Token is necessary to join a Telnyx Room. Client Token will expire after token_ttl_secs, a Refresh Token is also provided to refresh a Client Token, the Refresh Token expires after refresh_token_ttl_secs.

Request

Path Parameters

    room_id uuidrequired

    The unique identifier of a room.

Body

required

Parameters that can be defined during Room Client Token creation.

    token_ttl_secs integer

    Possible values: >= 10 and <= 3600

    Default value: 600

    The time to live in seconds of the Client Token, after that time the Client Token is invalid and can't be used to join a Room.

    refresh_token_ttl_secs integer

    Possible values: >= 60 and <= 86400

    Default value: 3600

    The time to live in seconds of the Refresh Token, after that time the Refresh Token is invalid and can't be used to refresh Client Token.

Responses

201: Create room client token response.

403: Forbidden

Request samples


curl -L 'https://api.telnyx.com/v2/rooms/:room_id/actions/generate_join_client_token' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
-d '{
"token_ttl_secs": 600,
"refresh_token_ttl_secs": 3600
}'

Response samples


{
"data": {
"token": "eyJhbGciOiJFZDI1NTE5IiwidHlwIjoiSldUIn0.eyJhdWQiOiJ0ZWxueXhfYWNjZXNzX3Rva2VuIiwiZXhwIjoxNjE5MDk0Mjk1LCJncmFudHMiOlt7ImFjdGlvbnMiOlsiam9pbiJdLCJyZXNvdXJjZXMiOlsidGVsbnl4OnZpZGVvOnJvb21zOjllMmEwY2JlLWNlNjYtNDExZS1hMWFjLTQ2OGYwYjEwM2M5YSJdLCJzdWJqZWN0cyI6WyJ0ZWxueXg6dXNlcnM6NzgyYjJjYmUtODQ2Ni00ZTNmLWE0ZDMtOTc4MWViNTc3ZTUwIl19XSwiZ3JhbnRzX3ZlcnNpb24iOiIxLjAuMCIsImlhdCI6MTYxOTA5MzY5NSwiaXNzIjoidGVsbnl4X2FjY2Vzc190b2tlbiIsImp0aSI6IjllNjIyOTA2LTc1ZTctNDBiNi1iOTAwLTc1NGIxZjNlZDMyZiIsIm5iZ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