Concrete example
Schedule one X post from Node.js and read it back
This is the full first job: resolve the channel, save a complete payload with an Idempotency-Key, create the post, then read the returned ID. Swap the settings block for another provider's fields from the API reference. The same sequence works with the typed @postsider/node client in TypeScript.
Check the current posts reference →
// Option A: plain fetch. Option B (below): the typed @postsider/node client.
import { randomUUID } from 'node:crypto';
const BASE = 'https://api.postsider.com/public/v1';
const headers = {
Authorization: process.env.POSTSIDER_API_KEY, // raw key, no "Bearer"
'Content-Type': 'application/json',
};
// 1. Resolve the channel ID instead of guessing it.
const channels = await (await fetch(`${BASE}/integrations`, { headers })).json();
const x = channels.find((c) => c.identifier === 'x' && !c.disabled);
if (!x) throw new Error('No enabled X channel');
// 2. Build the request once, keep it, and give it a stable key.
const payload = {
type: 'schedule', // draft | schedule | now
date: '2026-11-16T14:00:00.000Z', // future UTC ISO timestamp
shortLink: false,
tags: [],
posts: [{
integration: { id: x.id },
value: [{ content: 'Release 2.4 is out. Changelog in the first comment.', image: [] }],
settings: { __type: 'x', who_can_reply_post: 'everyone' },
}],
};
const idempotencyKey = randomUUID(); // reuse it on a timeout retry
// 3. Create, then read the exact post back. A 2xx is not publication.
const created = await fetch(`${BASE}/posts`, {
method: 'POST',
headers: { ...headers, 'Idempotency-Key': idempotencyKey },
body: JSON.stringify(payload),
});
if (!created.ok) throw new Error(`PostSider API returned ${created.status}`);
const [{ postId }] = await created.json();
const post = await (await fetch(`${BASE}/posts/${postId}`, { headers })).json();
console.log(post.posts[0].state, post.posts[0].publishDate); // QUEUE = scheduled, not published
// Option B: same calls through the SDK (TypeScript types included).
// import Postsider from '@postsider/node';
// const postsider = new Postsider(process.env.POSTSIDER_API_KEY!);
// const channels = await postsider.integrations();