Skip to content
OpenPostDocs
OpenPostDocs

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

MethodPurposeReturns
list()Workspaces the token can openPromise<Workspace[]>
create(name)Create a workspacePromise<Workspace>
const [workspace] = await openpost.workspaces.list();

accounts

MethodPurposeReturns
list(workspaceId)Connected social accountsSocialAccount[]
lookupMentions(accountId, query)Search people or companies to mentionMentionLookup
providers()Networks available on the instanceProviderInfo[]
readiness(workspaceId)Setup state and blockers for each networkProviderReadiness[]
destinationOptions(accountId, query)Per-account settings choices, such as regionsDestinationOptionGroups

destinationOptions takes an optional { region_code, language }. Read it before you write provider-specific settings.

socialSets

MethodPurposeReturns
list(workspaceId)Social Sets in a workspaceSocialSet[]
get(id)One Social SetSocialSet
resolveSettings(input)Expand a Social Set into account-level defaultsunknown

resolveSettings does not rewrite existing posts. Copy its result into the renditions you send.

publications

MethodPurposeReturns
list(query)Filter by status, platform, content_profile, calendar range, limit, offsetPublication[]
get(id)One post with its renditionsPublication
create(input)Create a draft. It never publishesPublication
update(id, input)Edit text, schedule, or segmentsPublication
upsertRenditions(id, expectedRevision, renditions)Replace the saved destination setPublication
validate(id, { throwOnInvalid })Check the saved post against each networkPublicationValidation
schedule(id, expectedRevision)Queue at the saved scheduled_atPublicationAction
publishNow(id, expectedRevision)Queue immediate publishingPublicationAction
cancel(id, expectedRevision)Cancel a scheduled postPublicationAction
remove(id, expectedRevision)Permanently delete an editable postPublicationAction
retryFailed(id)Retry failed renditions onlyPublicationAction
retryRendition(id, accountId, targetKey?)Retry one failed destinationPublicationAction
deleteRendition(id, accountId, expectedRevision, targetKey?)Permanently delete one saved destinationPublicationAction
events(id, limit?)Ordered lifecycle historyPublicationEvent[]
wait(id, options)Poll until the post is published or failedPublication

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

MethodPurposeReturns
list(workspaceId, limit?)Library items and a totalMediaPage
upload(input)Upload bytes in one call and return the media recordMediaUploadResult
prepareImage(id, input)Make a separate copy fitted to one account's formatPreparedMediaImage
usage(id)Where an item is usedunknown
remove(id)Delete an unused itemvoid

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

MethodPurposeReturns
list(query)Filter by status, limit, offset, workspace_idJob[]
get(id)One jobJob
wait(id, options)Poll until the job completes. Throws operation_failed if it failsJob

A Job has status of pending, processing, completed, or failed, plus attempts and last_error. wait uses the same options as publications.wait.

inbox

MethodPurposeReturns
list(query)Saved comments, mentions, and reviews. Follow next_cursorEngagementPage
get(workspaceId, itemId)One item with its contextEngagementDetail
refresh(workspaceId)Queue collection from the networksRefreshCapabilityOutcome
setState(input)Mark items read or archivedvoid
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

ExportPurpose
openpost.workspaceId(override?)The default workspace ID, or a missing_config error
OpenPostErrorError with code, status, retryAfterMs, retryable, disposition
describeRendition, summarizePublicationTurn renditions into published, failed, or unknown outcomes
iterateOffsetPagesWalk an offset-paged list with page and item limits
@getopenpost/sdk/testingMockOpenPost with scripted outcomes for tests

On this page