/ Platform API
Platform API
    Chat Platform API v3
    Chat Platform API
    Chat Platform API
    Version 3

    Issue a session token

    Copy link

    This action issues a session token for user authentication. Session tokens provide an efficient stateless authentication method by not storing the tokens in the Sendbird database, and thus improving the server's performance. See access token vs. session token to learn more about authenticating users.

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


    HTTP request

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

    Parameters

    Copy link

    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

    Copy link

    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. By default, the expiration time of a session token is seven days from the timestamp when the token was issued.


    Responses

    Copy link

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

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

    List of response properties

    Copy link
    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 like below is returned. See the error codes section for more details.

    {
        "message": "\"User\" not found.",
        "code": 400201,
        "error": true
    }