# Debt-to-GDP by Sector API
> How indebted each economy's government, households and companies are relative to the size of the economy, read live from the Bank for International Settlements' open statistics — no key, nothing stored. Debt-to-GDP is the headline gauge of debt sustainability: how big a borrower's debts are versus the income that has to service them. The BIS publishes total credit as a share of GDP for the general government, for households, for non-financial corporations and for the private non-financial sector as a whole, on a consistent cross-country basis. The latest endpoint returns every covered country's most recent government, household, corporate and total-private debt-to-GDP; the country endpoint returns one country's four sector ratios with the reference quarter; the history endpoint returns a chosen sector's quarterly series. This is the debt-level / leverage macro cut — distinct from the credit-to-GDP gap (how stretched credit is versus its trend), the debt service ratio (the cost of carrying that debt), the credit-growth (lending volumes), bank-rate and FX APIs in the catalogue. 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/debttogdp-api/..."
```

## Pricing
- **Free** (Free) — 700 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 18,500 calls/Mo, 6 req/s
- **Pro** ($27/Mo) — 90,000 calls/Mo, 16 req/s
- **Business** ($63/Mo) — 470,000 calls/Mo, 40 req/s

## Endpoints

### Debt-to-GDP

#### `GET /v1/country` — One country's four sector debt ratios

**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/debttogdp-api/v1/country?country=US"
```

**Response:**
```json
{
    "data": {
        "note": "Debt-to-GDP in percent. government is general-government debt; households and corporates (non-financial) are the private sub-sectors; private_total is the whole private non-financial sector. From BIS total credit at market value.",
        "period": "2025-Q3",
        "source": "BIS",
        "country": "US",
        "corporates": 72.5,
        "government": 109.7,
        "households": 68,
        "private_total": 140.4
    },
    "meta": {
        "timestamp": "2026-06-12T10:35:37.719Z",
        "request_id": "ca9514d4-3e2d-4569-b0c1-6f060c2cba69"
    },
    "status": "ok",
    "message": "Country retrieved successfully",
    "success": true
}
```

#### `GET /v1/history` — One country's quarterly debt-to-GDP for a sector

**Parameters:**
- `country` (query, required, string) — ISO-2 code or common name Example: `US`
- `sector` (query, optional, string) — government (default), households, corporates or private_total Example: `government`
- `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/debttogdp-api/v1/history?country=US&sector=government&quarters=40"
```

**Response:**
```json
{
    "data": {
        "count": 40,
        "sector": "government",
        "source": "BIS",
        "country": "US",
        "history": [
            {
                "period": "2015-Q4",
                "debt_to_gdp": 99.6
            },
            {
                "period": "2016-Q1",
                "debt_to_gdp": 102.6
            },
            {
                "period": "2016-Q2",
                "debt_to_gdp": 103.3
            },
            {
                "period": "2016-Q3",
                "debt_to_gdp": 103.2
            },
            {
                "period": "2016-Q4",
                "debt_to_gdp": 100.6
            },
            {
                "period": "2017-Q1",
                "debt_to_gdp": 99.6
            },
            {
                "period": "2017-Q2",
                "debt_to_gdp": 98.7
            },
            {
                "period": "2017-Q3",
                "debt_to_gdp": 99.2
            },
            {
                "period": "2017-Q4",
                "debt_to_gdp": 99.4
            },
            {
                "period": "2018-Q1",
                "debt_to_gdp": 99.1
            },
            {
                "period": "2018-Q2",
                "debt_to_gdp": 97.5
            },
            {
                "period": "2018-Q3",
                "debt_to_gdp": 96.7
            },
            {
                "period": "2018-Q4",
                "debt_to_gdp": 98.9
            },
            {
                
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/latest` — Every country's debt-to-GDP by sector

**Parameters:**
- `sort` (query, optional, string) — Sort: government (default), households, corporates, private_total or country Example: `government`

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

**Response:**
```json
{
    "data": {
        "note": "Debt-to-GDP in percent (BIS total credit at market value, all lenders). government is general-government debt, households and corporates are the private sub-sectors, private_total is the whole private non-financial sector. Sort by government (default), households, corporates, private_total or country.",
        "count": 32,
        "source": "BIS",
        "countries": [
            {
                "period": "2025-Q3",
                "country": "JP",
                "corporates": 111.7,
                "government": 184.3,
                "households": 61.1,
                "private_total": 172.8
            },
            {
                "period": "2025-Q3",
                "country": "GR",
                "corporates": 57.5,
                "government": 150.9,
                "households": 38.2,
                "private_total": 95.7
            },
            {
                "period": "2025-Q3",
                "country": "IT",
                "corporates": 58.5,
                "government": 137.9,
                "households": 35.9,
                "private_total": 94.4
            },
            {
                "period": "2025-Q3",
                "country": "FR",
                "corporates": 155.2,
                "government": 110,
                "households": 59.9,
                "private_total": 215.1
            },
            {
                "period": "2025-Q3",
                "country": "US",
                "corpor
…(truncated, see openapi.json for full schema)
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "note": "country is an ISO-2 code (US, DE, GB, JP) or a common name. history sector is government (default), households, corporates or private_total. history quarters is 2-240 (default 40). Total credit at market value, all lenders, % of GDP. Quarterly with the usual lag; briefly cached.",
        "source": "BIS Data Portal (stats.bis.org/api/v2, WS_TC, quarterly, live)",
        "sectors": [
            "government",
            "households",
            "corporates",
            "private_total"
        ],
        "service": "debttogdp-api",
        "countries": 32,
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/latest": "Every country's government/household/corporate/total-private debt-to-GDP, sortable (sort=government|households|corporates|private_total|country).",
            "GET /v1/country": "One country's four sector debt-to-GDP ratios (country=US).",
            "GET /v1/history": "One country's quarterly debt-to-GDP for a sector (country=US, sector=government, quarters=40)."
        },
        "description": "Debt-to-GDP by sector — how indebted each economy's government, households and companies are, from the BIS open statistics (no key, nothing stored). latest returns every country's government, household, corporate and total-private debt-to-GDP; country returns one country's four sector ratios; history returns a sector's quarterly series. The debt-level / leverage macro cut — distinct from the
…(truncated, see openapi.json for full schema)
```


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