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:
@sapiom/tools— the typed capability client (the same one agents use asctx.sapiom.*). Start here.- HTTP wrappers (
@sapiom/fetch,@sapiom/axios) — payment-aware drop-ins for your existing HTTP code. - Raw REST — every capability gateway speaks HTTP with x402 payment handling.
Get set up
Section titled “Get set up”-
Get an API key
Section titled “Get an API key”Grab one from the Sapiom Dashboard.
Terminal window export SAPIOM_API_KEY="your_api_key_here" -
Install the typed client
Section titled “Install the typed client”Terminal window npm install @sapiom/tools -
Call a capability
Section titled “Call a capability”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.
Ambient auth & attribution
Section titled “Ambient auth & attribution”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" },});HTTP wrappers
Section titled “HTTP wrappers”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.
Raw REST
Section titled “Raw REST”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.