npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

arkova

v3.6.0

Published

Arkova verification SDK — anchor and verify documents with cryptographic proof

Readme

Arkova SDK

The official TypeScript / JavaScript SDK for the Arkova verification API. Published to npm as arkova. Anchor documents to a public network, call the API v2 agent tools, verify records, and manage webhooks — all without ever opening the Arkova web app.

npm version License: MIT


Table of Contents


Install

npm install arkova

Or with pnpm: pnpm add arkova. Or with yarn: yarn add arkova.

This README describes the accompanying package. Pin the version you install and check npm view arkova version when choosing a release; server-side capabilities may also be disabled for an account or environment.

Requirements: Node.js ≥20 (uses native fetch and global crypto.subtle). Works in browsers, Cloudflare Workers, Deno, and Bun without polyfills.

Bundle size: About 38 KB minified (about 11 KB gzipped, measured with esbuild on 2026-10-07), zero runtime dependencies.


Quickstart

import { Arkova } from 'arkova';

const arkova = new Arkova({ apiKey: process.env.ARKOVA_API_KEY });

// 1. Anchor a document — fingerprint runs client-side, the document never leaves your machine
const receipt = await arkova.anchor('document content goes here', { action: 'queue' });
console.log(receipt.publicId); // "ARK-2026-001"

// 2. A newly queued record has no settled network proof yet
const result = await arkova.verify(receipt.publicId);
console.log(result.verified); // false while the record is PENDING

// Check again after the record reaches SECURED; only then can verified be true.

// 3. Verify synchronous batches
const batch = await arkova.verifyBatch(['ARK-2026-001', 'ARK-2026-002', 'ARK-2026-003']);

// 4. Register a webhook so your system gets notified instead of polling
const webhook = await arkova.webhooks.create({
  url: 'https://api.example.com/hooks/arkova',
  events: ['anchor.secured', 'anchor.revoked'],
});
console.log('Save this secret:', webhook.secret); // shown ONCE — store immediately

That's it. No UI, no SDK calls to learn beyond anchor, verify, verifyBatch, v2 search, and webhooks.*.

20-line document anchor example

See examples/anchor-document.ts for a complete Node 20+ script that anchors a local document and prints the public ID.


Configuration

import { Arkova } from 'arkova';

const arkova = new Arkova({
  /** API key — get one from app.arkova.ai/settings/api-keys */
  apiKey: 'ak_live_...',

  /** Override the API base URL (default: https://api.arkova.ai) */
  baseUrl: 'https://api.arkova.ai',

  /** Per-attempt deadline through response body (default: 10 seconds). */
  timeoutMs: 10_000,

  /** Optional short-lived user access token, used only by arkova.sourceImports.* */
  // accessToken: '<user access token>',

  /** Optional retry tuning. Retries apply when the method is safe (GET/HEAD/OPTIONS)
   *  or the call is idempotent (verifyBatch, anchor, anchorBulk). 429 responses
   *  honor Retry-After within maxDelayMs; longer waits return the error. */
  retry: { retries: 2, baseDelayMs: 250, maxDelayMs: 5000 },

  /** Optional x402 micropayment config (machine-to-machine billing) */
  x402: {
    payerAddress: '0xae12...',
    signPayment: async (amount, payTo) => {
      // your on-chain signer's payment-signing logic
      return signedPaymentToken;
    },
  },
});

The apiKey is the only thing you usually need. The SDK ships pointed at the public production API hostname; only override baseUrl for local development or staging.

timeoutMs accepts an integer from 1 to 120,000. It applies to each fetch and body-read attempt; retries and backoff for safe or idempotent calls can make the total request longer. A deadline failure raises ArkovaError with code request_timeout and status 408. Agent registration, key creation, and ComputeID admission are non-idempotent and are not retried automatically after a timeout; reconcile their state before retrying. A caller-provided AbortSignal on request() remains effective.


Anchoring

arkova.anchor(data)

Compute a SHA-256 fingerprint of data in your browser or process. The raw document remains local; the fingerprint and any optional approved metadata are submitted for network anchoring.

// String input
const r1 = await arkova.anchor('any document content');

// Binary input (ArrayBuffer or Uint8Array)
const fileBytes = await fetch('/path/to/file.pdf').then(r => r.arrayBuffer());
const r2 = await arkova.anchor(fileBytes, { fileMime: 'application/pdf' });

// HakiChain-style callers can submit a fingerprint computed in their own process.
// fileMime and label are metadata; DIPLOMA is accepted as a legacy alias for DEGREE.
const r3 = await arkova.anchorFingerprint('a'.repeat(64), {
  action: 'queue', fileMime: 'application/pdf', label: 'Degree record', credentialType: 'DIPLOMA',
});

