In this article, we will focus on how consumption of credit works and it’s affects on API usage. Moreover, we will also focus on why it matters for developers and businesses alike.
Understanding NewsData.io Credit System
Credits act as the currency of the API, and each user account is allocated a certain number of credits as per their subscription plan. Every API request made by a user consumes 1 credit, which will fetch them articles according to their plans.
How Consumption System Works in NewsData.io
Free users receive 200 credits/day. For paid basic, professional, and corporate users it is 20,000, 50,000, and 3,00,000 credits/month, respectively.
When a user makes a request, the API provides 10 articles/credit for free and 50 articles/credit for paid users. Credits are consumed each time a user makes a request.
- Suppose my query is Pizza, then the parameter would be:
https://newsdata.io/api/1/latest?apikey=pub_YOUR_API_KEY&q=pizza
This query would consume 1 credit and fetch articles as per the chosen plan.If you go to the next page then, one more API credit will be consumed.
To know more about how to go next page, click here.
- You can also customize the size of the response. This means you can customize how many articles you want to receive when you hit the API credit. You can customize with the given request:
https://newsdata.io/api/1/latest?apikey=pub_YOUR_API_KEY&q=YOUR_QUERY&size=30
The given request will fetch you 30 articles.
NOTE: Only paid user can access to more than 10 articles. Also, you must note that 1 credit will be used regardless of the size of the article.
- You can also include parameters like q, qInTitle or qInMeta, category, language, timeframe, etc as well in a single request.
https://newsdata.io/api/1/latest?apikey=pub_35468960b26fdf480e824a9d57ce67e2e01a7&q=covid&country=in,gb&language=en&category=business,domestic
The given request will fetch your data on ‘q=covid’ from ‘India and the United Kingdom’ in the ‘English’ language and from the ‘business and domestic’ categories.
NOTE: The credit used for the given query will still be 1. Regardless of the number of filters inserted in a single request, the credit consumed would be still 1.
Credit Consumption in NewsData.io Dashboard
If you are requesting through the dashboard of NewsData.io, then every time you move to the next page, the credits are consumed.
For instance, if a user has a subscription plan that grants them 1000 credits/month. He proceeds to make an API request that consumes 5 credits, then their remaining credit balance will be 995 credits.
If they continue to make requests, the credit balance will decrease accordingly. This continues until it reaches zero or the end of the billing cycle.
Note: Credit limits are reset at the beginning of each billing cycle, which is usually monthly, depending on the user’s subscription plan.
Credit Consumption in NewsData.io Python Client
The credit consumption while fetching data on Python Client differs from that through the dashboard of Newsdata.io. The credit consumption here varies as per the method of pagination chosen.
- Suppose you want to extract 1000 articles and your query is ‘pizza’. The request parameter will be:
api = NewsDataApiClient(apikey="YOUR_API_KEY")
response = api.news_api(q='pizza',scroll=True,max_result=1000)
print(response)
The given request parameter will fetch 1000 articles using the ‘max_request’ parameter. This ensures that the specified number ofarticles are only fetched automatically without exhausting credits available.
A user with a maximum limit of 50 articles/credit, would consume 20 credits in order to fetch 1000 articles.
Hello, Curious Minds!
Welcome to my corner of the digital world, a space brimming with words and woven with ideas. Fresh out of the rigorous trenches of an Economics honors degree at the esteemed University of Delhi, I know a thing or two about crunching numbers and dissecting trends. But beyond the world of graphs and equations, lies my love for reading and writing. Admittedly, I’m a newbie in the content writing scene, still tasting the ink of fresh beginnings. I believe every corner of life holds a story waiting to be told, and I’m eager to be your storyteller. So, strap yourselves in, dear readers, and let’s dive into the captivating world of words together!
P.S. Feel free to drop a comment or reach out – I’m always up for a good conversation!