How Do API Credits Work?
Each API call uses one API credit for up to the first KB of data returned. For each additional 38 KB of data returned, one additional API credit is used. So the amount of API credits you will need depends on the amount of API calls you will make and the response size of those API calls.
Granularity Note: We round down the credits used to the nearest one thousandth of a credit (a.k.a 0.001 credits).
Example 1: An API call to our real-time stock prices endpoint querying the price of AAPL, AMZN, TSLA, MSFT, META, GOOG, and NFLX at the same time will only use 1 API credit because the response size is under 1 KB.
Example 2: An API call to our real-time stock prices endpoint querying the price of all US stocks (8,000+ stocks) at the same time will use roughly 20 api credits as the response size will be roughly 725kb. 1 API credit will be charged for the first 1kb of data and an additional 19.052 credits will be charged for the remaining 724kb of data for a total of 20.052 credits [Math: 1 + (724/38)].
Tips To Increase API Credits Efficiency
By following the tips below you can make your api credits go a long way which can save you money as you will be able to avoid having to upgrade plans.
TIP 1: You can maximize your API credit use by requesting only the fields you care about which reduces the response size. This also improves response latency as less data needs to be transferred across the internet.
TIP 2: When applicable, you can maximize your API credit use by making one larger request instead of several smaller requests. For instance, one real-time price request to each individual US stock would take up 8,000+ api credits (1 for each stock). However, one real-time price request for all US stocks at once, would only take up about 16 API credits as per Example 2 above.
TIP 3: Try to stick to jsonarray or csv format when making API calls as these two formats are much less data intensive than traditional json format. This also improves response latency as less data needs to be transferred across the internet. Click here to learn more about the different types of data formats available for the API.
TIP 4: You can see how many credits will be used by an API call by adding the "&apiCreditsUsed=true" parameter to any API request url which will respond to you the amount of API credits that would be used if you made that API call. You can utilize this to examine which API calls may be the most efficient in terms of API credit use.