# API-Undefined error

**URL:** https://community.thunkable.com/t/api-undefined-error/3884320
**Category:** Issues / Bugs
**Created:** [June 1, 2025, 12:11am UTC](https://community.thunkable.com/t/api-undefined-error/3884320 "2025-06-01T00:11:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![shaydentimej95ceq](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@shaydentimej95ceq](https://community.thunkable.com/u/shaydentimej95ceq)
#### Post date: [June 1, 2025, 12:11am UTC](https://community.thunkable.com/t/api-undefined-error/3884320/1 "2025-06-01T00:11:07Z")

</div>

I’m having trouble getting OpenAI to work. I added money, set my API key, and wrote some code. After fixing some errors, I got an “undefined” response. I tried using objects, but then got “null” instead. I did some research, but nothing worked.

When I checked the error, it showed

:{  
“error”: {  
“message”: “Missing bearer or basic authentication in header”,  
“type”: “invalid\_request\_error”,  
“param”: null,  
“code”: null  
}  
}

Not sure what to do next—any help would be appreciated.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/6/e6bc603a518ea153ba128e9ff428edb2cf6ff118.png)  
 ![Screenshot 2025-05-31 200216](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/4/74f00ea8058ed0e9986d3b5ab8309eda6e8f4038.png)
