---
title: "通胀率 API：同比与环比数据 | Narwhal API"
description: "通胀率 API 可获取一个国家某一个月的同比、环比和年初至今通胀率。页面详细列出该接口的请求参数、调用示例、错误说明、数据新鲜度和覆盖范围，方便按国家和期间取值。"
url: "https://narwhalapi.com/zh/docs/api/economics/inflation"
---

# 通胀率 API 参考

获取某一个月的同比、环比和年初至今通胀率。

`economics_get_inflation` 可通过 REST 和 `economics_get_inflation` MCP 工具调用。两者返回相同的数据结构，并使用同一额度。

## 端点与请求

REST 端点

```
GET /v1/economics/{country}/inflation
```

请求示例

```
curl --request GET \
  --url "https://api.narwhalapi.com/v1/economics/USA/inflation?period=2026-07" \
  --header "Authorization: Bearer $NARWHAL_API_KEY"
```

MCP 使用工具 `economics_get_inflation` ，并传入下方对应的参数。

## 参数

此操作接受的期间格式是 `YYYY-MM or YYYY-QN`。

| 名称 | 必填 | 类型 | 含义 |
| --- | --- | --- | --- |
| `country` | 是 | 路径·ISO alpha-3 | 一个受支持的大写国家代码；请参阅此操作的覆盖列表。 |
| `period` | 否 | 查询·YYYY-MM 或 YYYY-QN | 省略此参数可获取已采纳的最新完整发布数据，也可传入一个具体期间。 |
| `version_id` | 否 | 查询·UUID | 可选的不可变发布版本。可使用 `dataset.published` 或 `dataset.revised` 事件中的 `resource_version`；省略时读取当前已收录的指标。 |

## 响应

响应示例

```
{
  "country": "USA",
  "period": "2026-07",
  "year_over_year": "3.4",
  "month_over_month": "0.0",
  "year_to_date": "3.0",
  "released_on": "2026-11-10"
}
```

| 字段 | 类型 | 必填 | 含义 |
| --- | --- | --- | --- |
| `country` | 字符串 | 是 | 所请求的大写 ISO 三字母国家代码。 |
| `period` | 字符串 | 是 | 返回的官方观测期间。 |
| `year_over_year` | 十进制字符串 | 是 | 与上年同月相比的变化率，单位为百分比。 |
| `month_over_month` | 十进制字符串 | 否 | 与上月相比的变化率，单位为百分比。Left out where the publisher releases only the year-over-year figure. |
| `quarter_over_quarter` | 十进制字符串 | 否 | 与上一季度相比的变化率，单位为百分比。新西兰的数据按季度发布，因此用它代替 `month_over_month`。 |
| `year_to_date` | 十进制字符串 | 否 | 与上年十二月相比的变化率，单位为百分比。发布机构未发布时省略。 |
| `released_on` | 日期 | 是 | 官方发布日期，而不是 Narwhal 的检索时间。 |
| `source` | 对象 | 否 | The optional `source` object appears only when the statistic is received through a distributor. It contains `publisher` (the original publisher named by the distributor) and `distributor` (the distributing organisation). When `source` is present, `released_on` is the distributor's publication date, not the original publisher's release date. Publisher-direct series omit `source`. On a newest figure read from the publisher's own release, `source` is `{"publisher": "..."}` with no distributor, and `released_on` is the publisher's local release day. |
| `stage` | 字符串 | 否 | Appears only on a newest figure read from the publisher's release. Which reading of the figure this is: `flash`, `advance`, `first`, `second`, `third`, `preliminary` or `final`. |
| `published_at` | RFC 3339 时间戳 | 否 | Appears only on a newest figure read from the publisher's release. When the publisher released the figure. |
| `provisional` | `true` | 否 | Present, as true, only when the figure read from the release is marked provisional. |
| `calculated` | array of strings | 否 | Present only when Narwhal calculated a figure from the publisher's own numbers because the publisher does not print it. Lists the calculated figures: `["year_over_year"]`, `["month_over_month"]` or both. A printed figure always wins over a calculated one. A stored answer can carry it too, not only an answer read from the release. |

### Newest figure read from the release

The newest answer can come from Narwhal's own read of the statistics office's release, before the stored series has it. Such an answer adds `source`、 `stage`、 `published_at` 和 `provisional` (only when true). An answer with none of these fields is the stored value. A stored answer can also carry `calculated`, which lists the figures Narwhal calculated from the publisher's own numbers.

Inflation also answers the newest figure for a country that has no stored series. It has no history: a `period` or `version_id` request for such a country returns `404 series_not_found`.

Where a stored series reaches Narwhal through a distributor, the statistics office's own printed figure for the same period replaces it. The answer then names the office as the source and no distributor.

请求示例

```
curl --request GET \
  --url "https://api.narwhalapi.com/v1/economics/GRC/inflation" \
  --header "Authorization: Bearer $NARWHAL_API_KEY"
```

响应示例

