Skip to main content

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 actionflows

Requires 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!,
});
OptionTypeRequiredDescription
apiKeystringYesOrganization API key
baseURLstringNoAPI 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;
  }
}

Next

On this page