Skip to content
Go To Dashboard

SDK & API

Everything on Sapiom’s capability catalog is callable directly from your code — no agent to author, no MCP client required. Three surfaces, same capabilities and billing:

  1. @sapiom/tools — the typed capability client (the same one agents use as ctx.sapiom.*). Start here.
  2. HTTP wrappers (@sapiom/fetch, @sapiom/axios) — payment-aware drop-ins for your existing HTTP code.
  3. Raw REST — every capability gateway speaks HTTP with x402 payment handling.
  1. Grab one from the Sapiom Dashboard.

    Terminal window
    export SAPIOM_API_KEY="your_api_key_here"
  2. Terminal window
    npm install @sapiom/tools
  3. import { createClient } from "@sapiom/tools";
    const sapiom = createClient({ apiKey: process.env.SAPIOM_API_KEY });
    const results = await sapiom.search.webSearch({ query: "latest AI news" });
    console.log(results);

    Every namespace is typed — sapiom. autocompletes the catalog (sandboxes, repositories, models, search, fileStorage, database, email, domains, memory, and more), and TypeScript rejects anything that doesn’t exist.

The namespaces can also be imported directly — they resolve SAPIOM_API_KEY from the environment:

import { sandboxes, repositories } from "@sapiom/tools";
await sandboxes.create({ name: "demo" });

To attribute spend (so calls show up per-agent in your transaction history and spending rules apply), set attribution once on the client:

const sapiom = createClient({
apiKey: process.env.SAPIOM_API_KEY,
attribution: { agentName: "digest-bot" },
});

Prefer plain HTTP? The wrapper SDKs make any request to a Sapiom service handle payment automatically:

import { createFetch } from "@sapiom/fetch";
const fetch = createFetch({ apiKey: process.env.SAPIOM_API_KEY! });
const response = await fetch(
"https://linkup.services.sapiom.ai/v1/search?q=latest+AI+news&depth=standard"
);
console.log(await response.json());

@sapiom/axios wraps Axios the same way — see HTTP Clients for both, plus Node’s native http.

Each capability page documents its gateway endpoints (URLs, parameters, pricing, error codes). Requests carry your key in the x-sapiom-api-key header; payment-gated routes speak the x402 flow, which the SDKs handle for you.