
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@saperly/sdk
Advanced tools
Typed TypeScript client for the [Saperly](https://saperly.com) API. Give any AI agent a phone number with compliance built in.
Typed TypeScript client for the Saperly API. Give any AI agent a phone number with compliance built in.
npm install @saperly/sdk
Requires Node.js 18+ (uses global fetch). Zero runtime dependencies.
import { Saperly } from "@saperly/sdk";
const client = new Saperly({ apiKey: "sk_live_..." });
// Provision a phone line
const line = await client.lines.create({
name: "support bot",
mode: "text",
webhookUrl: "https://myapp.com/calls",
});
console.log(line.phoneNumber); // +14155550123
// Make an outbound call
const call = await client.calls.create({
lineId: line.id,
toNumber: "+14155551234",
});
// List all lines
const lines = await client.lines.list();
client.lines.create({ name, mode, webhookUrl?, audioHandlerUrl?, statusCallbackUrl? })
client.lines.list()
client.lines.get(lineId)
client.lines.delete(lineId)
client.calls.create({ lineId, toNumber })
client.calls.list({ lineId?, status?, limit?, offset? })
client.calls.get(callId)
client.calls.hangup(callId)
client.consent.grant({ lineId, phoneNumber, consentType, source })
client.consent.check({ phoneNumber, lineId? })
client.consent.revoke({ phoneNumber, lineId? })
client.compliance.audit({ lineId?, phoneNumber?, eventType?, from?, to?, limit?, offset? })
client.disclosures.create({ message, language? })
client.disclosures.list()
client.billing.balance()
Note: The billing balance endpoint is not yet available (ships in Phase 5). Calling
billing.balance()will throw aNotFoundErroruntil then.
SMS is inbound only for MVP. Your line receives incoming text messages and your webhook gets sms_received events. Outbound SMS coming soon.
GET and DELETE requests automatically retry once on 5xx errors and network failures, with a 1-second delay. POST/PUT/PATCH requests are never retried to prevent duplicate side effects.
All API errors are mapped to typed exceptions:
import { Saperly, ConsentRequiredError } from "@saperly/sdk";
const client = new Saperly({ apiKey: "sk_live_..." });
try {
await client.calls.create({ lineId: "...", toNumber: "+14155551234" });
} catch (err) {
if (err instanceof ConsentRequiredError) {
// Grant consent first, then retry
await client.consent.grant({
lineId: "...",
phoneNumber: "+14155551234",
consentType: "explicit_outbound",
source: "api",
});
}
}
Error classes: ValidationError, AuthenticationError, ForbiddenError, NotFoundError, ConsentRequiredError, ConsentAlreadyGrantedError, CallInProgressError, CallNotActiveError, InsufficientCreditsError, NumberOptedOutError, EmailTakenError.
Create an account without an existing API key:
import { Saperly } from "@saperly/sdk";
const { user } = await Saperly.register({
email: "agent@mycompany.com",
password: "secure-password",
name: "My Agent",
});
const client = new Saperly({
apiKey: "sk_live_...",
baseUrl: "http://localhost:3000", // optional, for local dev
});
MIT
FAQs
Typed TypeScript client for the Saperly API. The phone carrier for AI agents.
We found that @saperly/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.