> ## Documentation Index
> Fetch the complete documentation index at: https://docs.financialdatasets.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Historical

> Get monthly US consumer price index history since 1947: headline and core CPI plus food, energy, shelter, and services, with month-over-month and year-over-year changes.

### Overview

The Inflation API lets you pull the monthly US Consumer Price Index (CPI) for one series at a time, from 1947 to today, with the month-over-month and year-over-year percent changes computed for you.

We source the data directly from authoritative government sources. Values are index levels (1982-84 = 100); the changes are percentages.

To get started, please create an account and grab your <b>API key</b> at [financialdatasets.ai](https://financialdatasets.ai).

You will use the API key to authenticate your API requests.

### Coverage

| History       | Series | Updated |
| ------------- | ------ | ------- |
| 1947 to today | 12     | Monthly |

### Series

Six concepts, each seasonally adjusted (`_sa`) and not seasonally adjusted (`_nsa`):

| Series                                                        | What it is                     | From                  |
| ------------------------------------------------------------- | ------------------------------ | --------------------- |
| `cpi_all_sa`, `cpi_all_nsa`                                   | All items                      | 1947                  |
| `cpi_core_sa`, `cpi_core_nsa`                                 | All items less food and energy | 1957                  |
| `cpi_food_sa`, `cpi_food_nsa`                                 | Food                           | 1947                  |
| `cpi_energy_sa`, `cpi_energy_nsa`                             | Energy                         | 1957                  |
| `cpi_shelter_sa`, `cpi_shelter_nsa`                           | Shelter                        | 1953                  |
| `cpi_services_less_energy_sa`, `cpi_services_less_energy_nsa` | Services less energy services  | 1957 (NSA), 1967 (SA) |

You can fetch this list, with each series' first available month, with a free `GET` request to:
[https://api.financialdatasets.ai/macro/inflation/series/](https://api.financialdatasets.ai/macro/inflation/series/)

### Reading the fields

* `date` is the reference month as its first day: `2026-08-01` is the August 2026 print, which is published in mid September. It is not the release date.
* `value` is the published index level.
* `change_1m_pct` is the percent change from the prior month and `change_12m_pct` from the same month a year earlier, both rounded to one decimal. The headline "inflation rate" is `change_12m_pct` of `cpi_all_nsa`; the headline monthly figure is `change_1m_pct` of `cpi_all_sa`.
* A field is `null` when the comparison month was not published. October 2025 is `null` in every series because no October 2025 CPI was published, so the November 2025 1-month change and the October 2026 12-month change are `null` too.
* History is the latest published values. When a past month is revised, the stored value is replaced.

### Getting Started

There are only 3 steps for making a successful API call:

1. Add your API key to the header of the request as `X-API-KEY`.
2. Add the `series` parameter, which is required. Optionally add `start_date` and `end_date` (inclusive, `YYYY-MM-DD`; any day inside a month selects that month). With no dates you get the trailing five years.
3. Execute the API request.

Rows come newest first in pages of up to 10. When more rows remain, the response includes a `next_page_url`; request it as-is to get the next page. See the [pagination guide](/guides/pagination).

### Example

```python Inflation theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import requests

# add your API key to the headers
headers = {
    "X-API-KEY": "your_api_key_here"
}

# set parameters
series = 'cpi_all_sa'      # required
start_date = '2025-09-01'  # optional
end_date = '2026-08-31'    # optional

# create the URL with parameters
url = (
    f'https://api.financialdatasets.ai/macro/inflation'
    f'?series={series}'
    f'&start_date={start_date}'
    f'&end_date={end_date}'
)

# make API request
response = requests.get(url, headers=headers)

# parse the observations from the response
inflation = response.json().get('inflation')
```

### Example Response

```json theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
{
  "inflation": [
    {
      "series": "cpi_all_sa",
      "date": "2026-08-01",
      "value": 334.131,
      "change_1m_pct": 0.4,
      "change_12m_pct": 3.4
    }
  ]
}
```


## OpenAPI

````yaml GET /macro/inflation
openapi: 3.0.1
info:
  title: Financial Datasets API
  description: >-
    Stock market API with real-time and historical financial data for 27,000+
    tickers over 30+ years. Financial statements, equity prices, insider trades,
    SEC filings, and more.
  version: 1.0.0
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  contact:
    name: API Support
    url: mailto:support@financialdatasets.ai
    email: support@financialdatasets.ai
  termsOfService: https://financialdatasets.ai/terms-of-use
servers:
  - url: https://api.financialdatasets.ai/
    description: Production server
security:
  - X-API-KEY: []
tags:
  - name: Financial Statements
    description: Access to income statements, balance sheets, and cash flow statements
  - name: Market Data
    description: Real-time and historical price data
  - name: Company Information
    description: Company facts like ticker, name, and description
  - name: Earnings
    description: Earnings data and related information
  - name: News
    description: Real-time and historical news articles
  - name: SEC Filings
    description: SEC filings and regulatory documents
  - name: Insider Trades
    description: Insider trading activity and transactions
  - name: Activist Ownership
    description: Activist stakes from SEC Schedule 13D filings, in real time
  - name: Beneficial Ownership
    description: >-
      Holders of more than 5% of a company's shares, from SEC Schedules 13D and
      13G
  - name: Insider Ownership
    description: Insider ownership statements from SEC Forms 3 and 5
  - name: Institutional Holdings
    description: SEC-direct 13F equity holdings of institutional investment managers
  - name: IPOs
    description: >-
      Upcoming IPOs from SEC registration statements (Form S-1), with extracted
      pre-IPO financial statements
  - name: Index Funds
    description: >-
      ETF and index-fund holdings, weights, and the funds that hold a given
      security
  - name: Financial Metrics
    description: Financial ratios, metrics, and key performance indicators
  - name: Macroeconomics
    description: Real-time and historical macroeconomic data like interest rates
  - name: KPIs
    description: Sector-specific operational KPIs extracted from earnings releases.
  - name: Agent Account
    description: Self-serve account creation and funding for AI agents.
paths:
  /macro/inflation:
    get:
      tags:
        - Macroeconomics
      summary: Inflation (Historical)
      description: >-
        Monthly US Consumer Price Index history for one series, newest first,
        with the month-over-month and year-over-year percent changes. Dates are
        reference months (first day of the month). Values are index levels
        (1982-84 = 100), sourced from authoritative government sources. A change
        is null when the comparison month was not published.
      operationId: getInflation
      parameters:
        - name: series
          in: query
          description: >-
            The series id, e.g. cpi_all_sa. Six concepts (all items, core, food,
            energy, shelter, services less energy), each seasonally adjusted
            (_sa) and not (_nsa). Use the /macro/inflation/series endpoint to
            get the list.
          required: true
          schema:
            type: string
        - name: start_date
          in: query
          description: >-
            The first month to return, inclusive, in YYYY-MM-DD format; any day
            inside a month selects that month. Defaults to five years before
            end_date when both dates are omitted; omit it with an end_date to
            get all available history through that month.
          required: false
          schema:
            type: string
        - name: end_date
          in: query
          description: >-
            The last month to return, inclusive, in YYYY-MM-DD format. Defaults
            to today.
          required: false
          schema:
            type: string
        - name: cursor
          in: query
          description: >-
            Opaque pagination cursor from a previous response's next_page_url.
            When provided, all other query parameters are ignored: the cursor
            carries the original request's filters. Treat it as opaque; do not
            construct or modify it.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Inflation response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InflationResponse'
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/PaymentRequiredError'
        '404':
          $ref: '#/components/responses/NotFoundError'
components:
  schemas:
    InflationResponse:
      type: object
      properties:
        inflation:
          type: array
          items:
            $ref: '#/components/schemas/InflationObservation'
        next_page_url:
          type: string
          description: >-
            Absolute URL of the next page of results. Present only when more
            results remain; request it as-is to continue. Each page holds up to
            10 records.
    InflationObservation:
      type: object
      properties:
        series:
          type: string
          description: The series id, e.g. cpi_all_sa.
        date:
          type: string
          description: >-
            The reference month as its first day in YYYY-MM-DD format, e.g.
            2026-08-01 for August 2026. Not the release date.
        value:
          type: number
          nullable: true
          description: >-
            The published index level (1982-84 = 100). Null when the month was
            not published.
        change_1m_pct:
          type: number
          nullable: true
          description: >-
            Percent change from the prior month, rounded to one decimal. Null
            when either month was not published.
        change_12m_pct:
          type: number
          nullable: true
          description: >-
            Percent change from the same month a year earlier, rounded to one
            decimal. Null when either month was not published. For cpi_all_nsa
            this is the headline inflation rate.
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: A short error message.
        message:
          type: string
          description: A more detailed error message.
  responses:
    BadRequestError:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Bad Request
            message: Invalid request parameters
    UnauthorizedError:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Unauthorized
            message: Invalid API key provided
    PaymentRequiredError:
      description: The request requires a paid subscription
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Payment Required
            message: >-
              This endpoint requires a paid subscription. Please upgrade your
              plan.
    NotFoundError:
      description: The specified resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Not Found
            message: Ticker XXXX not found
  securitySchemes:
    X-API-KEY:
      type: apiKey
      name: X-API-KEY
      description: API key for authentication.
      in: header

````