SDK reference
Every method in the Node.js SDK, and the API route it calls.
Every method takes an optional last argument for per-request options. Request bodies and responses are the same as the API's — see All endpoints.
📄 = returns a page you can await or loop over with for await. See
Lists and pages.
Posts
| Method | Route | What it does |
|---|---|---|
posts.create(params) | POST /posts | Create a draft, scheduled or instant post, for one or more channels. |
posts.retrieve(postId) | GET /posts/{id} | Get one post and the result on each channel. |
posts.list(params?) 📄 | GET /posts | List posts, newest first. Filter by status, tag, from, to. |
posts.update(postId, params) | PUT /posts/{id} | Replace a post that is not published yet. |
posts.delete(postId) | DELETE /posts/{id} | Delete from Bulkit only. Live posts stay live. |
posts.publish(postId) | POST /posts/{id}/publish | Publish now, or retry failed channels. Live channels are skipped. |
posts.revise(postId, params) | POST /posts/{id}/revise | Change the text of a live post, where the platform allows it. |
posts.retract(postId) | POST /posts/{id}/retract | Delete the live posts on the networks. Read remaining. |
posts.metrics(postId) | GET /posts/{id}/metrics | Likes, views and more, over time. |
// Change the wording of a live post (the number of blocks must stay the same).
const result = await bulkit.posts.revise(post.id, {
channels: [{ channelId: "chn_x", blocks: [{ content: "Shipping today. (fixed typo)" }] }],
});
console.log(result.revised, result.unchanged);
// Take it down from the networks — permanent.
const { removed, remaining } = await bulkit.posts.retract(post.id);
if (remaining.length) console.warn("Still live on:", remaining);See Manage posts for when to use each one.
Comments
| Method | Route | What it does |
|---|---|---|
posts.comments.list(postId, { channelId }) 📄 | GET /posts/{id}/comments | Comments on one channel's copy of a live post. |
posts.comments.reply(postId, commentId, params) | POST /posts/{id}/comments/{commentId}/replies | Reply in public. Counts as one post. |
for await (const comment of bulkit.posts.comments.list(post.id, { channelId: "chn_x" })) {
console.log(comment);
}
await bulkit.posts.comments.reply(post.id, commentId, {
channelId: "chn_x",
text: "Thanks!",
});See Read and reply to comments.
Channels, platforms and tags
| Method | Route | What it does |
|---|---|---|
channels.list() | GET /channels | Your connected accounts. Use their id in posts. |
channels.capabilities(channelId) | GET /channels/{id}/capabilities | Rules for this account, read live from the platform. |
channels.optionChoices(channelId, key, { q?, value? }) | GET /channels/{id}/options/{key}/choices | Search the values of an option, like Instagram's location_id. |
platforms.list() | GET /platforms | Each platform's limits: characters, media, thread length. |
tags.list() | GET /tags | Your workspace's tags. Use their id in tagIds. |
Read limits from platforms.list() instead of hard-coding them — they
change.
Media
| Method | Route | What it does |
|---|---|---|
media.upload(file, { fileName?, mimeType? }) | POST /media | Upload a file in one request (up to 100 MB). |
media.uploadMultipart(file, { fileName?, mimeType?, concurrency? }) | /media/uploads/… | Upload a large video in parts. Does every step below for you. |
media.list() | GET /media | Your media library. |
media.delete(mediaId) | DELETE /media/{id} | Delete a file from the library. |
The low-level upload session calls, if you want to drive it yourself:
| Method | Route | What it does |
|---|---|---|
media.uploads.start({ fileName, mimeType, size }) | POST /media/uploads | Open a session. Returns id, partCount and partSize. |
media.uploads.signParts(uploadId, { partNumbers }) | POST /media/uploads/{id}/parts | Signed PUT URLs for up to 100 parts. Valid for one hour. |
media.uploads.complete(uploadId) | POST /media/uploads/{id}/complete | Finish. Returns the media item. |
media.uploads.abort(uploadId) | DELETE /media/uploads/{id} | Cancel the session. |
Stats and usage
| Method | Route | What it does |
|---|---|---|
stats.retrieve({ from, to, timezone? }) | GET /stats | Analytics for a period, counted from your posts. |
stats.insights({ from, to, platform?, channel? }) | GET /stats/insights | When, where and in what format your posts do best. |
usage.retrieve() | GET /usage | Your plan's usage for this period. |
Use usage.retrieve() — not stats — to know if you are about to hit a
QuotaExceededError.
Webhooks
| Method | Route | What it does |
|---|---|---|
webhooks.create({ url, events, description? }) | POST /webhooks | Add an endpoint. Save the secret — it is only returned here. |
webhooks.list() | GET /webhooks | Your endpoints, including disabled ones. |
webhooks.retrieve(webhookId) | GET /webhooks/{id} | Get one endpoint. |
webhooks.update(webhookId, params) | PUT /webhooks/{id} | Change it. enabled: true turns it back on. |
webhooks.delete(webhookId) | DELETE /webhooks/{id} | Delete it, with its delivery history. |
webhooks.deliveries(webhookId, params?) 📄 | GET /webhooks/{id}/deliveries | Every delivery attempt, newest first. |
webhooks.rollSecret(webhookId) | POST /webhooks/{id}/roll-secret | New secret. The old one stops working right away. |
webhooks.test(webhookId) | POST /webhooks/{id}/test | Send a signed webhook.test event now. Works with test keys. |
webhooks.unwrap(payload, headers, { secret }) | — | Same as verifyWebhook(). |
Standalone exports
These need no client and no API key.
| Export | What it does |
|---|---|
verifyWebhook(payload, headers, { secret, toleranceSeconds? }) | Check a delivery's signature and return the typed event. Throws WebhookVerificationError. |
signWebhookPayload(payload, secret, timestamp?) | Build an x-bulkit-signature value. Useful in tests. |
SIGNATURE_HEADER | "x-bulkit-signature". |
VERSION | The installed SDK version. |
Client properties
| Property | What it is |
|---|---|
isTestMode | true for a bk_test_… key. |
baseURL | The API address this client uses. |
timeout | The default timeout, in milliseconds. |
maxRetries | The default number of retries. |
Calling a route directly
If a route has no method yet, use the low-level helpers. They keep the
retries, idempotency keys and errors. Paths start after /public/v1:
const channels = await bulkit.get("/channels");
const post = await bulkit.post("/posts", params, { idempotencyKey: "my-key" });bulkit.get, bulkit.post, bulkit.put and bulkit.delete all return a
promise you can use with .withResponse().