console.log(r1);
// {
//   publicId: "ARK-2026-001",
//   fingerprint: "abc123...",  // SHA-256 hex
//   status: "PENDING",          // May be any lifecycle state on an idempotent replay
//   createdAt: "2026-04-11T10:30:00.000Z",
//   networkReceiptId: undefined  // populated once SECURED
// }

Idempotency: the same fingerprint returns the same publicId. Anchoring identical content twice is a no-op. The replay receipt reports the existing record's current lifecycle state, including REVOKED, EXPIRED, SUPERSEDED, or PENDING_RESOLUTION; it does not reset the status to PENDING.

anchorFingerprint omits file_mime when fileMime is not supplied. The record's public name is filename if given; for a connector document, the document's own name; otherwise a neutral default such as "Legal document from the API, Nov 14 2026". label and description stay private and never become the public name; send filename to set a specific public title. The receipt carries it as optional name, and each anchorBulk row does too. Check the returned lifecycle status before treating a repeated submission as secured.

arkova.getAnchorSubmissionStatus(publicId)

Read the API-key caller's durable queue or instant-processing state. This is authenticated submission state, not the public verification result.

const submission = await arkova.getAnchorSubmissionStatus(r1.publicId);
console.log(submission.action, submission.anchorStatus, submission.instantStatus);
if (submission.retryable) {
  // Re-submit the same fingerprint with action: 'instant' after restoring credit.
}

New server responses always include wire fields action, credit_state, instant_status, and idempotent; the SDK maps them to action, creditState, instantStatus, and idempotent. Those receipt fields remain optional in the SDK so applications can also parse receipts retained from older deployments; the dedicated status method validates its lifecycle enums strictly.

arkova.fingerprint(data)

Standalone client-side SHA-256 helper. Useful when you want to compute the fingerprint yourself before deciding whether to anchor.

const fp = await arkova.fingerprint('hello world');
// "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"

arkova.anchorBulk(inputs, options?)

Anchor up to 1000 documents in one call — wires POST /api/v1/anchor/bulk (HAKI-REQ-02). Each row is either a pre-computed fingerprint (you already hashed the file) or raw data (the SDK fingerprints it client-side, same as anchor() — the document body never leaves this process for that row). You can mix both forms in one call.

import { readFile } from 'node:fs/promises';

const contractBytes = await readFile('./contract.pdf');

const result = await arkova.anchorBulk(
  [
    // Already hashed elsewhere — send the fingerprint directly.
    { fingerprint: 'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9', externalId: 'invoice-001' },
    // Raw content — the SDK hashes it for you before it's ever sent.
    {
      data: contractBytes.buffer,
      credentialType: 'CONTRACT_PRESIGNING',
      documentType: 'contract',
      matterOrCaseRef: 'CASE-42',
      originalDocumentDate: '2025-11-03T00:00:00Z',
    },
  ],
  { duplicateStrategy: 'skip', batchId: 'nightly-2026-07-28' },
);

console.log(result.queued);      // 2
console.log(result.duplicates);  // [] — none this run
console.log(result.errors);      // [] — per-row insert failures land here, batch still succeeds
result.anchors?.forEach((a) => console.log(a.publicId, a.status)); // "PENDING" until secured

Options:

| Option | Default | Effect | |---|---|---| | dryRun | false | Validate every row (schema + dedup) without queuing or deducting credits. result.anchors is omitted. | | duplicateStrategy | 'fail' (server-side) | 'fail' 409s the whole batch on any duplicate fingerprint (in-batch or already anchored in your org); 'skip' drops duplicate rows and queues the rest; 'supersede' / 'link' are accepted for lineage workflows — see the worker's anchor-bulk.ts for exact semantics. | | batchId | none | Your own correlation ID, echoed back and surfaced in audit events. |

Limits:

  • Empty array → returns a zero-row response immediately, no network call.
  • More than 1000 rows → throws ArkovaError with code: 'batch_too_large' (no network call). The SDK does not auto-chunk: splitting a logical batch across requests would let a duplicate fingerprint slip past the (cheaper) intra-batch check and would deduct credits per chunk instead of atomically for the whole batch. Split manually and correlate with a shared batchId if you need more than 1000 rows.
  • A row with neither fingerprint nor data (or with both) throws ArkovaError with code: 'invalid_request' before any network call.
  • 402 response → insufficient_credits; 409 response (only with duplicateStrategy: 'fail') → duplicate_fingerprints.

arkova.anchorImport(rows, options)

Import 1 to 100 already-fingerprinted spreadsheet rows through POST /api/v1/anchor/import. The tenant comes from the API key, rows carry fingerprints and metadata only (never document bytes), and the write is never retried automatically because a lost response may hold durable per-row receipts.

