# Indicators Historical Data

> The following API endpoints allow you to obtain historical data for more than 200 indicators.

Source: https://docs.tradingeconomics.com/indicators/historical/

The historical endpoint contains a time series with fields such as country, category, datetime, close, frequency, historicalDataSymbol, lastupdate, and observed value. It allows one to check the evolution of key indicators over time.

## By country and indicator

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/historical/country/mexico/indicator/gdp?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.getHistoricalData(country='mexico', indicator='gdp')
```

*With multi countries and indicators:*
```python
te.getHistoricalData(country=['mexico', 'sweden'], indicator=['gdp','population'], 
 initDate='2015-01-01')
```

**JS**
*Using Requests:*
```js
const axios = require('axios');
(async () => {
    const your_api_key = 'your_api_key'
    const response = await axios.get(`https://api.tradingeconomics.com/historical/country/mexico/indicator/gdp?c=${your_api_key}`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
const te = require('tradingeconomics');
te.login('your_api_key');
data = te.getHistoricalData(country = 'mexico', indicator = 'gdp').then(function(data){
  console.log(data)       
});
```

*With multi countries and indicators:*
```javascript
data = te.getHistoricalData(country = ['mexico','sweden'], indicator = ['gdp','population'], 
 start_date = '2015-01-01').then(function(data){
  console.log(data)
});
```

**C#**
*Using Requests:*
```c#
using (var httpClient = new HttpClient())
{
    using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/historical/country/mexico/indicator/gdp?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);
        }
    }
}
```

*With multi countries and indicators:*
```c#
new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/historical/country/mexico,sweden/indicator/gdp,population/2015-01-01?c=your_api_key");
```

The response data format can be configured by appending the **&f=** parameter to the URL request.

**JSON**
```text
https://api.tradingeconomics.com/historical/country/{country}/indicator/{indicator}?c={your_api_key}&f=json
```
```json
[
  {
    "Country": "Mexico",
    "Category": "GDP",
    "DateTime": "2020-12-31T00:00:00",
    "Value": 1090.51,
    "Frequency": "Yearly",
    "HistoricalDataSymbol": "WGDPMEXI",
    "LastUpdate": "2023-06-30T15:54:00"
  },
  {
    "Country": "Mexico",
    "Category": "GDP",
    "DateTime": "2021-12-31T00:00:00",
    "Value": 1272.84,
    "Frequency": "Yearly",
    "HistoricalDataSymbol": "WGDPMEXI",
    "LastUpdate": "2022-12-30T12:46:00"
  },
  {
    "Country": "Mexico",
    "Category": "GDP",
    "DateTime": "2022-12-31T00:00:00",
    "Value": 1414.19,
    "Frequency": "Yearly",
    "HistoricalDataSymbol": "WGDPMEXI",
    "LastUpdate": "2023-06-30T15:54:00"
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/historical/country/{country}/indicator/{indicator}?c={your_api_key}&f=csv
```
```bash
Country,Category,DateTime,Close,Frequency,HistoricalDataSymbol,LastUpdate
Mexico,GDP,12/31/2020 12:00:00 AM,1090.5100,Yearly,WGDPMEXI,6/30/2023 3:54:00 PM
Mexico,GDP,12/31/2021 12:00:00 AM,1272.8400,Yearly,WGDPMEXI,12/30/2022 12:46:00 PM
Mexico,GDP,12/31/2022 12:00:00 AM,1414.1900,Yearly,WGDPMEXI,6/30/2023 3:54:00 PM
```

**HTML**
```text
https://api.tradingeconomics.com/historical/country/{country}/indicator/{indicator}?c={your_api_key}
```

| Country | Category | DateTime | Close | Frequency | HistoricalDataSymbol | LastUpdate |
|-------|-------|-------|-------|-------|-------|-------|
| Mexico | GDP | 12/31/2022 12:00:00 AM	| 1414.1900 | Yearly | WGDPMEXI | 6/30/2023 3:54:00 PM | 
| Mexico | Population | 12/31/2022 12:00:00 AM | 129.0000 | Yearly | MEX SP.POP.TOTL | 5/30/2023 6:48:00 PM | 
| Sweden | GDP | 12/31/2022 12:00:00 AM	| 585.9400 | Yearly | WGDPSWED | 6/30/2023 3:55:00 PM | 

## By country, indicator and date

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/historical/country/mexico,sweden/indicator/gdp,population/2015-01-01/2015-12-31?c={your_api_key}'
data = requests.get(url).json()
print(data)
```
*Or using our package:*
```python
te.getHistoricalData(country=['mexico', 'sweden'], indicator=['gdp','population'], 
 initDate='2015-01-01', endDate='2015-12-31')
```

**JS**
*Using Requests:*
```js
const axios = require('axios');
(async () => {
    const your_api_key = 'your_api_key'
    const response = await axios.get(`https://api.tradingeconomics.com/historical/country/mexico,sweden/indicator/gdp,population/2015-01-01/2015-12-31?c=${your_api_key}`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
data = te.getHistoricalData(country = ['mexico','sweden'], indicator = ['gdp','population'], 
 start_date = '2015-01-01', end_date = '2015-12-31').then(function(data){
  console.log(data)
});
```

**C#**
*Using Requests:*
```c#
new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/historical/country/mexico,sweden/indicator/gdp,population/2015-01-01/2015-12-31?c=your_api_key");
```

**JSON**
```text
https://api.tradingeconomics.com/historical/country/{countries}/indicator/{indicators}/{yyyy-mm-dd}/{yyyy-mm-dd}?c={your_api_key}&f=json
```
```json
[
  {
    "Country": "Mexico",
    "Category": "GDP",
    "DateTime": "2022-12-31T00:00:00",
    "Value": 1414.19,
    "Frequency": "Yearly",
    "HistoricalDataSymbol": "WGDPMEXI",
    "LastUpdate": "2023-06-30T15:54:00"
  },
  {
    "Country": "Mexico",
    "Category": "Population",
    "DateTime": "2022-12-31T00:00:00",
    "Value": 129.0,
    "Frequency": "Yearly",
    "HistoricalDataSymbol": "MEX SP.POP.TOTL",
    "LastUpdate": "2023-05-30T18:48:00"
  },
  {
    "Country": "Sweden",
    "Category": "GDP",
    "DateTime": "2022-12-31T00:00:00",
    "Value": 585.94,
    "Frequency": "Yearly",
    "HistoricalDataSymbol": "WGDPSWED",
    "LastUpdate": "2023-06-30T15:55:00"
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/historical/country/{countries}/indicator/{indicators}/{yyyy-mm-dd}/{yyyy-mm-dd}?c={your_api_key}&f=csv
```
```bash
Country,Category,DateTime,Close,Frequency,HistoricalDataSymbol,LastUpdate
Mexico,GDP,12/31/2022 12:00:00 AM,1414.1900,Yearly,WGDPMEXI,6/30/2023 3:54:00 PM
Mexico,Population,12/31/2022 12:00:00 AM,129.0000,Yearly,MEX SP.POP.TOTL,5/30/2023 6:48:00 PM
Sweden,GDP,12/31/2022 12:00:00 AM,585.9400,Yearly,WGDPSWED,6/30/2023 3:55:00 PM
```

**HTML**
```text
https://api.tradingeconomics.com/historical/country/{countries}/indicator/{indicators}/{yyyy-mm-dd}/{yyyy-mm-dd}?c={your_api_key}
```

| Country | Category | DateTime | Close | Frequency | HistoricalDataSymbol | LastUpdate |
|-------|-------|-------|-------|-------|-------|-------|
| Mexico | GDP | 12/31/2022 12:00:00 AM	| 1414.1900 | Yearly | WGDPMEXI | 6/30/2023 3:54:00 PM | 
| Mexico | Population | 12/31/2022 12:00:00 AM | 129.0000 | Yearly | MEX SP.POP.TOTL | 5/30/2023 6:48:00 PM | 
| Sweden | GDP | 12/31/2022 12:00:00 AM	| 585.9400 | Yearly | WGDPSWED | 6/30/2023 3:55:00 PM | 

## By ticker

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/historical/ticker/USURTOT/2015-03-01?c={your_api_key}'
data = requests.get(url).json()
print(data)
```
*Or using our package:*
```python
te.getHistoricalByTicker(ticker = 'USURTOT', start_date = '2015-03-01')   
```

**JS**
*Using Requests:*
```js
const axios = require('axios');
(async () => {
    const your_api_key = 'your_api_key'
    const response = await axios.get(`https://api.tradingeconomics.com/historical/ticker/USURTOT/2015-03-01?c=${your_api_key}`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
data = te.getHistoricalData(ticker = 'usurtot', start_date = '2015-03-01' ).then(function(data){
  console.log(data)       
});
```

**C#**
*Using Requests:*
```c#
new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/historical/ticker/USURTOT/2015-03-01?c=your_api_key");
```

**JSON**
```text
https://api.tradingeconomics.com/historical/ticker/{ticker}/{yyyy-mm-dd}?c={your_api_key}&f=json
```
```json
[
  {
    "Country": "United States",
    "Category": "Unemployment Rate",
    "DateTime": "2023-07-31T00:00:00",
    "Value": 3.5,
    "Frequency": "Monthly",
    "HistoricalDataSymbol": "USURTOT",
    "LastUpdate": "2023-09-01T12:30:00"
  },
  {
    "Country": "United States",
    "Category": "Unemployment Rate",
    "DateTime": "2023-08-31T00:00:00",
    "Value": 3.8,
    "Frequency": "Monthly",
    "HistoricalDataSymbol": "USURTOT",
    "LastUpdate": "2023-10-06T12:30:00"
  },
  {
    "Country": "United States",
    "Category": "Unemployment Rate",
    "DateTime": "2023-09-30T00:00:00",
    "Value": 3.8,
    "Frequency": "Monthly",
    "HistoricalDataSymbol": "USURTOT",
    "LastUpdate": "2023-10-06T12:30:00"
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/historical/ticker/{ticker}/{yyyy-mm-dd}?c={your_api_key}&f=csv
```
```bash
Country,Category,DateTime,Close,Frequency,HistoricalDataSymbol,LastUpdate
United States,Unemployment Rate,7/31/2023 12:00:00 AM,3.5000,Monthly,USURTOT,9/1/2023 12:30:00 PM
United States,Unemployment Rate,8/31/2023 12:00:00 AM,3.8000,Monthly,USURTOT,10/6/2023 12:30:00 PM
United States,Unemployment Rate,9/30/2023 12:00:00 AM,3.8000,Monthly,USURTOT,10/6/2023 12:30:00 PM
```

**HTML**
```text
https://api.tradingeconomics.com/historical/ticker/{ticker}/{yyyy-mm-dd}?c={your_api_key}
```

| Country | Category | DateTime | Close | Frequency | HistoricalDataSymbol | LastUpdate |
|-------|-------|-------|-------|-------|-------|-------|
| United States | Unemployment Rate | 4/30/2023 12:00:00 AM | 3.4000 | Monthly | USURTOT | 6/2/2023 12:30:00 PM | 
| United States | Unemployment Rate | 5/31/2023 12:00:00 AM | 3.7000 | Monthly | USURTOT | 7/7/2023 12:30:00 PM | 
| United States | Unemployment Rate | 6/30/2023 12:00:00 AM | 3.6000 | Monthly | USURTOT | 7/7/2023 12:30:00 PM | 

> **Note:** Ticker symbols can be retrieved using the [Snapshot](https://docs.tradingeconomics.com/indicators/snapshot) or [Search](https://docs.tradingeconomics.com/searching) endpoints.

## Latest historical

Historical endpoint that provides a response containing all recently updated/revised economic indicator records.

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/historical/latest?c={your_api_key}&country=brazil&date=2025-08-26'
data = requests.get(url).json()
print(data)
```
*Or using our package:*
```python
te.getHistoricalLatest(country=['United States', 'Brazil'], date='2025-08-26')
```

**JS**
*Using Requests:*
```js
const axios = require('axios');
(async () => {
    const your_api_key = 'your_api_key'
    const response = await axios.get(`https://api.tradingeconomics.com/historical/latest?c=${your_api_key}&country=brazil&date=2025-08-26`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
data = te.getHistoricalLatest(country=['United States', 'Brazil'], date='2025-08-26').then(function(data){
  console.log(data)       
});
```

**C#**
*Using Requests:*
```c#
new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/historical/latest?c=your_api_key&country=brazil&date=2025-08-26");
```

**JSON**
```text
https://api.tradingeconomics.com/historical/latest?c={your_api_key}&f=json
```
```json
[
  {
    "Country": "Greece",
    "Category": "Car Registrations",
    "DateTime": "2025-02-28T00:00:00",
    "Value": 9818.0,
    "Frequency": "Monthly",
    "HistoricalDataSymbol": "GREECECARREG",
    "LastUpdate": "2025-03-13T14:49:00"
  },
  {
    "Country": "Italy",
    "Category": "Part Time Employment",
    "DateTime": "2024-12-31T00:00:00",
    "Value": 3296.0,
    "Frequency": "Quarterly",
    "HistoricalDataSymbol": "ITALYPARTIMEMP",
    "LastUpdate": "2025-03-13T14:47:00"
  },
  {
    "Country": "Italy",
    "Category": "Full Time Employment",
    "DateTime": "2024-12-31T00:00:00",
    "Value": 15666.0,
    "Frequency": "Quarterly",
    "HistoricalDataSymbol": "ITALYFULTIMEMP",
    "LastUpdate": "2025-03-13T14:46:00"
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/historical/latest?c={your_api_key}&f=csv
```
```bash
Country	Category	DateTime	Close	Frequency	HistoricalDataSymbol	LastUpdate
Greece	Car Registrations	2/28/2025 12:00:00 AM	9818.0000	Monthly	GREECECARREG	3/13/2025 2:49:00 PM
Italy	Part Time Employment	12/31/2024 12:00:00 AM	3296.0000	Quarterly	ITALYPARTIMEMP	3/13/2025 2:47:00 PM
Italy	Full Time Employment	12/31/2024 12:00:00 AM	15666.0000	Quarterly	ITALYFULTIMEMP	3/13/2025 2:46:00 PM
```

**HTML**
```text
https://api.tradingeconomics.com/historical/latest?c={your_api_key}
```

| Country | Category | DateTime | Close | Frequency | HistoricalDataSymbol | LastUpdate |
|-------|-------|-------|-------|-------|-------|-------|
| Greece | Car Registrations | 2/28/2025 12:00:00 AM | 9818.0000 | Monthly | GREECECARREG | 3/13/2025 2:49:00 PM |
| Italy | Part Time Employment | 12/31/2024 12:00:00 AM | 3296.0000 | Quarterly | ITALYPARTIMEMP | 3/13/2025 2:47:00 PM |
| Italy | Full Time Employment | 12/31/2024 12:00:00 AM | 15666.0000 | Quarterly | ITALYFULTIMEMP | 3/13/2025 2:46:00 PM |

## Latest updates

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/historical/updates?c={your_api_key}'
data = requests.get(url).json()
print(data)
```
*Or using our package:*
```python
te.getHistoricalUpdates()
```

**JS**
*Using Requests:*
```js
const axios = require('axios');
(async () => {
    const your_api_key = 'your_api_key'
    const response = await axios.get(`https://api.tradingeconomics.com/historical/updates?c=${your_api_key}`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
data = te.getHistoricalUpdates().then(function(data){
  console.log(data)       
});
```

**C#**
*Using Requests:*
```c#
new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/historical/updates?c=your_api_key");
```

**JSON**
```text
https://api.tradingeconomics.com/historical/updates?c={your_api_key}&f=json
```
```json
[
  {
    "Country": "Austria",
    "Category": "Capital Flows",
    "HistoricalDataSymbol": "AUSTRIACAPFLO",
    "LastUpdate": "2023-10-09T16:39:00"
  },
  {
    "Country": "Tanzania",
    "Category": "Inflation Rate",
    "HistoricalDataSymbol": "TANZANIAIR",
    "LastUpdate": "2023-10-09T16:28:00"
  },
  {
    "Country": "Uganda",
    "Category": "Deposit Interest Rate",
    "HistoricalDataSymbol": "UGAFRINRDPST",
    "LastUpdate": "2023-10-09T16:06:00"
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/historical/updates?c={your_api_key}&f=csv
```
```bash
Country,Category,HistoricalDataSymbol,LastUpdate
Austria,Capital Flows,AUSTRIACAPFLO,10/9/2023 4:39:00 PM
Tanzania,Inflation Rate,TANZANIAIR,10/9/2023 4:28:00 PM
Uganda,Deposit Interest Rate,UGAFRINRDPST,10/9/2023 4:06:00 PM
```

**HTML**
```text
https://api.tradingeconomics.com/historical/updates?c={your_api_key}
```

| Country | Category | HistoricalDataSymbol | LastUpdate |
|-------|-------|-------|-------|
| United States | Consumer Credit | UNITEDSTACONCRE | 7/10/2023 7:01:00 PM |
| Nicaragua | Foreign Direct Investment | NICARAGUAFORDIRINV | 7/10/2023 5:17:00 PM |
| Dominican Republic | External Debt to GDP | DOMEDTG | 7/10/2023 4:29:00 PM |

## Response fields

| Field                | Type   | Description                                | Example               |
| ---------------------| -------|--------------------------------------------|-----------------------|
| Country              | string | Name of the country associated with the indicator.                              | "Mexico"              |
| Category             | string | Economic indicator name or category.                | "GDP"                 |
| Date Time            | string | Date of the reported value, in UTC format.                                      | "2021-12-31T00:00:00" |
| Close                | number | Value of the indicator at the specified date.*                                  | 1272.8400             |
| Frequency            | string | Frequency of the data series.                | "Yearly"              |
| HistoricalDataSymbol | string | Unique identifier used internally by Trading Economics to represent the series. | "WGDPMEXI"            |
| LastUpdate           | string | Timestamp of the most recent update to the data (insert or change), in UTC.     | "2022-12-30T12:46:00" |

### Fields in 'Latest updates'

| Field                | Type   | Description                                | Example               |
| ---------------------| -------|--------------------------------------------|-----------------------|
| Country              | string | Name of the country associated with the indicator.                              | "Mexico"              |
| Category             | string | Economic indicator name or category.                | "GDP"                 |
| HistoricalDataSymbol | string | Unique identifier used internally by Trading Economics to represent the series. | "WGDPMEXI"            |
| LastUpdate           | string | Timestamp of the most recent update to the data (insert or change), in UTC.     | "2022-12-30T12:46:00" |

*Python package response field returns **Value** instead of 'Close'.

