First, you need to obtain your API key. To do this, create an account and log in. Once logged in, navigate to Account > Dashboard, where you will find your API key. It should look something like this:
That’s it! You’re all set. Simply open your favorite IDE, choose your preferred programming language, and make a request to your soon-to-be favorite website. To make things easier, I’ve included a Python code example; just replace API_KEY with your own and send your first request!
Once you run your program, there are a few possible outputs. Let’s start with the bad ones:
{"detail":"Not Found"}
– This means you’re not sending a request to the correct endpoint. Make sure you’re using /latest-news.
{"detail":"Invalid API key"}
– This one is pretty straightforward. Double-check that you’re using the API key we provided. If you’re certain it’s correct and suspect an issue on our end, feel free to reach out!
{"detail":[{"type":"missing","loc":["query","api_key"],"msg":"Field required","input":null}]}
– This indicates that the API key is missing from your request. Be sure to include it as a query parameter.
[]
– If you see an empty response, it likely means there’s no news available at the moment. But keep your hopes up! You’ll eventually see the good stuff—fresh news as soon as they’re posted. 🚀
Talking about the good stuff—here it is! When everything works correctly, your response will look something like this:
[{“Id”: “6539a678563a73ea0eed”,
“Source”: “The Times”,
“Title”: “Chancellor on Brink of Second Bailout for Banks”,
“Link”: “https://www.thetimes.com/6539a678563a7”,
“Ticker”: “BTC”,
“Date”: “2009-01-23T08:00:00Z”,
“Content”: “The Times 03/Jan/2009 Chancellor on Brink of Second Bailout for Banks”}]