Complete API contractOpenAPI 3.1 · JSON · expand inline
{
"openapi": "3.1.0",
"info": {
"title": "Quartertrace Financials API",
"version": "1.0.0",
"description": "Read SEC-derived quarterly financial statements for supported tickers and calendar quarters."
},
"servers": [
{
"url": "https://www.quartertrace.com"
}
],
"paths": {
"/api/status": {
"get": {
"operationId": "getServiceStatus",
"summary": "Check database, catalog, and payment configuration",
"description": "Free health check for the database and presence of x402 configuration. It does not test facilitator availability or payment settlement.",
"responses": {
"200": {
"description": "Database available.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": {
"const": "available"
},
"checkedAt": {
"type": "string",
"format": "date-time"
},
"database": {
"const": "available"
},
"records": {
"type": "integer"
},
"tickers": {
"type": "integer"
},
"updatedAt": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"paymentConfiguration": {
"description": "Presence of required x402 environment settings; does not verify validity or facilitator availability.",
"enum": [
"present",
"missing"
]
},
"paymentSettlement": {
"const": "not checked"
}
}
}
}
}
},
"503": {
"description": "Database unavailable.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": {
"const": "degraded"
},
"checkedAt": {
"type": "string",
"format": "date-time"
},
"database": {
"const": "unavailable"
},
"paymentConfiguration": {
"enum": [
"present",
"missing"
]
},
"paymentSettlement": {
"const": "not checked"
}
}
}
}
}
}
}
}
},
"/api/coverage/{ticker}": {
"get": {
"operationId": "getQuarterlyCoverage",
"summary": "Get free year and quarter availability for a ticker",
"description": "Returns only years and quarters with data for this ticker. No financial values and no payment.",
"parameters": [
{
"name": "ticker",
"in": "path",
"required": true,
"schema": {
"type": "string",
"pattern": "^[A-Za-z0-9.-]{1,10}$"
}
}
],
"responses": {
"200": {
"description": "Free year and quarter list; no financial values.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TickerCoverage"
},
"example": {
"ticker": "AAPL",
"years": [
{
"year": 2025,
"quarters": [
1,
2
]
}
]
}
}
}
},
"400": {
"description": "Invalid ticker or no data exists for the ticker.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
},
"example": {
"error": "No data exists for ticker APPL."
}
}
}
},
"503": {
"description": "Coverage data is temporarily unavailable."
}
}
}
},
"/api/financials/{ticker}": {
"post": {
"operationId": "getQuarterlyFinancials",
"summary": "Get financials for a ticker and calendar quarter",
"description": "Check GET /api/coverage/{ticker} first. It lists available years and quarters for free but contains no financial values. Missing or invalid data returns 400 before payment; 503 indicates service or payment configuration is unavailable. Each request for an available record costs 0.05 USDC on Base (chain 8453). Every repeat request or retry for the same ticker and quarter is charged another 0.05 USDC; there are no free repeats. The initial 402 is a payment challenge; pay using an x402 Exact client, then retry this POST.",
"parameters": [
{
"name": "ticker",
"in": "path",
"required": true,
"schema": {
"type": "string",
"pattern": "^[A-Za-z0-9.-]{1,10}$"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"year",
"quarter"
],
"properties": {
"year": {
"type": "integer",
"minimum": 1
},
"quarter": {
"type": "integer",
"enum": [
1,
2,
3,
4
],
"description": "Calendar quarter."
}
},
"additionalProperties": false
},
"example": {
"year": 2025,
"quarter": 1
}
}
}
},
"x-x402": {
"scheme": "exact",
"price": "0.05",
"asset": "USDC",
"network": "eip155:8453",
"networkName": "Base",
"paymentTiming": "Only requested data that exists proceeds to x402 payment."
},
"responses": {
"200": {
"description": "Quarterly financial data.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FinancialQuarter"
}
}
},
"headers": {
"PAYMENT-RESPONSE": {
"schema": {
"type": "string"
},
"description": "Base64-encoded x402 settlement response; may be exposed as X-PAYMENT-RESPONSE."
},
"X-PAYMENT-RESPONSE": {
"schema": {
"type": "string"
},
"description": "Alternate base64-encoded x402 settlement response header."
}
}
},
"400": {
"description": "Invalid request or the requested data does not exist. Missing data is rejected before payment.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
},
"examples": {
"invalidInput": {
"value": {
"error": "Use a valid ticker and only year and quarter with integer values (quarter 1–4)."
}
},
"dataUnavailable": {
"value": {
"error": "Data does not exist for the requested ticker, year, and quarter. No payment has been accepted."
}
}
}
}
}
},
"402": {
"description": "Payment required. The body is empty JSON; PAYMENT-REQUIRED contains a Base64-encoded x402 v2 payment challenge. Decode it and use an x402 Exact client for Base (eip155:8453), then retry the POST. Each retry is another $0.05 charge.",
"headers": {
"PAYMENT-REQUIRED": {
"required": true,
"schema": {
"type": "string"
},
"description": "Base64-encoded JSON x402 payment requirements, including resource, amount, asset, network, and timeout."
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
},
"example": {}
}
}
},
"503": {
"description": "Financial data or payment configuration is temporarily unavailable.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
},
"examples": {
"databaseUnavailable": {
"value": {
"error": "Financial data is temporarily unavailable."
}
},
"paymentUnavailable": {
"value": {
"error": "x402 payment configuration is missing"
}
}
}
}
}
}
}
}
},
"/api/tickers": {
"get": {
"operationId": "listCoveredTickers",
"summary": "Discover tickers and recent coverage",
"description": "Free catalog. Historical means the latest stored period is at least eight calendar quarters behind the current quarter. Filter with recent=true and/or minQuarters.",
"parameters": [
{
"name": "recent",
"in": "query",
"schema": {
"type": "boolean"
},
"description": "Return only tickers whose latest period is within eight calendar quarters."
},
{
"name": "minQuarters",
"in": "query",
"schema": {
"type": "integer",
"minimum": 1
}
}
],
"responses": {
"200": {
"description": "Coverage catalog with aggregate recency counts.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"tickers": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CatalogTicker"
}
},
"records": {
"type": "integer"
},
"recentTickers": {
"type": "integer"
},
"historicalTickers": {
"type": "integer"
},
"recentThresholdQuarters": {
"const": 8
},
"updatedAt": {
"type": [
"string",
"null"
],
"format": "date-time"
}
}
}
}
}
},
"400": {
"description": "Invalid minQuarters."
},
"503": {
"description": "Coverage data unavailable."
}
}
}
},
"/api/metrics": {
"get": {
"operationId": "getMetricDictionary",
"summary": "Get metric definitions and units",
"description": "Free dictionary for metric keys returned by financial responses. The unit on each financial record is authoritative.",
"responses": {
"200": {
"description": "Metric groups, labels, definitions, and observed units.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"units": {
"type": "object"
},
"groups": {
"type": "object"
},
"metrics": {
"type": "object"
}
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"TickerCoverage": {
"type": "object",
"required": [
"ticker",
"years"
],
"properties": {
"ticker": {
"type": "string"
},
"years": {
"type": "array",
"items": {
"type": "object",
"required": [
"year",
"quarters"
],
"properties": {
"year": {
"type": "integer"
},
"quarters": {
"type": "array",
"items": {
"type": "integer",
"enum": [
1,
2,
3,
4
]
}
}
}
}
}
}
},
"Error": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "string"
}
}
},
"Metric": {
"type": "object",
"required": [
"value",
"unit"
],
"properties": {
"value": {
"type": [
"number",
"null"
],
"description": "Null when the filing does not report an exact matching value."
},
"unit": {
"type": "string",
"enum": [
"USD_MILLIONS",
"USD_PER_SHARE",
"SHARES_THOUSANDS",
"PERCENT"
]
},
"formula": {
"type": "string"
}
}
},
"MetricGroup": {
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/Metric"
}
},
"FinancialQuarter": {
"type": "object",
"required": [
"ticker",
"year",
"quarter",
"periodStart",
"periodEnd",
"fiscalPeriod",
"metrics",
"sources"
],
"properties": {
"ticker": {
"type": "string"
},
"year": {
"type": "integer"
},
"quarter": {
"type": "integer",
"enum": [
1,
2,
3,
4
]
},
"periodStart": {
"type": "string",
"format": "date"
},
"periodEnd": {
"type": "string",
"format": "date"
},
"fiscalPeriod": {
"type": "string"
},
"metrics": {
"type": "object",
"properties": {
"incomeStatement": {
"$ref": "#/components/schemas/MetricGroup"
},
"revenueByProduct": {
"$ref": "#/components/schemas/MetricGroup"
},
"revenueByRegion": {
"$ref": "#/components/schemas/MetricGroup"
},
"balanceSheet": {
"$ref": "#/components/schemas/MetricGroup"
},
"cashFlow": {
"$ref": "#/components/schemas/MetricGroup"
},
"comprehensiveIncome": {
"$ref": "#/components/schemas/MetricGroup"
},
"shareholdersEquityChanges": {
"$ref": "#/components/schemas/MetricGroup"
},
"derived": {
"$ref": "#/components/schemas/MetricGroup"
}
}
},
"sources": {
"type": "object",
"required": [
"sec"
],
"properties": {
"sec": {
"type": "string",
"format": "uri"
}
},
"additionalProperties": {
"type": "string"
}
}
}
},
"CatalogTicker": {
"type": "object",
"required": [
"ticker",
"quarterCount",
"first",
"latest",
"historical"
],
"properties": {
"ticker": {
"type": "string"
},
"quarterCount": {
"type": "integer"
},
"first": {
"$ref": "#/components/schemas/Period"
},
"latest": {
"$ref": "#/components/schemas/Period"
},
"historical": {
"type": "boolean"
}
}
},
"Period": {
"type": "object",
"properties": {
"year": {
"type": "integer"
},
"quarter": {
"type": "integer",
"enum": [
1,
2,
3,
4
]
}
}
}
}
}
}Quarter values use calendar quarters. Responses include financial metrics and SEC source links.