Integrations › Node.js
Zapi for Node.js
Call any source from Node.js with zpi-sdk or plain fetch: one key, one id per endpoint, JSON back.
- 01Install zpi-sdk
The official SDK. It has no runtime dependencies.
npm i zpi-sdk - 02Set your API key
Create a free key in the dashboard. zpi-sdk reads ZPI_API_KEY from the environment, so the key stays out of your code.
export ZPI_API_KEY="zpi_..."
- 03Call any source
run() takes one id per endpoint, category:source/endpoint, plus its inputs, and returns the data field. Save it as an .mjs file.
import { Zpi } from "zpi-sdk"; // Reads ZPI_API_KEY from the environment const zpi = new Zpi(); const profile = await zpi.run("social-media:tiktok-scraper/profile", { username: "tiktok", }); console.log(profile.followerCount);
- 04Or use plain fetch
No package needed: fetch is built into Node.js. Every source is a GET on /v1/<category>:<source>/<endpoint>.
const url = new URL("https://api.zapi.ink/v1/social-media:tiktok-scraper/profile"); url.searchParams.set("username", "tiktok"); const res = await fetch(url, { headers: { "x-api-key": process.env.ZPI_API_KEY }, }); // 429 means the per-minute limit was hit: wait, then retry if (!res.ok) throw new Error("Zapi returned " + res.status); const { data } = await res.json(); console.log(data.followerCount);
The response
200 OK{
"project": "social-media:tiktok-scraper:profile",
"data": {
"username": "tiktok",
"nickname": "TikTok",
"verified": true,
"followerCount": 92400000,
"videoCount": 1310
},
"timestamp": "2026-12-01T07:00:00.000Z"
}Questions
Should I use zpi-sdk or fetch?
Either works. zpi-sdk adds typed errors, retries on gateway errors and short rate-limit waits, bulk jobs and the catalogue. fetch needs nothing installed.
Where does zpi-sdk run?
Node.js 20 or newer, Bun, Deno and edge runtimes. In the browser, put it behind your own proxy so the key stays on a server.
What happens when I hit the rate limit?
The API answers 429. When it asks for a wait of 10 seconds or less, zpi-sdk waits and retries, up to twice by default. A longer wait throws ZpiRateLimitError at once, with retryAfter set, so you decide.
Your first call in a minute.
Free key, every source, and the same JSON shape from anywhere.