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

@cargo-ai/api

v1.0.15

Published

Cargo API client and types

Readme

Cargo API

TypeScript client for the Cargo API. Use it to manage data models, orchestrate workflows, build AI agents, and integrate with the Cargo platform from Node.js or the browser.

API reference: docs.getcargo.ai/api-reference/introduction

Installation

npm install @cargo-ai/api

Peer dependencies

@cargo-ai/api depends on @cargo-ai/types and @cargo-ai/utils, which are published alongside it. Install them if your environment does not already provide them:

npm install @cargo-ai/types @cargo-ai/utils

Usage

Building the API client

Create an API client by calling buildApi with your API token (Bearer auth):

import { buildApi } from "@cargo-ai/api";

const api = buildApi({
  accessToken: "YOUR_API_TOKEN",
});

// Use domain APIs
const datasets = await api.storage.dataset.all();
const workflows = await api.orchestration.workflow.all();

baseUrl defaults to https://api.getcargo.io. Override it if you need to target a different environment:

const api = buildApi({
  baseUrl: "https://custom-api.example.com",
  accessToken: "YOUR_API_TOKEN",
});

Client behavior: HTTP requests use a 6-minute timeout. Long-running operations (e.g. sync, runs) may need to be polled or observed via other means; see the API reference.

Domain clients and types

The package exports typed domain namespaces and API modules for:

  • Ai – AI resources, agents, MCP servers, files
  • Billing – subscriptions and billing
  • Connection – connectors, integrations, filters
  • Expression – expressions and formula helpers
  • Orchestration – workflows, plays, tools, templates
  • RevenueOrganization – members, capacities, territories
  • Segmentation – segments, changes
  • Storage – datasets, models, relationships, columns
  • SystemOfRecordIntegration – systems of record, clients
  • UserManagement – users and permissions
  • WorkspaceManagement – workspaces, folders, roles, tokens

Each domain exposes sub-areas on the API instance. Examples:

| Domain | Sub-areas (e.g. api.<domain>.<sub>) | | ----------------------------- | -------------------------------------------------------------------------------------------------------------------- | | Ai | template, agent, release, chat, message, vote, document, mcpServer, mcpClient, prompt, memory, file, suggestedAction | | Billing | usage, subscription | | Connection | connector, integration, nativeIntegration | | Expression | favoriteRecipe, recipe, expression | | Orchestration | batch, workflow, play, tool, release, draftRelease, run, record, node, template | | RevenueOrganization | allocation, capacity, member, territory | | Segmentation | segment, change, record | | Storage | column, dataset, model, relationship, run, record | | SystemOfRecordIntegration | systemOfRecord, client, log | | UserManagement | user | | WorkspaceManagement | workspace, file, user, token, role, folder |

Use the domain types (from @cargo-ai/api or @cargo-ai/types) for request/response typing and the API instance (api.storage, api.connection, etc.) for HTTP calls.

More usage examples

// Create a connector – a dataset is automatically created for each connector.
const { connector, dataset } = await api.connection.connector.create({
  name: "My HubSpot",
  slug: "my-hubspot",
  integrationSlug: "hubspot",
  config: {
    /* integration-specific credentials / settings */
  },
});

// List storage runs for a model
const runs = await api.storage.run.list({ modelUuid: "...", limit: 20 });

// List orchestration runs with filters
const orchestrationRuns = await api.orchestration.run.list({
  workflowUuid: "...",
  statuses: ["success"],
});

Error handling

import { determineIfIsFetcherError, type FetcherError } from "@cargo-ai/api";

try {
  await api.storage.dataset.get("...");
} catch (err) {
  if (determineIfIsFetcherError(err)) {
    const fetcherError = err as FetcherError;
    console.error(fetcherError.status, fetcherError.body);
  }
}

Requirements

  • Node.js 22.x
  • TypeScript (for types)

Resources

  • Cargo API Reference – Endpoints, authentication, and platform concepts (Datasets, Models, Connectors, Tools, Plays, Agents, etc.)
  • API tokens: create in your workspace under Settings → API

License

See the root of the repository for license information.