# Bad Request. No token or API key provided

**URL:** <https://community.dreamfactory.com/t/bad-request-no-token-or-api-key-provided/3552>\
**Category:** REST API\
**Created:** [January 5, 2017, 11:10am UTC](https://community.dreamfactory.com/t/bad-request-no-token-or-api-key-provided/3552 "2017-01-05T11:10:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![teksuser](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@teksuser](https://community.dreamfactory.com/u/teksuser)\
**Post date:** [January 5, 2017, 11:10am UTC](https://community.dreamfactory.com/t/bad-request-no-token-or-api-key-provided/3552/1 "2017-01-05T11:10:30Z")

</div>

I am trying to call other API using POST method. Also sending API key and session token in header. But it is returning error “Bad request. No token or api key provided.”. Following is my code:  
$options = [];  
$options[‘headers’] = [];  
$options[‘headers’][‘Content-Type’] = ‘application/json’;  
$options[‘headers’][‘X-DreamFactory-Api-Key’] = $platform[‘session’][‘api\_key’];  
$options[‘headers’][‘X-DreamFactory-Session-Token’] = $platform[‘session’][‘session\_token’];  
$api= $platform[“api”];  
$post= $api-\>post;  
$result = $post($url, $postbody,$options);

Can anyone please tell me what is wrong in above code?

---

<div class="post-metadata">

**Author:** ![teksuser](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@teksuser](https://community.dreamfactory.com/u/teksuser)\
**Post date:** [January 6, 2017, 9:28am UTC](https://community.dreamfactory.com/t/bad-request-no-token-or-api-key-provided/3552/2 "2017-01-06T09:28:31Z")

</div>

Finally I concluded that " $post($url, $postbody,$options);" is not identifying the payload or options.  
Can anyone tell me whether any setting required for Platform.api.POST? My DF version is 2.3.1.

---

<div class="post-metadata">

**Author:** ![mattschaer](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/mattschaer/32/914_2.png) [@mattschaer](https://community.dreamfactory.com/u/mattschaer)\
**Post date:** [January 6, 2017, 3:26pm UTC](https://community.dreamfactory.com/t/bad-request-no-token-or-api-key-provided/3552/3 "2017-01-06T15:26:52Z")

</div>

@teksuser can you tell me what you mean by other API? Is it an external/3rd party API ?

---

<div class="post-metadata">

**Author:** ![teksuser](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@teksuser](https://community.dreamfactory.com/u/teksuser)\
**Post date:** [January 7, 2017, 6:03am UTC](https://community.dreamfactory.com/t/bad-request-no-token-or-api-key-provided/3552/4 "2017-01-07T06:03:27Z")

</div>

It is external api (another DF service). I tested same code on another DF instance with version 2.4. It is working fine. So is that 2.3 bug or need any setting?
