TypeScript SDK

The official TypeScript SDK isn't shipped yet. Until it is, generate a typed client from the OpenAPI document, or call REST directly or over MCP.

The official Hannu TypeScript SDK is not yet available. It's scaffolded but not shipped, so there's no package to install. Don't add a hannu dependency yet — there isn't a published one to depend on.

Until the SDK ships, you have three well-supported ways to call the platform from TypeScript.

Generate a typed client from OpenAPI

The API's machine-readable contract is an OpenAPI 3.1 document. Point any OpenAPI client generator at it to get typed methods and models for the whole surface — this is the closest thing to an SDK today, and it stays in sync with the API because it's generated from the same contract.

shell
# fetch the contract
curl https://api.hannu.africa/v1/openapi.json -o hannu-openapi.json
 
# then run your preferred OpenAPI 3.1 client generator against it

Any generator that supports OpenAPI 3.1 works — the point is the source document, not a specific tool. Regenerate when you want the latest additive changes; within /v1, changes are additive, so a regenerated client stays compatible.

Call REST directly

For a handful of calls, plain fetch is enough. Set the base URL, send your bearer key, and add an Idempotency-Key on every mutating request.

JavaScript
const res = await fetch('https://api.hannu.africa/v1/estimate_task', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.HANNU_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    type: 'field_verification',
    reward_major: '2500.00',
    zone_ref: 'lagos_yaba',
  }),
});
const { data } = await res.json();

Responses are { data } — list endpoints return a bounded { data: [...] } array — and errors are RFC 9457 problem+json with a stable code. See the API reference.

Use MCP for agents

If you're building an agent rather than a service, the MCP server exposes the platform as native tools — no client to generate or maintain. See MCP vs REST to choose.

Coming soon

A first-party TypeScript SDK is planned. Until it lands, the generated-from-OpenAPI client is the recommended path — build against the contract, not a package name that doesn't exist yet.