const imported = await arkova.anchorImport(
  [
    {
      fingerprint: 'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9',
      filename: 'diploma-0001.pdf',
      fingerprintProvided: true,
      recipientEmail: '[email protected]', // optional: assigns the record to this person
    },
  ],
  { action: 'queue', description: 'Spring 2026 graduates' }, // description max 500 characters
);

console.log(imported.created, imported.skipped, imported.failed, imported.recipientLinkFailed);

Rows with status created_recipient_failed or skipped_recipient_failed mean the record exists and only the recipient link failed: do not re-submit them. Rows can also carry recipientStatus (linked | activation_pending) when the worker returns it.

arkova.listAnchors(options?)

List private records for the API key's organization (GET /api/v1/anchors, requires a key with read:records). Filters: since / until (RFC 3339 interval), paired tag and tagScope, limit (1 to 100) and an opaque cursor. It returns { anchors, nextCursor } and never falls back to the public search corpus.


Verification

arkova.verify(publicId) or arkova.verify(data, receipt)

Two call signatures:

// 1. By public ID — quick lookup
const result = await arkova.verify('ARK-2026-001');

// 2. By data + receipt — also re-checks the fingerprint matches the receipt
const result = await arkova.verify(originalData, receipt);

The result shape:

{
  verified: true,                       // false if data doesn't match the receipt
  status: 'ACTIVE',                     // ACTIVE | REVOKED | EXPIRED | SUPERSEDED | UNKNOWN
  issuerName: 'University of Michigan',
  credentialType: 'DEGREE',
  issuedDate: '2025-05-15',
  expiryDate: null,
  anchorTimestamp: '2026-04-11T10:30:00.000Z',
  networkReceiptId: 'tx-abcdef123456...',
  recordUri: 'https://app.arkova.ai/verify/ARK-2026-001',
  description: 'Bachelor of Science transcript',
  confidenceScores: { overall: 0.93, fields: { issuerName: 0.97 } },
  subType: 'official_undergraduate',
}

Verification results also expose rich nullable metadata when the API returns it, including complianceControls, chainConfirmations, parentPublicId, versionNumber, revocationTxId, revocationBlockHeight, fileMime, and fileSize.

anchorTimestamp is string | null: null means no observed anchor time is available. Both an omitted API field and an explicit null normalize to null, including in verifyBatch(). Check for null before formatting the value; the SDK does not substitute the record's creation time.

When called with (data, receipt) and the SHA-256 fingerprint of data doesn't match receipt.fingerprint, the SDK returns { verified: false, status: 'UNKNOWN', ... } without making a network call. This is the offline tamper detection path.


Batch verification

arkova.verifyBatch(publicIds)

Verify up to 20 credentials in a single synchronous round-trip. Results are returned in the same order as the input array.

const results = await arkova.verifyBatch([
  'ARK-2026-001',
  'ARK-2026-002',
  'ARK-2026-003',
]);

results.forEach((r, i) => {
  console.log(`${i}: ${r.verified ? '✅' : '❌'} ${r.issuerName}`);
});

Limits:

  • Empty array → returns [] immediately, no network call.
  • More than 20 IDs → throws ArkovaError with code: 'batch_too_large' (no network call).
  • Rate limit: 10 batch req/min per API key.

Public search (no API key)

searchPublic(query, options?) searches public issuer organizations, public member profiles, publicly verifiable records, and secured public-source records through GET /api/v1/public/search. It works without an API key (anonymous tier, 100 requests/minute per IP). If the client has a key configured, the key is sent as usual and only moves the call to the 1,000 requests/minute keyed tier.

import { Arkova } from 'arkova';

const arkova = new Arkova(); // no apiKey needed
const { results, total, unavailable } = await arkova.searchPublic('acme university', {
  type: 'all', // 'all' | 'orgs' | 'members' | 'anchors' | 'imports' (default 'all')
  limit: 10,   // per group, 1-50 (default 10)
});

results.orgs[0]?.profileUrl;     // public issuer page
results.members[0]?.profileUrl;  // public member profile
results.anchors[0]?.verifyUrl;   // public verification page
results.imports[0]?.sourceUrl;   // original public source, when known
  • All four results groups are always present. Groups you did not select with type are empty arrays.
  • Rows carry only public identifiers (publicId) and display fields. Internal identifiers and emails are never returned.
  • A non-empty unavailable array (for example ['members']) means those groups failed for this request and the response is partial. ArkovaError with statusCode: 503 and code: 'search_unavailable' means every requested group failed.
  • Input is checked before any request is sent. A query shorter than 2 or longer than 200 characters (after trimming), a limit outside 1-50, or an unknown type throws ArkovaError with statusCode: 400 and code: 'invalid_request'.
  • searchPublic is a GET, so 429, 500, 502, 503, and 504 responses are retried under the client's retry policy (honouring Retry-After) before the error is thrown.

