On this page

Quickstart

Send your first post with four calls: check your key, connect an account, send the post, and read its receipt.

Before you start

  • An API key. It starts with ps_live_. Get yours in the web app, under Developers → API keys.
  • A Bluesky account, and an app password for it. Bluesky connects in one call, with no sign-in page, so it is the quickest account to try.
  • curl, Node.js 20 or later, or Python 3 with requests.

Run it

The Node.js and Python samples build on each other: put them in one file, in order. The curl samples need the ids from the answers before them.

  1. 1Check your key

    Put your key in an environment variable, so it stays out of your code:

    Terminal

    export POSTSURE_KEY="ps_live_..."

    Then list your accounts. Every call sends the key in the Authorization header.

    curl https://api.postsure.dev/v1/accounts \  -H "Authorization: Bearer $POSTSURE_KEY"

    Example response200

    {  "data": []}

    A new workspace has no accounts yet. A wrong key gets 401 with invalid_api_key.

  2. 2Connect an account

    In Bluesky, make an app password: Settings, Privacy and security, App passwords. Send it with the account's handle. Use your own handle and app password in place of the ones below.

    curl https://api.postsure.dev/v1/connect/bluesky \  -H "Authorization: Bearer $POSTSURE_KEY" \  -H "Content-Type: application/json" \  -d '{"handle": "postsure-demo.bsky.social", "app_password": "abcd-efgh-ijkl-mnop"}'

    Example response200

    {  "id": "cmhb1s7kq0001l808d6v3m9tw",  "network": "bluesky",  "provider_user_id": "did:plc:postsuredemo2345abcdefgh",  "username": "postsure-demo.bsky.social",  "display_name": "Postsure Demo",  "status": "active"}

    Keep the id. You send posts to accounts by their id. Postsure keeps the app password encrypted and never sends it back.

    Most other networks connect through a sign-in page. For example, POST /v1/connect/x answers with a url. Your user opens it and logs in to X. Connect accounts shows how each network connects.

  3. 3Send the post

    Send the account id and the text. If the call fails or times out, send it again with the same Idempotency-Key: you get back the post Postsure already saved, not a second one.

    curl https://api.postsure.dev/v1/posts \  -H "Authorization: Bearer $POSTSURE_KEY" \  -H "Content-Type: application/json" \  -H "Idempotency-Key: $(uuidgen)" \  -d '{"account_ids": ["<account id>"], "text": "Hello from Postsure!"}'

    Example response202

    {  "id": "cmgwb1n6e000bl808v5j0k8ry",  "status": "queued",  "text": "Hello from Postsure!",  "targets": [    {      "account_id": "cmhb1s7kq0001l808d6v3m9tw",      "account": {        "network": "bluesky",        "username": "postsure-demo.bsky.social"      },      "status": "queued",      "url": null    }  ]}

    202 means the post is saved and in the queue. Postsure posts it in the background, so the answer comes at once.

  4. 4Read the receipt

    Get the post by its id. The Node.js and Python samples ask again every 2 seconds until it is done.

    curl https://api.postsure.dev/v1/posts/<post id> \  -H "Authorization: Bearer $POSTSURE_KEY"

    Example response200

    {  "id": "cmgwb1n6e000bl808v5j0k8ry",  "status": "published",  "text": "Hello from Postsure!",  "targets": [    {      "account_id": "cmhb1s7kq0001l808d6v3m9tw",      "account": {        "network": "bluesky",        "username": "postsure-demo.bsky.social"      },      "status": "published",      "url": "https://bsky.app/profile/did:plc:postsuredemo2345abcdefgh/post/3m5kq2xa7ty2c",      "error_category": null,      "error_reason": null,      "published_at": "2026-11-15T12:00:01.204Z",      "attempts": [        {          "number": 1,          "outcome": "success"        }      ]    }  ]}

    Each account in the post has one target. It has its own status, the live link in url, and every try in attempts. In your app, use a webhook instead of asking again and again.

What just happened

If it fails

When a network says no, the target says why in plain English, in error_reason. error_category names the kind of error, so your code can decide what to do. This post failed on Bluesky:

curl

curl https://api.postsure.dev/v1/posts/<post id> \  -H "Authorization: Bearer $POSTSURE_KEY"

Example response200

{  "id": "cmgwb1n6e000bl808v5j0k8ry",  "status": "failed",  "targets": [    {      "account": {        "network": "bluesky",        "username": "postsure-demo.bsky.social"      },      "status": "failed",      "url": null,      "error_category": "auth",      "error_reason": "Bluesky did not accept the handle or the app password. Reconnect the account with a new app password.",      "retry_at": null    }  ]}

Each target ends in one of these four states. Receipts and retries has every status and error category.

published
The post is live on that account. Nothing to do. You get post.published.
waiting
A try failed for a reason that can pass, like a rate limit or the network being down. Wait. You get post.waiting with the reason.
failed
The network refused the post, or Postsure stopped trying. The reason says which. Fix what the reason names, then send it again.
unconfirmed
Postsure sent the post and the network did not answer. It may be live. Check the account before you post again. You get post.unconfirmed.

A call Postsure turns down at once, such as one with a wrong key, answers with a 4xx status and at least two fields: error, a code for your program, and message, what to do. Here is a Bluesky main password sent in place of an app password. Postsure turns it down before anything goes to Bluesky:

curl

curl https://api.postsure.dev/v1/connect/bluesky \  -H "Authorization: Bearer $POSTSURE_KEY" \  -H "Content-Type: application/json" \  -d '{"handle": "postsure-demo.bsky.social", "app_password": "my main password"}'

Example response400

{  "error": "app_password_required",  "message": "This is not an app password. Postsure never takes your main Bluesky password. Make an app password in Bluesky (Settings, Privacy and security, App passwords) and use it here. An app password looks like xxxx-xxxx-xxxx-xxxx."}

Next steps

Webhooks
Add your URL with POST /v1/webhooks. Postsure sends a signed event when a post is done, and when it starts waiting.
Images and video
Upload them with POST /v1/media, then send their ids in media_ids.
Threads
Send thread, with 2 to 25 parts, instead of text.
Scheduled posts
Send publish_at with a time up to 365 days ahead.
Other networks
Each network connects in its own way: with one call, a sign-in page, or a bot.
AI tools
Postsure is also an MCP server, at /mcp. It takes the same API key.

Every call, field and error is in the API reference.