Skip to main content

JavaScript & TypeScript SDK

Use @upon-ai/sdk to call the UponAI public API from Node.js. Requires Node.js 22.14 or later. Licensed under MIT by UponAI.

Install​

npm install @upon-ai/sdk@0.1.1

Create a customer API token in your dashboard profile and provide it to your server as UPONAI_API_KEY. Keep it out of browser bundles and source control.

Make your first request​

import { UponAI } from '@upon-ai/sdk';

const client = new UponAI({ apiKey: process.env.UPONAI_API_KEY! });
const workspaces = await client.listWorkspaces();
console.log(workspaces);

// Replace 123 with a workspace ID returned above.
const agents = await client.listAgents({
query: { workspaceId: 123, limit: 20 },
});
console.log(agents);

The client provides typed methods for 75 approved public operations. Inputs use path, query, and body groups matching the API reference. Each interactive API page includes a TypeScript SDK example that follows your request fields.

Handle errors and cancellation​

import { UponAIError } from '@upon-ai/sdk';

try {
await client.getAgent(
{ path: { agentId: 'agent_example' }, query: { workspaceId: 123 } },
{ timeoutMs: 15_000 },
);
} catch (error) {
if (error instanceof UponAIError) {
console.error(error.status, error.requestId);
}
}

Requests time out after 30 seconds by default. GET requests retry selected transient HTTP failures up to twice; writes are never automatically retried. An AbortSignal can be passed as signal in the second argument. Multipart operations accept native FormData; binary operations return Blob.

Package on npm · Source and examples