This is separate from the API v2 search() below, which needs a key with read:search and returns a different result shape.

API v2 agent tools

The SDK includes typed wrappers for the API v2 read-only agent operations described by the OpenAPI 3.1 spec at https://api.arkova.ai/v2/openapi.json.

const { results } = await arkova.search('Acme compliance certificate', {
  type: 'document',
  limit: 5,
});

const fingerprint = await arkova.fingerprint('contract body');
const verification = await arkova.verifyFingerprint(fingerprint);

const anchor = await arkova.getAnchor(results[0].publicId);
const orgs = await arkova.listOrgs();

Retries are built in for 429, 500, 502, 503, and 504. A request is retried only when its HTTP method is safe (GET/HEAD/OPTIONS) OR the call is idempotent. The idempotent calls are verifyBatch (a read expressed as POST, served on the 10 req/min batch tier), anchor, and anchorBulk (both idempotent on the fingerprint server-side — see Idempotency above). Non-idempotent writes never retry: webhooks.create, webhooks.update, webhooks.delete, and webhooks.test surface a transient 429/5xx to the caller rather than risk a duplicate. For rate limits, the SDK reads Retry-After and waits before retrying when the requested delay fits retry.maxDelayMs; longer delays return the original error without an early retry. API v2 errors are exposed as ArkovaError.problem with the full RFC 7807 { type, title, status, detail, instance } payload.


Webhook management

Since INT-09 (April 2026) the SDK offers full programmable CRUD over webhook endpoints, so you do not need the Arkova web UI to manage webhooks.

The API key must hold the webhooks:manage scope (SCRUM-3981). Every method in this namespace goes to /api/v1/webhooks*, which requires it; no other scope implies it, and a key minted with the default read:search gets 403 insufficient_scope. Re-issue the key with webhooks:manage selected. The worker also checks the key actor's current owner/admin membership in the exact organization for this management surface.

The arkova.webhooks namespace has six endpoint-management methods. Since 3.4.0 it also has five delivery-history and recovery methods, described below.

Webhook CRUD is a legacy v1 management surface. Its id values are webhook endpoint identifiers scoped to the authenticated org, not API v2 public resource identifiers. API v2 agent/search/detail surfaces use public_id/publicId and do not expose internal database UUIDs.

arkova.webhooks.create(input)    // Register a new endpoint, returns the secret ONCE
arkova.webhooks.list(options?)   // Paginated list of org endpoints
arkova.webhooks.get(id)          // Get one by ID
arkova.webhooks.update(id, input)// Partial update (url / events / description / isActive)
arkova.webhooks.delete(id)       // Permanently delete (cascades to delivery logs)
arkova.webhooks.test(id)         // Send a synthetic test event to verify connectivity

Delivery-history and recovery operations (added in 3.4.0):

| Method | Result | |---|---| | listDeliveries({ endpointId?, limit? }) | Newest delivery metadata; total counts returned rows | | listDeadLetters({ limit? }) | Unresolved failure metadata; total counts returned entries | | replayDelivery(deliveryId) | New replay receipt and the immediate receiver outcome | | resolveDeadLetter(entryId) | Resolution acknowledgement; does not resend | | retryMaterialization(outboxId, { requestId }) | Agent-event materialization recovery receipt; does not confirm delivery |

Both metadata lists default to 50 rows, accept limits from 1 to 100, and provide no cursor. A full response is a bounded snapshot, not proof that all history or failures were returned. Stored payloads, response bodies and raw stored error text are omitted. Delivery status/HTTP status and dead-letter failureKind remain available. endpointDisplayUrl removes URL user credentials, query and fragment; it is a display value, while the existing endpoint CRUD url remains the exact configured URL.

const snapshot = await arkova.webhooks.listDeliveries({ endpointId: endpoint.id, limit: 100 });
const failures = await arkova.webhooks.listDeadLetters({ limit: 100 });

// Take either action only after choosing the specific owned failure.
const replay = await arkova.webhooks.replayDelivery(chosenDeliveryId);
// replay.replayed confirms creation of the replay receipt; replay.ok is the immediate HTTP outcome.
await arkova.webhooks.resolveDeadLetter(chosenDeadLetterId);

// Agent-event outbox only. Persist this request UUID before sending it.
const requestId = crypto.randomUUID();
const recovery = await arkova.webhooks.retryMaterialization(knownAgentOutboxId, { requestId });
// Recovery is asynchronous; keep requestId when reconciling an uncertain outcome.

