Installation
Install the actionflows TypeScript SDK, create a client with an organization API key, and handle ActionFlowsError.
Installation
Install the official client, then create one ActionFlows instance per process with an organization API key.
npm i actionflowsRequires Node.js 18 or later (global fetch). Use it on a server. Do not put the API key in a browser or mobile app.
Create a client
Create an API key in the app under Settings → API Keys.
import { ActionFlows, createClient } from "actionflows";
const client = new ActionFlows({
apiKey: process.env.ACTIONFLOWS_API_KEY!,
// baseURL defaults to https://api.actionflows.ai
});
// Same client:
const also = createClient({
apiKey: process.env.ACTIONFLOWS_API_KEY!,
});| Option | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Organization API key |
baseURL | string | No | API origin. Default https://api.actionflows.ai |
Errors
Methods throw ActionFlowsError when the API returns a non-2xx status.
import { ActionFlowsError } from "actionflows";
try {
await client.listActionFlows();
} catch (error) {
if (error instanceof ActionFlowsError) {
console.error(error.message, error.statusCode, error.response);
} else {
throw error;
}
}