```
{
  "country": "GRC",
  "period": "2026-10",
  "year_over_year": "5.7",
  "released_on": "2026-11-10",
  "source": {
    "publisher": "Hellenic Statistical Authority"
  },
  "stage": "final",
  "published_at": "2026-11-10T10:00:00Z"
}
```

## API 错误码与额度

- `400 invalid_query` — 国家、期间或筛选格式无效。
- `401 invalid_api_key` — Bearer 密钥缺失或被拒绝。
- `404 series_not_found` — 没有已批准的观测值符合请求。
- `429 rate_limit_exceeded` — 已达到网络或账户的短时窗口限额；请按以下响应头指定的等待时间重试： `Retry-After`。
- `402 insufficient_credits` ，余额不足以支付该调用。
- `503 economics_unavailable` — Narwhal 无法安全提供已接受的发布版本。

Only a successful data response costs credit. 查看 [所有错误、响应头和重试规则](https://narwhalapi.com/zh/docs/errors.md)。

## 数据时效性

省略 `period` 返回 Narwhal 最新存储的已接受发布版本。API 调用读取 Narwhal 数据库，不会实时调用官方发布机构。

`released_on` 是官方发布日期。

The newest figure can be shown as soon as the publisher releases it, from Narwhal's read of the release. Until the stored series has the same period, the answer carries the read fields described above.

读取 [源检查、验证、已存储发布版本和失败检查的工作方式](https://narwhalapi.com/zh/docs/freshness.md)。

## 当前公开测试覆盖范围

46 国家

`ARG, AUS, AUT, BEL, BRA, CAN, CHE, CHL, CHN, COL, CZE, DEU, DNK, ESP, EST, FIN, FRA, GBR, HRV, IDN, IND, IRL, ISR, ITA, JPN, KOR, LTU, LUX, LVA, MEX, MYS, NLD, NOR, NZL, PAK, PHL, POL, PRT, QAT, SAU, SGP, SVN, SWE, THA, USA, ZAF`

全国通胀数据覆盖的国家见下方列表；年初至今数据是否可用取决于各数据源的接口约定。欧元区国家使用的是本国指数，而非欧盟统计局的 HICP，因此数值可能与欧盟统计局的数值不同。澳大利亚使用的是月度 CPI，而非季度 CPI，因此月度数值可能与季度数值不同。A country with no stored series can still answer the newest figure from the publisher's release: it has no history, so a period or version_id request for it returns 404 series_not_found.

新西兰的通胀数据按季度发布，来自 Stats NZ。期间为 `YYYY-QN` 格式的季度，返回 `quarter_over_quarter` 以代替 `month_over_month`，没有 `year_to_date`。

### IMF 月度数据

27 国家

`AGO, ARM, BGD, BIH, BWA, CIV, CRI, GEO, HTI, JOR, KEN, LAO, LBN, LKA, LSO, MWI, NGA, OMN, PRY, SEN, SLV, UGA, UKR, UZB, VEN, VNM, ZMB`

对于这些国家，最新通胀路由使用国际货币基金组织（IMF）的 CPI 数据集（全部项目，月度）作答，该数据集转发统计机构的居民消费价格指数。Narwhal 在开放每个国家之前，已将其最新两个月的数据与本国统计机构核对。`year_over_year` 和 `month_over_month` 是 IMF 公布的变化率（保留一位小数），不是 Narwhal 的计算结果，也没有 `year_to_date`。`source` 对象将 IMF 标为 `distributor`，将原始发布机构标为 `publisher`。这些国家的历史路由仍返回世界银行的年度数据。

### 世界银行年度历史数据

100 国家

`ABW, AFG, ALB, ATG, AZE, BDI, BEN, BFA, BHR, BHS, BLR, BLZ, BOL, BRB, BRN, BTN, CAF, CMR, COD, COG, COM, CPV, CUW, CYM, DJI, DMA, DOM, ECU, EGY, ETH, FJI, FSM, GAB, GHA, GIN, GMB, GNB, GNQ, GRD, GTM, GUY, HND, IRN, IRQ, JAM, KAZ, KGZ, KHM, KIR, KNA, LBR, LBY, LCA, MAC, MDA, MDG, MDV, MLI, MMR, MNE, MNG, MOZ, MRT, MUS, NAM, NCL, NER, NIC, NPL, PAN, PLW, PNG, PSE, RUS, RWA, SDN, SLB, SLE, SMR, SSD, STP, SUR, SWZ, SXM, SYC, SYR, TCD, TGO, TJK, TLS, TON, TTO, TUN, TZA, URY, VCT, VUT, WSM, YEM, ZWE`

这些国家没有最新值路由。向此路由发出的请求会返回 `404 series_not_found`，请改用历史路由。

日频外汇数据可通过以下 API 获取： [外汇 API](https://narwhalapi.com/zh/api/fx.md)。

返回 [所有经济数据操作](https://narwhalapi.com/zh/docs/api/economics.md)。

## 从免费密钥开始

每月赠送 10 美元免费额度，无需绑卡。每月 10 美元免费额度，无需绑卡。

[获取免费 API 密钥](https://narwhalapi.com/zh/signup)

此页面对你有帮助吗?