These three operation writes never retry automatically. A malformed success receipt or transport failure can follow a successful write; the SDK reports that uncertainty without including the raw response or network error. Inspect the receipt before repeating replay or resolution. Agent materialization recovery uses the caller's request UUID for its server-side idempotency; it does not recover confirmation outbox entries. Initial pending deliveries can have attemptNumber: 0.

Endpoint create and update also round-trip scope: 'self' | 'self_and_descendants'. An explicit create/update scope must be acknowledged exactly by the server. A missing or mismatched acknowledgement raises invalid_response with write uncertainty guidance. Reads and writes that omit scope continue to support older responses that omit it. Subscription scope does not grant access to another organization.

Register a webhook

const { id, secret, warning } = await arkova.webhooks.create({
  url: 'https://api.example.com/hooks/arkova',
  events: ['anchor.secured', 'anchor.revoked'],  // optional, this is the default
  description: 'Production HR sync',              // optional
  verify: true,                                   // optional — sends a verification ping first
});

// ⚠️ secret is shown ONCE. Store it immediately in your secret manager.
console.log(warning); // "Save this secret now. It is shown once and used to verify HMAC signatures..."

If verify: true, Arkova POSTs a challenge token to the URL with a 5-second timeout. Your endpoint must respond 2xx and echo the challenge token in the body — otherwise registration fails with verification_failed.

List, get, update, delete

// List with pagination
const { webhooks, total, limit, offset } = await arkova.webhooks.list({ limit: 50, offset: 0 });

// Get one
const endpoint = await arkova.webhooks.get('550e8400-e29b-41d4-a716-446655440000');

// Disable temporarily
await arkova.webhooks.update(endpoint.id, { isActive: false });

// Re-enable + change URL
await arkova.webhooks.update(endpoint.id, {
  isActive: true,
  url: 'https://api.example.com/v2/hooks/arkova',
});

// Subscribe to additional events
await arkova.webhooks.update(endpoint.id, {
  events: ['anchor.secured', 'anchor.revoked', 'anchor.expired'],
});

// Permanently delete
await arkova.webhooks.delete(endpoint.id);

Test connectivity

const result = await arkova.webhooks.test(endpoint.id);
// { success: true, statusCode: 200, eventId: "test_a1b2c3..." }

Verifying webhook signatures

Every event Arkova sends to your URL includes three headers:

| Header | Description | |---|---| | X-Arkova-Signature | HMAC-SHA256 hex digest | | X-Arkova-Timestamp | Unix epoch seconds | | X-Arkova-Event | Event type |

The signature is computed as HMAC-SHA256(secret, ${timestamp}.${rawBody}). Verify it like this:

import crypto from 'node:crypto';

export function verifyArkovaWebhook(rawBody, headers, secret) {
  const signature = headers.get('X-Arkova-Signature') ?? '';
  const timestamp = headers.get('X-Arkova-Timestamp') ?? '';

  // Reject malformed input before decoding or calling timingSafeEqual.
  if (!/^[a-f0-9]{64}$/i.test(signature) || !/^\d+$/.test(timestamp)) return false;
  // Replay protection — reject events older than 5 minutes
  const ageSec = Math.floor(Date.now() / 1000) - Number(timestamp);
  if (Number.isNaN(ageSec) || ageSec > 300 || ageSec < -60) return false;

  const expected = crypto
    .createHmac('sha256', secret)
    .update(`${timestamp}.${rawBody}`)
    .digest('hex');

  return crypto.timingSafeEqual(
    Buffer.from(signature, 'hex'),
    Buffer.from(expected, 'hex'),
  );
}

For a complete reference (with Express, Flask, and Go examples), see docs/api/webhooks.md in the Arkova repo.


Nessie semantic search — DISABLED

Not currently served. CTO ruling R-1 (2026-08-12): Nessie is permanently disabled by standing founder directive, and /api/v1/nessie/query now fails closed with 503 {"code":"nessie_disabled","enabled":false, …}. arkova.query() and arkova.ask() therefore throw an ArkovaError on every call.

A failure from these methods is not "no matching records" — no search runs. The methods and types below are documented so existing integrations can recognise and handle the disabled response.

Arkova maintains an embedding corpus of verified public records (SEC filings, court documents, regulatory data). When Nessie was served, these methods searched and asked questions over them, with every result anchored.

arkova.query(q, options?) — retrieval mode

const { results, count } = await arkova.query('Apple revenue 2025', { limit: 5 });

results.forEach(r => {
  console.log(r.title, r.relevanceScore);
  console.log('Anchor proof:', r.anchorProof?.chainTxId);
});

arkova.ask(q, options?) — RAG mode with synthesized answer

