SDKs and tools

The Senserity REST API is intentionally simple: bearer token authentication, consistent JSON responses, and cursor-based pagination. Most developers integrate directly using their preferred HTTP client. Use the resources below to get started.

Resources

Code examples

curl

# Search for a company
curl -s https://app.senserity.co.uk/api/v1/companies/search \
  -H "Authorization: Bearer sns_live_your_key_here" \
  -G -d "q=Blueloop+Limited"

# Get the risk summary
curl -s https://app.senserity.co.uk/api/v1/companies/03981322/insights/summary \
  -H "Authorization: Bearer sns_live_your_key_here"

Python (httpx)

import httpx

BASE = "https://app.senserity.co.uk/api/v1"
HEADERS = {"Authorization": "Bearer sns_live_your_key_here"}

# Get a company's risk summary
r = httpx.get(f"{BASE}/companies/03981322/insights/summary", headers=HEADERS)
data = r.json()["data"]

print(f"{data['company_name']}: {data['letter_grade']} ({data['overall_risk_score']})")
print(f"Red flags: {data['red_flags']}")

for cat, scores in data["category_scores"].items():
    print(f"  {cat}: {scores['score']:.1f}")

TypeScript (fetch)

const BASE = "https://app.senserity.co.uk/api/v1";
const headers = { Authorization: "Bearer sns_live_your_key_here" };

// Get a company's risk summary
const res = await fetch(
  `${BASE}/companies/03981322/insights/summary`,
  { headers },
);
const { data } = await res.json();

console.log(`${data.company_name}: ${data.letter_grade} (${data.overall_risk_score})`);
console.log(`Red flags: ${data.red_flags}`);

for (const [cat, scores] of Object.entries(data.category_scores)) {
  console.log(`  ${cat}: ${(scores as any).score.toFixed(1)}`);
}

Pagination helper

All list endpoints use cursor-based pagination. Here is a reusable helper that iterates through all pages automatically:

import httpx

BASE = "https://app.senserity.co.uk/api/v1"
HEADERS = {"Authorization": "Bearer sns_live_your_key_here"}

def paginate(path: str, params: dict | None = None):
    """Iterate through all pages of a paginated endpoint."""
    params = params or {}
    while True:
        r = httpx.get(f"{BASE}{path}", headers=HEADERS, params=params)
        body = r.json()
        yield from body["data"]
        if not body["meta"].get("has_more"):
            break
        params["cursor"] = body["meta"]["cursor"]

# List all watchlist companies
for company in paginate("/companies"):
    print(company["company_name"])

Generate a typed client

Download the OpenAPI specification above and use it to generate a fully typed client in your preferred language. For example:

# TypeScript types
npx openapi-typescript ./openapi.yaml -o senserity.d.ts

# Python client
pip install openapi-python-client
openapi-python-client generate --path ./openapi.yaml