# Credit-to-GDP Gap (Financial Stability) API
> How far each country's private-sector credit has run above or below its long-run trend — the single best early-warning indicator for banking crises — read live from the Bank for International Settlements' open statistics, no key, nothing stored. The credit-to-GDP gap is the difference between the credit-to-GDP ratio and its long-term trend, and the Basel Committee uses it to set the countercyclical capital buffer: a gap above roughly 10 points has historically preceded credit busts, while a deeply negative gap means an economy is still deleveraging. The latest endpoint returns every covered country's most recent gap together with its actual credit-to-GDP ratio and a risk band; the country endpoint returns one country's gap, the underlying ratio and trend and a risk label; the history endpoint returns the quarterly gap time series. This is the credit-gap / financial-stability macro cut — distinct from the euro-area credit-growth (lending volumes), the bank-rate, money-supply, central-bank policy-rate and FX APIs in the catalogue. It measures the build-up of financial-stability risk, not the level of rates. A country is a BIS reference area (US, GB, DE, JP …) given as an ISO-2 code or a common name; data is quarterly with the usual statistical lag.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/creditgap-api/..."
```

## Pricing
- **Free** (Free) — 700 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 17,500 calls/Mo, 6 req/s
- **Pro** ($27/Mo) — 88,000 calls/Mo, 16 req/s
- **Business** ($64/Mo) — 450,000 calls/Mo, 40 req/s

## Endpoints

### Credit Gap

#### `GET /v1/country` — One country's gap, ratio, trend & risk

**Parameters:**
- `country` (query, required, string) — ISO-2 code or common name Example: `US`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/creditgap-api/v1/country?country=US"
```

**Response:**
```json
{
    "data": {
        "note": "credit_to_gdp_gap = ratio minus trend (percentage points), the Basel early-warning indicator. Above ~10 has historically preceded banking crises; below 0 means deleveraging.",
        "risk": "deep deleveraging",
        "trend": 152.5,
        "period": "2025-Q3",
        "source": "BIS",
        "country": "US",
        "credit_to_gdp_gap": -12.1,
        "credit_to_gdp_ratio": 140.4
    },
    "meta": {
        "timestamp": "2026-06-12T10:35:41.252Z",
        "request_id": "9d19c023-1d30-4737-8986-130674bc50e7"
    },
    "status": "ok",
    "message": "Country retrieved successfully",
    "success": true
}
```

#### `GET /v1/history` — One country's quarterly gap history

**Parameters:**
- `country` (query, required, string) — ISO-2 code or common name Example: `US`
- `quarters` (query, optional, string) — Number of recent quarters (2-240, default 40) Example: `40`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/creditgap-api/v1/history?country=US&quarters=40"
```

**Response:**
```json
{
    "data": {
        "count": 40,
        "source": "BIS",
        "country": "US",
        "history": [
            {
                "gap": -12.7,
                "period": "2015-Q4"
            },
            {
                "gap": -11.7,
                "period": "2016-Q1"
            },
            {
                "gap": -10.6,
                "period": "2016-Q2"
            },
            {
                "gap": -9.5,
                "period": "2016-Q3"
            },
            {
                "gap": -9.6,
                "period": "2016-Q4"
            },
            {
                "gap": -9,
                "period": "2017-Q1"
            },
            {
                "gap": -8.1,
                "period": "2017-Q2"
            },
            {
                "gap": -7.8,
                "period": "2017-Q3"
            },
            {
                "gap": -6.8,
                "period": "2017-Q4"
            },
            {
                "gap": -7.5,
                "period": "2018-Q1"
            },
            {
                "gap": -6.6,
                "period": "2018-Q2"
            },
            {
                "gap": -6.8,
                "period": "2018-Q3"
            },
            {
                "gap": -6.5,
                "period": "2018-Q4"
            },
            {
                "gap": -6.3,
                "period": "2019-Q1"
            },
            {
                "gap": -5.9,
                "period": "2019-
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/latest` — Every country's latest credit-to-GDP gap

**Parameters:**
- `sort` (query, optional, string) — Sort order: gap (default), ratio or country Example: `gap`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/creditgap-api/v1/latest?sort=gap"
```

**Response:**
```json
{
    "data": {
        "note": "gap = credit-to-GDP ratio minus its long-run trend (percentage points). A gap above ~10 is the Basel banking-crisis warning zone; negative means credit is below trend. Sort by gap (default), ratio or country.",
        "count": 44,
        "source": "BIS",
        "countries": [
            {
                "gap": 7.6,
                "risk": "building (credit above trend)",
                "period": "2025-Q3",
                "country": "SA",
                "credit_to_gdp_ratio": 77.4
            },
            {
                "gap": 5.1,
                "risk": "building (credit above trend)",
                "period": "2025-Q3",
                "country": "JP",
                "credit_to_gdp_ratio": 172.8
            },
            {
                "gap": 3.1,
                "risk": "building (credit above trend)",
                "period": "2025-Q3",
                "country": "AR",
                "credit_to_gdp_ratio": 26.7
            },
            {
                "gap": 1.8,
                "risk": "neutral (near trend)",
                "period": "2025-Q3",
                "country": "IL",
                "credit_to_gdp_ratio": 114
            },
            {
                "gap": -0.1,
                "risk": "neutral (near trend)",
                "period": "2025-Q3",
                "country": "BR",
                "credit_to_gdp_ratio": 90.6
            },
            {
                "gap": -1.3,
                "risk
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/creditgap-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "country is an ISO-2 code (US, DE, GB, JP) or a common name. Series cover the private non-financial sector. history quarters is 2-240 (default 40). Quarterly data with the usual statistical lag; briefly cached to protect the shared upstream.",
        "source": "BIS Data Portal (stats.bis.org/api/v2, WS_CREDIT_GAP, quarterly, live)",
        "service": "creditgap-api",
        "countries": 44,
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/latest": "Every country's latest credit-to-GDP gap, ratio and risk band, sortable (sort=gap|ratio|country).",
            "GET /v1/country": "One country's gap, credit-to-GDP ratio, trend and risk (country=US).",
            "GET /v1/history": "One country's quarterly credit-to-GDP gap series (country=US, quarters=40)."
        },
        "description": "Credit-to-GDP gap — the Basel early-warning indicator for banking crises, from the BIS open statistics (no key, nothing stored). The gap is the credit-to-GDP ratio minus its long-run trend; a gap above ~10 points has historically preceded credit busts. latest returns every country's most recent gap with its credit-to-GDP ratio and a risk band; country returns one country's gap, ratio, trend and risk; history returns the quarterly gap series. The credit-gap / financial-stability macro cut — distinct from the euro-area credit-growth (lending volumes), bank-rate, money-supply and FX APIs.",
        "upstream_status"
…(truncated, see openapi.json for full schema)
```


---
Marketplace page: https://www.oanor.com/api/creditgap-api
OpenAPI spec: https://www.oanor.com/api/creditgap-api/openapi.json
