A standard API request follows this format:
https://api.twelvedata.com/time_series?symbol=MMM&interval=1day&apikey=
In most cases, this approach works well; however, there are situations where it may be more efficient to request multiple symbols, endpoints, or technical indicators simultaneously. There are two primary methods to accomplish this.
Batch request
This type of request is ideal when querying multiple symbols from the same endpoint. Benefits include faster responses compared to individual requests, reduced data traffic, and simplified error handling. Symbols should be separated by a comma, and a colon can be used to specify the exchange if needed.
Example:
βhttps://api.twelvedata.com/time_series?symbol=MMM,SBIN:NSE,EUR/USD&interval=1day&apikey=YOUR_API_KEY
This approach is compatible with endpoints such as /time_series
, /quote
, /price
, /exchange_rate
, /currency_conversion
, /eod
, and others. However, note that each symbol in the request carries the same API weight. In the example above, the request consumes 3 API credits.
Complex request
This method is a more advanced version of batch requests, enabling you to construct and retrieve data from the API with any level of complexity. It exclusively supports POST requests, offering the flexibility to query multiple symbols, intervals, and endpoints simultaneously. For detailed information, parameters, and examples, refer to the documentation.