const { answer, citations, confidence, model } = await arkova.ask(
  'What was Apple total revenue in 2025?'
);

console.log(answer);     // "Apple reported $394 billion in revenue in 2025..."
console.log(confidence); // 0.88
citations.forEach(c => {
  console.log(`— ${c.title} (${c.source})`);
  console.log(`  Anchor: ${c.anchorProof?.chainTxId}`);
});

Every citation links back to a network-anchored source document, so you can verify the model didn't hallucinate.


Error handling

All SDK methods that fail throw an ArkovaError:

import { Arkova, ArkovaError } from 'arkova';

try {
  await arkova.webhooks.create({ url: 'http://insecure.example.com' });
} catch (err) {
  if (err instanceof ArkovaError) {
    console.log(err.statusCode); // 400
    console.log(err.code);       // "invalid_url"
    console.log(err.message);    // "Webhook URL targets a private or internal network address"
  }
}

Common error codes

| code | HTTP | When | |---|---|---| | validation_error | 400 | Request body or query failed validation | | invalid_url | 400 | Webhook URL targets private/internal IP (SSRF blocked) | | verification_failed | 400 | Webhook verification ping (verify: true) failed | | batch_too_large | 400 | More than 20 IDs passed to verifyBatch | | authentication_required | 401 | Missing or invalid API key | | not_found | 404 | Resource doesn't exist or belongs to another org (webhook, job, and most v1 endpoints) | | rate_limit_exceeded | 429 | Exceeded the rate limit for this endpoint group | | search_unavailable | 503 | searchPublic: every requested result group failed | | internal_error | 500 | Server-side failure — retry with exponential backoff |

code is the server's raw error field, not a fully normalized enum. Most v1 endpoints send a machine-readable slug (not_found, invalid_url, ...) and the table above reflects those. One confirmed exception: arkova.verify(publicId) against an unknown ID gets HTTP 404 with error: "Record not found" (human-readable prose, not not_found) — so err.code for that specific call is the literal string "Record not found", not "not_found". Branch on err.statusCode when you need reliable programmatic dispatch; treat err.code as a human-readable hint unless you've confirmed the exact endpoint normalizes it.


x402 micropayments

Arkova supports the x402 protocol for machine-to-machine billing. x402 is enforced for paid API v1 launch scopes such as /api/v1/verify, /api/v1/verify/entity, /api/v1/compliance/check, /api/v1/regulatory/lookup, /api/v1/cle, and /api/v1/nessie/query. API v2 agent/read surfaces use scoped API keys, not x402.

