Eurostat Historical Data
Use the following API endpoints to obtain Eurostat historical data.
The historical endpoint contains a time series with an indicator identifier, the reference date, the last update date and the observed value. It allows one to check the evolution of key indicators over time.
By ID
Using Requests:
Python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/eurostat/historical/24804?c={your_api_key}'
data = requests.get(url).json()
print(data)Or using our package:
Python
import tradingeconomics as te
te.login('your_api_key')
te.getHistoricalEurostat(ID = '24804')Using Requests:
JavaScript
const axios = require('axios');
(async () => {
const your_api_key = 'your_api_key'
const response = await axios.get(`https://api.tradingeconomics.com/eurostat/historical/24804?c=${your_api_key}`)
console.log(response.data)
})()Or using our package:
JavaScript
const te = require('tradingeconomics');
te.login('your_api_key');
data = te.getEurostatHistorical(id = '24804').then(function(data){
console.log(data)
});Using Requests:
C#
using (var httpClient = new HttpClient())
{
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/eurostat/historical/24804?c=your_api_key"))
{
request.Headers.TryAddWithoutValidation("Upgrade-Insecure-Requests", "1");
var response = await httpClient.SendAsync(request);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
}The response data format can be configured by appending the &f= parameter to the URL request.
Text
https://api.tradingeconomics.com/eurostat/historical/{id}?c={your_api_key}&f=jsonJSON
[
{
"ID": 24804,
"Date": "2020-12-31T00:00:00",
"Value": 2.4,
"LastUpdate": "2021-04-20T23:16:00"
},
{
"ID": 24804,
"Date": "2019-12-31T00:00:00",
"Value": 1.8,
"LastUpdate": "2020-07-02T17:46:00"
},
{
"ID": 24804,
"Date": "2018-12-31T00:00:00",
"Value": 2.1,
"LastUpdate": "2020-07-02T17:46:00"
}
]Text
https://api.tradingeconomics.com/eurostat/historical/{id}?c={your_api_key}&f=csvBash
ID,Date,Value,LastUpdate
24804,12/31/2020 12:00:00 AM,2.4000,4/20/2021 11:16:00 PM
24804,12/31/2019 12:00:00 AM,1.8000,7/2/2020 5:46:00 PM
24804,12/31/2018 12:00:00 AM,2.1000,7/2/2020 5:46:00 PMText
https://api.tradingeconomics.com/eurostat/historical/{id}?c={your_api_key}| ID | Date | Value | LastUpdate |
|---|---|---|---|
| 24804 | 12/31/2020 12:00:00 AM | 2.4000 | 4/20/2021 11:16:00 PM |
| 24804 | 12/31/2019 12:00:00 AM | 1.8000 | 7/2/2020 5:46:00 PM |
| 24804 | 12/31/2018 12:00:00 AM | 2.1000 | 7/2/2020 5:46:00 PM |
By ID and date
Using Requests:
Python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/eurostat/historical/24804?d1=2015-01-01&c={your_api_key}'
data = requests.get(url).json()
print(data)Or using our package:
Python
te.getHistoricalEurostat(ID = '24804', initDate = '2015-01-01')With end date:
Python
te.getHistoricalEurostat(ID = '24804', initDate = '2016-01-01',
endDate = '2020-01-01')Using Requests:
JavaScript
const axios = require('axios');
(async () => {
const your_api_key = 'your_api_key'
const response = await axios.get(`https://api.tradingeconomics.com/eurostat/historical/24804?d1=2015-01-01&c=${your_api_key}`)
console.log(response.data)
})()Or using our package:
JavaScript
data = te.getEurostatHistorical(id = '24804', start_date = '2016-01-01').then(function(data){
console.log(data)
});With end date:
JavaScript
data = te.getEurostatHistorical(id = '24804', start_date = '2016-01-01',
end_date = '2020-01-01').then(function(data){
console.log(data)
});Using Requests:
C#
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/eurostat/historical/24804?d1=2015-01-01&c=your_api_key"))Text
https://api.tradingeconomics.com/eurostat/historical/{id}?c={your_api_key}&d1={yyyy-mm-dd}&f=jsonJSON
[
{
"ID": 24804,
"Date": "2020-12-31T00:00:00",
"Value": 2.4,
"LastUpdate": "2021-04-20T23:16:00"
},
{
"ID": 24804,
"Date": "2019-12-31T00:00:00",
"Value": 1.8,
"LastUpdate": "2020-07-02T17:46:00"
},
{
"ID": 24804,
"Date": "2018-12-31T00:00:00",
"Value": 2.1,
"LastUpdate": "2020-07-02T17:46:00"
}
]Text
https://api.tradingeconomics.com/eurostat/historical/{id}?c={your_api_key}&d1={yyyy-mm-dd}&f=csvBash
ID,Date,Value,LastUpdate
24804,12/31/2020 12:00:00 AM,2.4000,4/20/2021 11:16:00 PM
24804,12/31/2019 12:00:00 AM,1.8000,7/2/2020 5:46:00 PM
24804,12/31/2018 12:00:00 AM,2.1000,7/2/2020 5:46:00 PMText
https://api.tradingeconomics.com/eurostat/historical/{id}?c={your_api_key}&d1={yyyy-mm-dd}| ID | Date | Value | LastUpdate |
|---|---|---|---|
| 24804 | 12/31/2020 12:00:00 AM | 2.4000 | 4/20/2021 11:16:00 PM |
| 24804 | 12/31/2019 12:00:00 AM | 1.8000 | 7/2/2020 5:46:00 PM |
| 24804 | 12/31/2018 12:00:00 AM | 2.1000 | 7/2/2020 5:46:00 PM |
Response fields
| Field | Type | Description | Example |
|---|---|---|---|
| ID | number | Trading Economics unique identifier | 24804 |
| Date | string | Release date and time in UTC | “2020-12-31T00:00:00” |
| Value | number | Reported value of the indicator | 2.4000 |
| LastUpdate | string | Timestamp when the data was last inserted or updated | “2021-04-20T23:16:00” |