Skip to content

TypeScript SDK

The TypeScript SDK provides a type-safe client for integrating with Subnoto’s API. It handles authentication, encryption, and provides helper functions for common operations.

Terminal window
npm install @subnoto/api-client
# or
pnpm add @subnoto/api-client
# or
yarn add @subnoto/api-client
import { SubnotoClient } from "@subnoto/api-client";
const client = new SubnotoClient({
apiBaseUrl: "https://enclave.subnoto.com",
accessKey: process.env.API_ACCESS_KEY,
secretKey: process.env.API_SECRET_KEY,
unattested: false
});
// Use openapi-fetch syntax
const { data, error } = await client.POST("/public/workspace/list", { body: {} });
OptionTypeRequiredDescription
apiBaseUrlstringYesAPI base URL
accessKeystringYesAPI access key
secretKeystringYesAPI secret key
unattestedbooleanNoUse unattested mode (default: false)
attesterKeyBufferNoPublic key for attestation

The SDK includes a helper function for uploading documents:

import { SubnotoClient } from "@subnoto/api-client";
import { readFileSync } from "fs";
const client = new SubnotoClient({
apiBaseUrl: "https://enclave.subnoto.com",
accessKey: process.env.API_ACCESS_KEY,
secretKey: process.env.API_SECRET_KEY
});
const fileBuffer = readFileSync("path/to/document.pdf");
const { envelopeUuid, documentUuid } = await client.uploadDocument({
workspaceUuid: "your-workspace-uuid",
fileBuffer: fileBuffer,
envelopeTitle: "My Document"
});

The SDK uses openapi-fetch syntax for all API calls. All endpoints are type-safe and match the OpenAPI specification.

For complete API documentation, see the OpenAPI specifications.