SDK resources
Look up every resource, method, parameter, and return type in the TypeScript SDK.
The client has seven resources: workspaces, accounts, socialSets, publications, media, jobs, and inbox. Every method returns a promise. Types are exported from @getopenpost/sdk. A Publication is a post and a Rendition is its version for one account.
workspaces
| Method | Purpose | Returns |
|---|---|---|
list() | Workspaces the token can open | Promise<Workspace[]> |
create(name) | Create a workspace | Promise<Workspace> |
const [workspace] = await openpost.workspaces.list();accounts
| Method | Purpose | Returns |
|---|---|---|
list(workspaceId) | Connected social accounts | SocialAccount[] |
lookupMentions(accountId, query) | Search people or companies to mention | MentionLookup |
providers() | Networks available on the instance | ProviderInfo[] |
readiness(workspaceId) | Setup state and blockers for each network | ProviderReadiness[] |
destinationOptions(accountId, query) | Per-account settings choices, such as regions | DestinationOptionGroups |
destinationOptions takes an optional { region_code, language }. Read it before you write provider-specific settings.
socialSets
| Method | Purpose | Returns |
|---|---|---|
list(workspaceId) | Social Sets in a workspace | SocialSet[] |
get(id) | One Social Set | SocialSet |
resolveSettings(input) | Expand a Social Set into account-level defaults | unknown |
resolveSettings does not rewrite existing posts. Copy its result into the renditions you send.
publications
| Method | Purpose | Returns |
|---|---|---|
list(query) | Filter by status, platform, content_profile, calendar range, limit, offset | Publication[] |
get(id) | One post with its renditions | Publication |
create(input) | Create a draft. It never publishes | Publication |
update(id, input) | Edit text, schedule, or segments | Publication |
upsertRenditions(id, expectedRevision, renditions) | Replace the saved destination set | Publication |
validate(id, { throwOnInvalid }) | Check the saved post against each network | PublicationValidation |
schedule(id, expectedRevision) | Queue at the saved scheduled_at | PublicationAction |
publishNow(id, expectedRevision) | Queue immediate publishing | PublicationAction |
cancel(id, expectedRevision) | Cancel a scheduled post | PublicationAction |
remove(id, expectedRevision) | Permanently delete an editable post | PublicationAction |
retryFailed(id) | Retry failed renditions only | PublicationAction |
retryRendition(id, accountId, targetKey?) | Retry one failed destination | PublicationAction |
deleteRendition(id, accountId, expectedRevision, targetKey?) | Permanently delete one saved destination | PublicationAction |
events(id, limit?) | Ordered lifecycle history | PublicationEvent[] |
wait(id, options) | Poll until the post is published or failed | Publication |
All of these return a promise. PublicationAction carries message, and job_id and revision when present. wait options are timeoutMs (default 120 000) and intervalMs (default 3 000); it throws a timeout error when the time runs out.
const draft = await openpost.publications.create({
workspace_id: openpost.workspaceId(),
title: "Launch day",
content_profile: "short_text",
source_text: "We just shipped the new import flow.",
social_account_ids: ["ACCOUNT_ID"],
});
await openpost.publications.validate(draft.id, { throwOnInvalid: true });
const action = await openpost.publications.publishNow(draft.id, draft.revision);Replace ACCOUNT_ID with an ID from accounts.list(). A content_profile is one of short_text, thread, link_share, image_post, carousel, story, short_video, or long_video. See Create and publish posts for media, mentions, and per-account versions.
media
| Method | Purpose | Returns |
|---|---|---|
list(workspaceId, limit?) | Library items and a total | MediaPage |
upload(input) | Upload bytes in one call and return the media record | MediaUploadResult |
prepareImage(id, input) | Make a separate copy fitted to one account's format | PreparedMediaImage |
usage(id) | Where an item is used | unknown |
remove(id) | Delete an unused item | void |
upload takes workspaceId, file (Uint8Array, ArrayBuffer, or Blob), filename, and mimeType. Optional fields include altText, retentionClass (library or temporary), and clientSha256. When OpenPost already has identical media, the result has deduped: true and no bytes are sent.
prepareImage takes account_id and output_profile, and optionally settings and alt_text. Attach the returned media.id yourself.
jobs
| Method | Purpose | Returns |
|---|---|---|
list(query) | Filter by status, limit, offset, workspace_id | Job[] |
get(id) | One job | Job |
wait(id, options) | Poll until the job completes. Throws operation_failed if it fails | Job |
A Job has status of pending, processing, completed, or failed, plus attempts and last_error. wait uses the same options as publications.wait.
inbox
| Method | Purpose | Returns |
|---|---|---|
list(query) | Saved comments, mentions, and reviews. Follow next_cursor | EngagementPage |
get(workspaceId, itemId) | One item with its context | EngagementDetail |
refresh(workspaceId) | Queue collection from the networks | RefreshCapabilityOutcome |
setState(input) | Mark items read or archived | void |
markRead(filters) | Mark every matching unread item read across all pages | { updated_count } |
act(itemId, input) | Queue a reply or moderation action | { job_id } |
list filters by kind (comment, mention, or review), platform, account_id, publication_id, archived, and unread_only. act needs a client_operation_id. Reuse it only to retry the same action. See the Inbox guide.
Helpers and errors
| Export | Purpose |
|---|---|
openpost.workspaceId(override?) | The default workspace ID, or a missing_config error |
OpenPostError | Error with code, status, retryAfterMs, retryable, disposition |
describeRendition, summarizePublication | Turn renditions into published, failed, or unknown outcomes |
iterateOffsetPages | Walk an offset-paged list with page and item limits |
@getopenpost/sdk/testing | MockOpenPost with scripted outcomes for tests |