Skip to content
Docs
Get API key
Get started

Trading Economics API Authentication

Details of API Authentication

To access the API, subscribe to a plan and get your API key at developer.tradingeconomics.com. You can pass the key as a c or client URL parameter, or using a more secure way, passing an Authorization HTTP header:

Authentication

Python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/country/mexico?c={your_api_key}'
data = requests.get(url).json()
print(data)

The response data format can be configured by appending the &f= parameter to the URL request (supported formats: JSON or CSV)

Python
url = f'https://api.tradingeconomics.com/country/mexico?c={your_api_key}&f=csv'

You can use request headers to pass the API key:

Python
import requests

response = requests.get('https://api.tradingeconomics.com/country/mexico', headers = {'Authorization': 'your_api_key'})
print(response.json())