API Referencev1

TypeScript SDK

Install the Nexra TypeScript SDK, sign in, start runs, follow cursor pages and verify event webhooks from TypeScript or JavaScript.

Updated 14/10/2026

On this page

Install

The TypeScript SDK is awaiting publication to npm. Registry installation will be available here once the release is verified.

For access to the prepared package, contact contact@amakoragroup.com. You can also use the REST API.

Create a client

javascript
import { createNexraClient } from "@amakora/nexra-sdk";

const nexra = createNexraClient({
  token: process.env.NEXRA_TOKEN,
  workspaceId: process.env.NEXRA_WORKSPACE_ID,
});

Both options default to those environment variables. Get a token with nexra auth login.

Call the API

javascript
import { unwrap } from "@amakora/nexra-sdk";

const integrations = unwrap(await nexra.GET("/api/console/connect/integrations"));

const flow = unwrap(
  await nexra.GET("/api/console/connect/flows/{flowId}", {
    params: { path: { flowId: "cmflow01orders" } },
  }),
);

unwrap returns the data or throws NexraApiError with status, message, code and requestId.

Start a run

javascript
import { startRun } from "@amakora/nexra-sdk";

const run = await startRun(nexra, "cmflow01orders", { environment: "sandbox" });

startRun adds an idempotency key and correlation id, so a retry never starts a second run.

Retries

Requests are retried up to 3 times with backoff on network errors and on 408, 425, 429 and 5xx answers, honouring Retry-After. Requests that change data are only retried when they carry an idempotency key or were refused with 429. Use createNexraClient({ retry: { maxRetries: 5 } }) to change this, or retry: false to turn it off.

Cursor pages

javascript
import { paginate } from "@amakora/nexra-sdk";

for await (const entry of paginate((cursor) =>
  nexra.GET("/api/console/connect/governance/evidence", { params: { query: { cursor } } }),
)) {
  console.log(entry.sequence, entry.eventType);
}

Verify event webhooks

javascript
import { constructEvent } from "@amakora/nexra-sdk";

// rawBody: the request body exactly as received, before JSON parsing.
const event = await constructEvent(rawBody, request.headers["x-amakora-signature"], secret);
if (event.type === "flow.run.failed") {
  console.log(event.data.run.id, event.data.reason?.message);
}

constructEvent throws WebhookVerificationError when the signature does not match or is more than 5 minutes old.

Send events to a webhook trigger

javascript
import { signTriggerRequest } from "@amakora/nexra-sdk";

const body = JSON.stringify({ orderId: "1001" });
const headers = await signTriggerRequest(body, triggerSecret, "order-1001-0001");
await fetch(triggerUrl, { method: "POST", headers, body });

The event id must be new for each event. A repeat of the same id and body is accepted once.

Need a hand?

Ask Nexra Agent for implementation steps or error guidance.

Ask Nexra Agent