TypeScript SDK
@adeli/sdk is Adeli's server-side TypeScript SDK, published on npm. It runs on Node.js 22 or later, Vercel functions, and Cloudflare Workers, and throws in browsers. Keep your API key in server configuration and never expose it in a browser bundle.
The client uses https://app.tryadeli.com as its origin by default. Resource calls take explicit { path, query, body } input and return { data, status, headers }; Adeli does not rewrite provider-specific fields or hide 202/207 outcomes.
Install
Install version 0.2.1 or later:
npm install @adeli/sdkMake your first call
getMe() is read-only and works before you connect anything: it says who the key belongs to and lists what is connected. Create a key in Settings → API keys, or copy the one on the dashboard's Quick Start page, then:
import { Adeli } from "@adeli/sdk";
// Or omit apiKey and set ADELI_API_KEY in the environment.
const adeli = new Adeli({ apiKey: "rk_live_replace_on_server" });
export async function sayHello() {
const { data } = await adeli.getMe();
return data.message;
}See GET /api/v1/me for the full response.
Profiles and resources
import { Adeli } from "@adeli/sdk";
const adeli = new Adeli({ apiKey: "rk_live_replace_on_server" });
export async function listProfiles() {
const response = await adeli.profiles.listProfiles();
return response.data;
}The same client exposes operation-oriented resources such as profiles, accounts, posts, comments, messages, analytics, ads, and usage. A base URL is an origin, not an /api/v1 path:
import { Adeli } from "@adeli/sdk";
const adeli = new Adeli({
apiKey: "rk_live_replace_on_server",
baseURL: "http://localhost:3000",
});
export async function getProfile(profileId: string) {
return adeli.profiles.getProfile({ path: { profileId } });
}Connection and publishing results
Starting a connection returns an authorization URL. Send that URL to the customer's browser; the API key remains on your server. A publishing request can return accepted or partial results, so inspect the returned status and data rather than automatically retrying a write.
import { Adeli } from "@adeli/sdk";
const adeli = new Adeli({ apiKey: "rk_live_replace_on_server" });
export async function startInstagramConnection(profileId: string) {
const { data } = await adeli.profiles.startConnection({
path: { profileId },
body: {
platform: "instagram",
redirectUrl: "https://client.example/adeli/callback",
},
});
return data.authUrl;
}Runtimes
The root @adeli/sdk entry needs only fetch and loads no Node built-in when imported. It runs on Node.js 22 or later, Vercel functions, and Cloudflare Workers. The two subpaths need more:
| Import | Contents | Runs on |
|---|---|---|
@adeli/sdk | The Adeli client, types, and error classes | Node.js 22+, Vercel functions, Cloudflare Workers |
@adeli/sdk/helpers | Polling, comment iterators, and webhook verification | The same. verifyWebhookSignature uses node:crypto, which Workers provide only with nodejs_compat |
@adeli/sdk/uploads | fileFromPath and blobFromPath | Node.js only |
On Cloudflare Workers without nodejs_compat, pass apiKey explicitly, because the client can't read ADELI_API_KEY there. On Vercel, serve webhook routes from the default Node.js runtime rather than runtime = "edge". Outside Node.js, you can still pass any Blob or File as post media.
Use the API reference for the wire contract behind every SDK call; the curl, JavaScript, and Python samples in the quickstart work alongside the SDK. See SDK migration notes for compatibility announcements.