# Issue session token is not working salesforce rest api call

**URL:** <https://community.sendbird.com/t/issue-session-token-is-not-working-salesforce-rest-api-call/6226>\
**Category:** JavaScript\
**Created:** [December 26, 2022, 5:05pm UTC](https://community.sendbird.com/t/issue-session-token-is-not-working-salesforce-rest-api-call/6226 "2022-12-26T17:05:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![saikrishna](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@saikrishna](https://community.sendbird.com/u/saikrishna)\
**Post date:** [December 26, 2022, 5:05pm UTC](https://community.sendbird.com/t/issue-session-token-is-not-working-salesforce-rest-api-call/6226/1 "2022-12-26T17:05:18Z")

</div>

Issuing session token is not working in salesforce rest api call. below request is returning with

```auto
{
    "error": true,
    "message": "Invalid value: \"JSON body.\".",
    "code": 400403
}

```

```auto
 HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
        string endpointUrl = 'https://api-FF2FEEA8-005C-4BAE-A25D-C578DE8B54D3.sendbird.com/v3/users/e90b91bb-d946-43d2-afec-325ea6ffc669/token';
        req.setEndpoint(endpointUrl);
        req.setMethod('POST');
        req.setHeader('Content-Type', 'application/json; charset=UTF-8');  
        req.setBody('{"user_id":"e90b91bb-d946-43d2-afec-325ea6ffc669"}');        
        try {
            res = http.send(req);
            if (res.getStatusCode() == 200) {
                System.debug('Success!');
                
            } else {
                System.debug('HTTP error: ' + res.getStatusCode());
            }
            System.debug(res.getBody());
        } catch(System.CalloutException e) {
            System.debug('Callout error: '+ e);
        }

```

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [December 27, 2022, 2:41am UTC](https://community.sendbird.com/t/issue-session-token-is-not-working-salesforce-rest-api-call/6226/2 "2022-12-27T02:41:31Z")

</div>

Hello @saikrishna,

Welcome to the Sendbird Community.

It looks like you’re passing an invalid JSON body to the request. The body does not take in a key value pair of `user_id` but rather a key value pair of `expires_at` with a unix timestamp. Alternatively, you can send an empty JSON body and use the default expiration date of 7 days.
