API Reference
Complete reference for the Perpetua v1 REST API. All endpoints return JSON.
https://api.perpetua.ukVersion: v1Format: JSONAuthentication
Pass your API key via the X-API-Key header on every request. Get a key →
curl -H "X-API-Key: pk_live_your_key_here" \
https://api.perpetua.uk/v1/companies/00445790Rate Limits
Rate limits apply per API key. Developer tier: 10 req/min, 1,000/month. Higher tiers available on request. View plans →
Endpoints
The Perpetua v1 API exposes 10 company endpoints plus 8 lender intelligence endpoints backed by canonical UK lender entities and the ``mv_lender_stats`` materialized view.
/v1/companies/search/Search Companies
Filter by SIC code, revenue range, employee count, location, data quality tier, and more.
/v1/companies/compareCompare Companies
Side-by-side comparison of up to 10 companies across enrichment dimensions.
/v1/companies/{number}Company Profile
Full company profile with financials, ownership, constraints, and quality signals.
/v1/companies/{number}/financialsFinancial History
Multi-year XBRL financial history. Balance-sheet fields are broadest; revenue, profit, cash-flow, and liquidity metrics depend on filing type.
/v1/companies/{number}/time-seriesFinancial Time-Series
Trend summaries and arrays for reported metrics across filing years. Coverage is materially deeper on full accounts than abridged filings.
/v1/companies/{number}/ownershipOwnership Intelligence
PSC beneficial owners, age estimation, and corporate ownership structure.
/v1/companies/{number}/ownership-graphOwnership Graph
PSC-to-management graph for group structure traversal.
/v1/companies/{number}/constraintsDeal Constraints
Flags secured lending constraints such as floating/fixed charges and unsatisfied encumbrances.
/v1/companies/{number}/explainProvenance Explain
Returns filing URL, chosen XBRL tags, and extraction confidence for key metrics.
/v1/companies/{number}/deal-snapshotDeal Snapshot
Single-call buyability summary combining owner, financial, and constraint signals.
/v1/lendersLender League Table
Paginated list of canonical UK lenders ranked by charge activity. Filter by classification (bank, challenger_bank, building_society, specialist_mortgage, private_credit, asset_finance, invoice_finance, …), activity window, minimum charge count, or free-text name match. Pass ?include=series for 24-month sparkline data.
/v1/lenders/{id}Lender Profile
Canonical lender with parent/subsidiary structure, raw alias list, and aggregate charge stats (totals + recent activity).
/v1/lenders/{id}/portfolioLender Portfolio
Paginated companies with charges from this lender, with per-company aggregated counts. Filter by charge status (outstanding | satisfied | all).
/v1/lenders/{id}/activityLender Monthly Activity
Monthly new + satisfied charge counts, oldest first. ?months=1..60 controls the trailing window (default 24). Months with no activity are omitted.
/v1/lenders/{id}/sectorsLender Sector Breakdown
Top-15 SIC-section breakdown of companies this lender has charges against, ranked by charge count.
/v1/lenders/{id}/regionsLender Regional Breakdown
UK ITL1 regional breakdown of companies this lender has charges against.
/v1/lenders/{id}/size-breakdownLender Size Breakdown
Revenue-band breakdown of companies this lender has charges against, ordered by band threshold. The ``Unknown`` band covers companies without a resolved latest_revenue.
/v1/lenders/{id}/instrumentsLender Instrument Mix
Top-5 charge-type instruments this lender uses (fixed charge, debenture, floating charge, mortgage, …), ordered by charge count.
Try it live
Interactive API Explorer
Try core endpoints through a safe proxy with demo credentials.
cURL
Auto-updatedcurl -H "X-API-Key: <your_api_key>" \
"${PERPETUA_API_URL:-http://localhost:8000}/v1/companies/00445790"Response JSON
{}Errors
Perpetua uses standard HTTP status codes.
Code Examples
cURL
curl -H "X-API-Key: pk_live_your_key_here" \
https://api.perpetua.uk/v1/companies/12345678Python
import requests
resp = requests.get(
"https://api.perpetua.uk/v1/companies/12345678",
headers={"X-API-Key": "pk_live_your_key_here"}
)
company = resp.json()
print(company["name"], company["data_quality_tier"])JavaScript
const resp = await fetch(
"https://api.perpetua.uk/v1/companies/12345678",
{ headers: { "X-API-Key": "pk_live_your_key_here" } }
);
const company = await resp.json();
console.debug(company.name, company.data_quality_tier);Lender Intelligence
Canonical UK lender entities with charge aggregates, sector / region / size breakdowns, 24-month activity series, and instrument-mix stats. The league table is backed by ``mv_lender_stats`` (refreshed by the charge-ingest pipeline); detail endpoints query the ``company_charges`` flat table + per-lender RPCs. Filter the league table with ?classification= using any of the canonical values: bank, challenger_bank, building_society, specialist_mortgage, private_credit, asset_finance, invoice_finance, hmrc, government, director_loan, trade_creditor, other, unknown.
cURL
curl -H "X-API-Key: pk_live_your_key_here" \
"https://api.perpetua.uk/v1/lenders?classification=specialist_mortgage&limit=15"Python
import requests
resp = requests.get(
"https://api.perpetua.uk/v1/lenders",
headers={"X-API-Key": "pk_live_your_key_here"},
params={"classification": "specialist_mortgage", "limit": 15, "include": "series"},
)
league = resp.json()
for row in league["data"]:
print(row["display_name"], row["outstanding_charges"])JavaScript
const resp = await fetch(
"https://api.perpetua.uk/v1/lenders?classification=specialist_mortgage&limit=15&include=series",
{ headers: { "X-API-Key": "pk_live_your_key_here" } }
);
const { data } = await resp.json();
for (const row of data) {
console.debug(row.display_name, row.outstanding_charges);
}