API reference

TypeScript client

@corpact/client: typed access to every endpoint.

Install

@corpact/client is a workspace package, generated from the same JSON schemas as the API and the OpenAPI document. It is not yet published to npm.

{ "dependencies": { "@corpact/client": "workspace:*" } }

Create a client

import { createCorpactClient, CorpactApiError } from '@corpact/client';

const corpact = createCorpactClient({
  baseUrl: 'https://api.corpact.example', // or a same-origin path such as '/api/corpact' behind your own proxy
  apiKey: process.env.CORPACT_API_KEY,     // server-side only
});
Option
baseUrlAPI origin, or a same-origin path when a server proxy holds the key
apiKeySent as Authorization: Bearer
fetchOptional custom fetch

Methods

MethodEndpointReturns
health()GET /v1/healthHealthResponse
assets()GET /v1/assetsAssetsResponse
requestSync(wallet)POST /v1/wallets/syncSyncRequestResponse
wallets()GET /v1/walletsWalletsResponse
syncStatus(wallet)GET /v1/wallets/{owner}/statusSyncStatusResponse
portfolio(wallet)GET /v1/portfolioPortfolio
income(wallet, { limit, offset })GET /v1/incomeIncomeResponse
incomeEvent(wallet, id)GET /v1/income/{id}IncomeDetail
journal(wallet, { limit, offset })GET /v1/journalJournalResponse
yieldMetrics(wallet)GET /v1/yieldYieldResponse
exportCsv(wallet, dataset)GET /v1/exportCSV text
exportUrl(wallet, dataset)NoneURL string, for links behind a proxy
opsStatus()GET /v1/ops/statusOpsStatusResponse
opsMetrics()GET /v1/ops/metricsPrometheus text

Corporate actions (v2)

MethodEndpointReturns
v2.actions(wallet, { limit, offset })GET /v2/actionsActionsResponse
v2.action(wallet, id)GET /v2/actions/{id}ActionDetail
v2.taxonomy()GET /v2/taxonomyTaxonomyResponse
v2.lineage(mint)GET /v2/instruments/{mint}/lineageLineageResponse
const { actions } = await corpact.v2.actions(wallet);

for (const a of actions) {
  // type: cash_dividend, spin_off, stock_dividend, identity_change, …
  // treatment: income, quantity_basis, basis_allocation, identity, not_booked
  console.log(a.type, a.treatment, a.quantityDisplay, a.usd ?? 'USD unknown', a.lifecycle.state);
}

// Full evidence for one action: lifecycle steps, six timestamps, every issuer revision, lineage.
const detail = await corpact.v2.action(wallet, actions[0]!.id);

All response types are exported, for example import type { Action, ActionDetail, IncomeEntry, Position } from '@corpact/client'.

Errors

A non-2xx response throws CorpactApiError with status, message and the parsed body:

try {
  await corpact.portfolio(wallet);
} catch (error) {
  if (error instanceof CorpactApiError && error.status === 404 && (error.body as { code?: string }).code === 'wallet_not_registered') {
    await corpact.requestSync(wallet);
  } else {
    throw error;
  }
}

Schemas

The raw JSON schemas are exported as schemas, for your own validation:

import { schemas } from '@corpact/client';