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

MethodRouteWhat it does
posts.create(params)POST /postsCreate 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 /postsList 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}/publishPublish now, or retry failed channels. Live channels are skipped.
posts.revise(postId, params)POST /posts/{id}/reviseChange the text of a live post, where the platform allows it.
posts.retract(postId)POST /posts/{id}/retractDelete the live posts on the networks. Read remaining.
posts.metrics(postId)GET /posts/{id}/metricsLikes, 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

MethodRouteWhat it does
posts.comments.list(postId, { channelId }) 📄GET /posts/{id}/commentsComments on one channel's copy of a live post.
posts.comments.reply(postId, commentId, params)POST /posts/{id}/comments/{commentId}/repliesReply 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

MethodRouteWhat it does
channels.list()GET /channelsYour connected accounts. Use their id in posts.
channels.capabilities(channelId)GET /channels/{id}/capabilitiesRules for this account, read live from the platform.
channels.optionChoices(channelId, key, { q?, value? })GET /channels/{id}/options/{key}/choicesSearch the values of an option, like Instagram's location_id.
platforms.list()GET /platformsEach platform's limits: characters, media, thread length.
tags.list()GET /tagsYour workspace's tags. Use their id in tagIds.

Read limits from platforms.list() instead of hard-coding them — they change.

Media

MethodRouteWhat it does
media.upload(file, { fileName?, mimeType? })POST /mediaUpload 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 /mediaYour 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:

MethodRouteWhat it does
media.uploads.start({ fileName, mimeType, size })POST /media/uploadsOpen a session. Returns id, partCount and partSize.
media.uploads.signParts(uploadId, { partNumbers })POST /media/uploads/{id}/partsSigned PUT URLs for up to 100 parts. Valid for one hour.
media.uploads.complete(uploadId)POST /media/uploads/{id}/completeFinish. Returns the media item.
media.uploads.abort(uploadId)DELETE /media/uploads/{id}Cancel the session.

Stats and usage

MethodRouteWhat it does
stats.retrieve({ from, to, timezone? })GET /statsAnalytics for a period, counted from your posts.
stats.insights({ from, to, platform?, channel? })GET /stats/insightsWhen, where and in what format your posts do best.
usage.retrieve()GET /usageYour plan's usage for this period.

Use usage.retrieve() — not stats — to know if you are about to hit a QuotaExceededError.

Webhooks

MethodRouteWhat it does
webhooks.create({ url, events, description? })POST /webhooksAdd an endpoint. Save the secret — it is only returned here.
webhooks.list()GET /webhooksYour 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}/deliveriesEvery delivery attempt, newest first.
webhooks.rollSecret(webhookId)POST /webhooks/{id}/roll-secretNew secret. The old one stops working right away.
webhooks.test(webhookId)POST /webhooks/{id}/testSend 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.

ExportWhat 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".
VERSIONThe installed SDK version.

Client properties

PropertyWhat it is
isTestModetrue for a bk_test_… key.
baseURLThe API address this client uses.
timeoutThe default timeout, in milliseconds.
maxRetriesThe 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().

On this page