How to Fix 404 Errors when Using AI Tools with the Unusual Whales API
If you are using an AI-based software development suite like Cursor, Windsurf, ChatGPT, or Claude and getting errors like “404 Not Found” or “Something went wrong” we have a quick fix for you.
The Problem
AI tools sometimes hallucinate API endpoints, which means they suggest URLs that do not actually exist.
How to Fix It
- Visit https://api.unusualwhales.com/api/openapi
- Copy all the text (use Ctrl+A because there are more than 13K lines)
- Create a file named api_spec.yaml in your project
- Paste the copied text into this file and save it
- Tell your AI tool to only use endpoints from api_spec.yaml
Examples
Cursor
Let’s say we are starting from scratch in Cursor. The “setup” here was simply creating a directory for the project, then opening Cursor in that directory. I sent this generic prompt to build a trading app using the Unusual Whales API:
I would like to build a trading application in python using the Unusual Whales API

These endpoints do not exist and running this script would result in errors.
Let’s work through the steps from above to fix the issue. First, we navigate to https://api.unusualwhales.com/api/openapi and copy all the text with Ctrl+A. Next, we create an api_spec.yaml file in our trading app project:

Then we open the api_spec.yaml file and paste in all the copied text like this:

Finally, save the api_spec.yaml file. We are now ready to prompt Cursor to fix the endpoints! I entered the following prompt into the “Agent” screen and the results were perfect (i.e. all non-existent endpoints corrected):
I added the file api_spec.yaml to this project that includes all available endpoints from the Unusual Whales API, can you review the code you have written and make sure it only accesses endpoints that exist?

Windsurf
In Windsurf we have a similar setup where the initial build resulted in hallucinated endpoints. After following those same steps to create the api_spec.yaml file in the project, I was able to enter a similar prompt:
I saved the Unusual Whales API spec to the trading_app directory as api_spec.yaml, please review this file and correct all url routes in app.py that do not exist in the api_spec.yaml file

This 5-step approach is a bulletproof way to make sure your AI coding tools only use real endpoints from the Unusual Whales API.