Chat / Platform API
Current version: v3
    Chat Platform API v3
    Chat Platform API
    Chat
    Platform API
    Home
    /
    Chat
    /
    Platform API

    Issue a session token

    Issues a session token for user authentication.

    Note: The /users/{user_id} endpoint is deprecated and replaced with /users/{user_id}/token endpoint for greater efficiency.


    HTTP request

    POST https://api-{application_id}.sendbird.com/v3/users/{user_id}/token
    

    Parameters

    The following table shows a parameter that this action supports.

    Required
    Parameter nameTypeDescription

    user_id

    string

    Specifies the unique ID of the user.


    Request body

    The following table shows a property of the HTTP request that this action supports.

    Optional
    NameTypeDescription

    expires_at

    long

    Specifies the expiration time of the new session token, in Unix milliseconds format. (Default: 7 days from the current timestamp)


    Response

    If successful, this action returns a user resource in the response body.

    {
        "user_id": "Jacob",
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlIjoxNTk4NjUxODE1LCJ1IjoxMjI0NzQ5ODEsInYiOjF9.CFbZ4iOsSt-1tUGQVjSY001K8_a6KJGZWO2VEeA4Edk",
        "expires_at": 1598651815000
    }
    

    List of response properties

    NameTypeDescription

    token

    string

    A user's session token generated by the /users/{user_id}/token endpoint.

    In the case of an error, an error object is returned. A detailed list of error codes is available here.