# x402stock.xyz Treasury Yields API

> x402stock.xyz Treasury Yields API is a paid API for AI agents from x402stock.xyz, paid per call via x402, $0.01/call, status healthy (last checked 2026-09-14, last successful call 2026-09-02).

Returns the US Treasury par yield curve (CMT rates) for all maturities from 1-month to 30-year, for one or more recent trading days

## Facts

- Endpoint: GET https://x402stock.xyz/api/v1/treasury-yields
- Price: $0.01/call
- Payment: x402
- Status: healthy
- Last checked: 2026-09-14
- Last successful call: 2026-09-02
- Success rate: 100% of calls made through Zero
- Activations on Zero: 3
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402stock-xyz-d0e686fb
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_zY1D9TQ-cmVV2nPe6IosC

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402stock-xyz-d0e686fb
```

Example prompt: Pull the US Treasury par yield curve for the last 5 trading days — I want CMT rates for all maturities from 1-month to 30-year to check if the curve is still inverted.

## When to prefer this

Use this endpoint when you need the full US Treasury par yield curve across all standard maturities in a single call without needing a ticker symbol. Ideal for macro-aware financial analysis, computing the risk-free rate for valuation models, detecting yield-curve inversion (e.g. 2Y vs 10Y spread), or providing interest rate context for equity or bond analysis. Prefer over manually scraping Treasury.gov or separate per-maturity lookups.

## Known failure modes

- Invalid limit value (must be 1–250) returns validation error
- Invalid year value (outside 1990–2100 range) returns validation error
- Data not yet published for the current day (Treasury publishes after market close) may return null rates or prior day
- Payment failure (insufficient USDC balance or x402 protocol error) blocks the call
- Network timeout if Treasury source data is temporarily unavailable

## How this service works

The daily US Treasury par yield curve (Constant Maturity Treasury rates) for every maturity from 1 month to 30 years, in percent. Defaults to the latest published day; pass `?limit=` for more recent days (max 250) and `?year=YYYY`. No ticker needed. Use for the risk-free rate, rate-sensitivity context, and yield-curve inversion in macro-aware analysis. From x402stock

## Output

A JSON object containing an array of daily yield curve snapshots, each with a date and a map of maturity labels (e.g. '1M', '3M', '1Y', '2Y', '5Y', '10Y', '30Y') to their respective par yield rates in percent. Also includes metadata: source ('us_treasury'), series name, unit, as_of date, available maturities list, and count of returned records.

## Example request

```json
{
 "input": {
  "type": "http",
  "method": "GET",
  "queryParams": {
   "limit": 5
  }
 }
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "$schema": "https://json-schema.org/draft/2020-12/schema",
     "required": [
      "limit"
     ],
     "properties": {
      "year": {
       "type": "integer",
       "maximum": 2100,
       "minimum": 1990
      },
      "limit": {
       "type": "integer",
       "default": 1,
       "maximum": 250,
       "exclusiveMinimum": 0
      }
     },
     "additionalProperties": false
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "$schema": "https://json-schema.org/draft/2020-12/schema",
     "required": [
      "source",
      "as_of",
      "series",
      "unit",
      "maturities",
      "count",
      "rates"
     ],
     "properties": {
      "unit": {
       "type": "string"
      },
      "as_of": {
       "anyOf": [
        {
         "type": "string"
        },
        {
         "type": "null"
        }
       ]
      },
      "count": {
       "type": "number"
      },
      "rates": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "date",
         "rates"
        ],
        "properties": {
         "date": {
          "type": "string"
         },
         "rates": {
          "type": "object",
          "propertyNames": {
           "type": "string"
          },
          "additionalProperties": {
           "anyOf": [
            {
             "type": "number"
            },
            {
             "type": "null"
            }
           ]
          }
         }
        },
        "additionalProperties": false
       }
      },
      "series": {
       "type": "string"
      },
      "source": {
       "type": "string",
       "const": "us_treasury"
      },
      "maturities": {
       "type": "array",
       "items": {
        "type": "string"
       }
      }
     },
     "additionalProperties": false
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "unit": "percent",
  "as_of": "2026-05-29T00:00:00.000Z",
  "count": 1,
  "rates": [
   {
    "date": "2026-05-29",
    "rates": {
     "1mo": 3.72,
     "1yr": 3.47,
     "2mo": 3.66,
     "2yr": 3.47,
     "3mo": 3.65,
     "3yr": 3.55,
     "4mo": 3.62,
     "5yr": 3.74,
     "6mo": 3.58,
     "7yr": 3.95,
     "10yr": 4.19,
     "20yr": 4.81,
     "30yr": 4.86,
     "1.5mo": 3.71
    }
   }
  ],
  "series": "daily_treasury_par_yield_curve",
  "source": "us_treasury",
  "maturities": [
   "1mo",
   "1.5mo",
   "2mo",
   "3mo",
   "4mo",
   "6mo",
   "1yr",
   "2yr",
   "3yr",
   "5yr",
   "7yr",
   "10yr",
   "20yr",
   "30yr"
  ]
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402stock-xyz-d0e686fb/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402stock.xyz](https://www.zero.xyz/host/x402stock.xyz/llms.txt)