Network: x402 payments currently settle on Base Sepolia (Arkova's present configuration for this feature), not Base's production network — USDC exchanged today is test-environment USDC, not funds with real value. A valid apiKey always bypasses the x402 flow entirely, so most integrations never need this section.

const arkova = new Arkova({
  x402: {
    facilitatorUrl: 'https://x402.arkova.ai',
    payerAddress: '0xae12...',
    signPayment: async (amount, payTo) => {
      // Sign the payment using your on-chain signer (Base Sepolia USDC)
      return await mySigner.signX402(amount, payTo);
    },
  },
});

// Calls without an API key will auto-attach an x402 payment when required
const result = await arkova.verify('ARK-2026-001');

TypeScript types

All types are exported from the package root:

import type {
  ArkovaConfig,
  AnchorReceipt,
  RichVerificationFields,
  VerificationResult,
  NessieQueryResult,
  NessieContextResult,
  WebhookEventType,
  WebhookEndpoint,
  WebhookEndpointWithSecret,
  CreateWebhookInput,
  UpdateWebhookInput,
  PaginatedWebhooks,
  ProblemDetail,
  SearchOptions,
  SearchResponse,
  PublicSearchType,
  PublicSearchOptions,
  PublicSearchResponse,
  PublicSearchOrgResult,
  PublicSearchMemberResult,
  PublicSearchAnchorResult,
  PublicSearchImportResult,
  FingerprintVerification,
  AnchorDetails,
  OrganizationSummary,
} from 'arkova';

Browser usage

The SDK works directly in modern browsers via the standard <script type="module"> pattern or any bundler (Vite, Webpack, esbuild, Rollup, Parcel).

<script type="module">
  import { Arkova } from 'https://esm.sh/arkova';
  const arkova = new Arkova({ apiKey: 'ak_live_...' });
  const receipt = await arkova.anchor('hello from the browser');
  console.log(receipt.publicId);
</script>

⚠️ Never embed live API keys in client-side JavaScript. Use a server-side proxy for browser apps. The SDK works in the browser primarily for local fingerprint computation and anonymous public verification (verify works without an API key).


Reference

Base URL

Production: https://api.arkova.ai Override with baseUrl config option for staging or local development.

Method index

| Method | Description | |---|---| | arkova.fingerprint(data) | Compute SHA-256 fingerprint client-side | | arkova.anchor(data) | Anchor a document fingerprint | | arkova.anchorBulk(inputs, options?) | Anchor up to 1000 documents in one call | | arkova.anchorImport(rows, options) | Import 1 to 100 already-fingerprinted spreadsheet rows (API-key tenant, no automatic retry) | | arkova.getAnchorSubmissionStatus(publicId) | Caller-scoped durable queue or instant submission state | | arkova.listAnchors(options?) | Private organization record listing (read:records), cursor-paginated | | arkova.verify(publicId) | Verify by public ID | | arkova.verify(data, receipt) | Verify by data + receipt (offline tamper check) | | arkova.verifyBatch(publicIds) | Verify up to 20 credentials at once | | arkova.searchPublic(query, options?) | Public search across orgs, members, records, and public-source records (no API key required) | | arkova.search(q, options?) | API v2 search across orgs, records, fingerprints, and documents | | arkova.verifyFingerprint(fingerprint) | API v2 fingerprint verification | | arkova.getAnchor(publicId) | API v2 public anchor lookup | | arkova.listOrgs() | API v2 organization context for the API key | | arkova.getMerkleProof(publicId) | Proof bundle for an anchored record (decoded, not cryptographically verified by the SDK) | | arkova.getAttestation(publicId, options?) | Attestation detail | | arkova.createAttestation(input) | Create an attestation (POST /api/v1/attestations); individual unless an organization administrator asks for an organizational attesterType | | arkova.getOrganization(publicId), getRecord(publicId), getFingerprint(fingerprint), getDocument(publicId) | API v2 public-safe detail readers | | arkova.autoTags.* | Automatic tags per record source (organization, agent, connector, folder): list, set (replaces the list), clear, and applyExisting (tags existing records, 500 per call, repeat with nextCursor until null). Rules apply to records created after them | | arkova.folders.* | Nested folder management: list, create, update, bindConnector, delete, moveRecords, moveRecordsByPublicId | | arkova.sourceImports.preview(input) / .confirm(input) | External record source import; needs a short-lived user accessToken set in the client config, never retried | | arkova.agents.* | Agent lifecycle, see "Agent lifecycle" below | | arkova.query(q, options?) | Nessie retrieval search (disabled: always throws ArkovaError) | | arkova.ask(q, options?) | Nessie RAG (disabled: always throws ArkovaError) | | arkova.webhooks.create(input) | Register a webhook endpoint | | arkova.webhooks.list(options?) | Paginated list of org endpoints | | arkova.webhooks.get(id) | Get a single endpoint | | arkova.webhooks.update(id, input) | Partially update an endpoint | | arkova.webhooks.delete(id) | Permanently delete an endpoint | | arkova.webhooks.test(id) | Send a synthetic test event | | arkova.webhooks.listDeliveries(options?) | Bounded delivery metadata snapshot | | arkova.webhooks.listDeadLetters(options?) | Bounded unresolved failure metadata | | arkova.webhooks.replayDelivery(id) | Replay receipt and immediate receiver outcome | | arkova.webhooks.resolveDeadLetter(id) | Resolve a dead-letter entry without resending | | arkova.webhooks.retryMaterialization(id, input) | Recover an agent-event materialization attempt |

Related documentation

License

MIT © Arkova

Agent lifecycle

client.agents exposes registration, list, detail, update, revoke, one-time key creation, and ComputeID passport admission. Configure an organization API key with agents:manage; admission is API-key-only and never widens the caller's scopes. Save createKey() and admitComputeId() keys immediately: the API returns each raw key once, and the SDK never automatically retries these mutations. The restricted key returned by ComputeID admission is scoped for the admitted agent's work and is not automatically an agent-management key.

Agent action log and daily receipts

client.agents also records what an agent reports about itself and reads the daily receipts that seal it. The routes are available on the hosted MCP server and the REST API, and these methods ship in arkova 3.5.0 and later.

const recorded = await client.agents.recordActions(agentId, [
  { action: 'tool.call', occurredAt: new Date().toISOString(), payloadHash: sha256OfPayload, externalEventId: 'evt-001', description: 'Looked up the refund policy' },
]);
const page = await client.agents.listLogReceipts(agentId, { limit: 30 });   // newest day first
const bundle = await client.agents.getLogReceipt(agentId, '2026-10-25');     // one day, exactly as served
  • Self-reported. Arkova records what the agent said, in order, and does not verify that an action happened, when it happened, that the payload exists, or that the agent reported every action. Only a fingerprint of each payload is sent (payloadHash, 64 hex characters), never the payload. An event may carry one short description (1 to 140 characters (counted as characters, not UTF-16 units) after removing spaces, tabs and line breaks from both ends, with no control characters, invisible formatting characters (including the Unicode tag block) or line and paragraph separators; no wording is refused, and the server replaces personal data (email address, phone number, payment card number, social security style number) with [removed], marks the event, and reports how many descriptions it changed as descriptions_redacted (description_not_stored is true when the action log could not yet keep descriptions) This is a safety net, not a guarantee: it removes clearly formatted email addresses, marked phone numbers, card numbers and US social security numbers; non-US ids are not covered, so agents should not put personal data in descriptions.) in the agent's own words: it is shown on the record and is not verified. The server never refuses one for its wording; it replaces personal data as described and reports the count. From a terminal: arkova agent record-action (see the arkova-api-cli README).
  • A write is never retried automatically. A timeout, a transport failure or a 5xx does not prove nothing was recorded: the thrown ArkovaError has details.writeUncertain === true. Send externalEventId on every event and repeat the same call; an id already recorded comes back in duplicates and is not recorded again.
  • Read the statements. listLogReceipts returns measured, asserted and notAsserted. A receipt does not prove that an action happened or was authorized, and does not show completeness.
  • An event may carry sourceLink: { type: 'record', record: 'ARK-DOC-6ESA54' } (a record of your organization) or { type: 'url', url: 'https://example.com/report/42' }; document and report take either. The client checks only the SHAPE of the link object (an object with a type and exactly one string target of the right kind for the type; no other key). The server decides everything about the value (https, length, characters, host, no user name or password, no secret-looking query or fragment parameter, and that a record is an undeleted record of your organization): a link it does not accept is removed and the action is still recorded, so a bad value is sent as given and never refused by the client. Arkova never fetches or checks a url link: it is what the agent reported. A removed link is listed in result.sourceLinksRemoved (index is 0-based, in the order the events were sent; reason is invalid_link, secret_parameter with the parameter name (never its value), or personal_data), result.sourceLinksRedacted counts every removed link whatever the reason, and result.sourceLinkNotStored is set when the action log could not yet keep source links at all. A stored url is kept in the canonical form of the URL, which can differ in spelling from what was sent.
  • recordActions needs the agent's own key with agent_actions:write, or an organization key with agents:manage; the two reads need an organization key with anchor:read, read:records or agents:manage. getLogReceipt returns the bundle unchanged (snake_case, schema arkova.action_log_receipt_bundle.v1) so arkova-action-log-verify can take it as is.
  • client.agents.get(id) returns latestLogReceipt (logDay, sealStatus, anchorPublicId) when the agent has a daily receipt.

Prepared document extraction (added in 3.4.0)

The extractPreparedDocument(prepared, workspace?) method submits text that has already passed the shared local privacy pipeline. It does not read a local file or perform redaction itself. Supply requestId (a stable UUID), the original document's lowercase SHA-256 fingerprint, strippedText, and a credentialType hint. An optional issuerHint must also be redacted. Select { scope: 'user' } or { orgId: '…' } when choosing a workspace explicitly.

A completed result contains state: 'completed', extracted fields and a document-bound receipt. A pending result contains state: 'in_progress' or 'outcome_unknown' and canRetryProvider: false; it is not a queued document. Recover with getDocumentExtraction(requestId, fingerprint, workspace?), which reads the original request without resending document text or invoking AI again. Keep the original UUID, fingerprint and workspace. The SDK does not automatically retry extraction mutations. Extraction requires the explicit ai:extract grant; queue submission separately requires write permission.

After extraction completes, call submitPreparedDocument({ receipt: extraction.receipt, requestId: queueRequestId, action: 'queue', privateTags: { user: ['test'] } }, workspace). Use a separate stable UUID for submission and retain it if a response is lost. The server consumes the extraction receipt and its stored fields; the client does not resend extracted fields. Optional filename accepts a basename only, never a local path. A successful queue response reports PENDING, its public record ID and dashboard link. It does not mean the document is already anchored. Submission mutations are not automatically retried; an explicit replay must preserve the same request UUID, receipt, action and tags.

Omit submission credentialType to use the canonical category inferred in the private extraction receipt. An explicit category, including OTHER, overrides inference. A replay keeps the category already recorded for that receipt; do not change category intent while recovering the original request. Missing or unrecognized inferred categories fall back to OTHER. This does not guarantee the AI will infer every supported category correctly.

Retry waits are bounded: retry.maxDelayMs (default 5000 milliseconds). If a valid server Retry-After requests a longer wait, the client surfaces the original error and retry metadata without sleeping or retrying early. Short valid waits retain the server minimum.