Tesselith
ProductSolutionsAI agentsCompareFree toolsBlogPricing
Log inStart free
  1. Home/
  2. Blog/
  3. Posting to Bluesky via the AT Protocol API: createRecord, Facets, Images, Video and Threads

Developers

Posting to Bluesky via the AT Protocol API: createRecord, Facets, Images, Video and Threads

November 27, 2026 · 8 min read

Post to Bluesky through the AT Protocol in 2026: sessions, createRecord, link and mention facets with byte offsets, image and video uploads, threads and rate limits.

To post to Bluesky via the API, log in with `com.atproto.server.createSession` to get an access token and your DID, then call `com.atproto.repo.createRecord` on your PDS with `collection: "app.bsky.feed.post"` and a record containing `text` and `createdAt`. Text is capped at 300 graphemes. Links and mentions aren't detected from the text: you mark them with facets whose positions are UTF-8 byte offsets. Images are uploaded first with uploadBlob and embedded, up to four per post. Replies need strong references (URI plus CID) to both the thread root and the direct parent.

Key takeaways

  • createSession is limited to 30 calls per 5 minutes and 300 per day per account. Log in once and refresh, never per post.
  • Facet indices are UTF-8 byte offsets, not JavaScript string indices. Emoji before a link will break naive code.
  • Images: up to 4 per post, uploaded as blobs. Keep each under 1,000,000 bytes.
  • Video goes through Bluesky's video service, and the account must have a verified email.
  • Write limits: 5,000 points an hour and 35,000 a day, with a post costing 3 points.

Authentication: app passwords, OAuth and sessions

For a bot or a script that posts to your own account, an app password is the simple path: create one in Bluesky under Settings, Privacy and security, App passwords, and use it with createSession. It can be revoked without touching your real password. For an app that other people sign into, Bluesky supports OAuth, and that's the better choice for anything public, since users never hand you a password at all.

curl -X POST "https://bsky.social/xrpc/com.atproto.server.createSession" \
  -H "Content-Type: application/json" \
  -d '{"identifier": "bakery.example.com", "password": "'"$APP_PASSWORD"'"}'

# {"did": "did:plc:abc123...", "handle": "bakery.example.com",
#  "accessJwt": "eyJ...", "refreshJwt": "eyJ...", "didDoc": {...}}

Store accessJwt, refreshJwt and the DID. The access token is short-lived. When it expires, call com.atproto.server.refreshSession with the refresh token as the bearer, and save both new tokens it returns. The reason to do it this way is the rate limit: createSession allows 30 calls per 5 minutes and 300 per day per account. A scheduler that logs in before every post works in testing and locks itself out the first busy morning.

bsky.social is the entryway for Bluesky-hosted accounts, but the account's actual data lives on a PDS. For self-hosted accounts, or to be correct for everyone, read the PDS URL from the DID document returned with the session (the service entry ending in #atproto_pds) and send repo calls there.

A plain text post

curl -X POST "https://bsky.social/xrpc/com.atproto.repo.createRecord" \
  -H "Authorization: Bearer $ACCESS_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "repo": "did:plc:abc123",
    "collection": "app.bsky.feed.post",
    "record": {
      "$type": "app.bsky.feed.post",
      "text": "Focaccia is out. Rosemary and sea salt today.",
      "createdAt": "2026-11-27T07:00:00.000Z",
      "langs": ["en"]
    }
  }'

# {"uri": "at://did:plc:abc123/app.bsky.feed.post/3lbxyz...", "cid": "bafyrei..."}

Keep both uri and cid. The URI is the stable id. The CID is a hash of this exact version of the record, and you need it to reply to the post later. Set createdAt to the actual publish time, not the time the post was drafted. Set langs, because custom feeds filter by language.

Facets: why your links aren't clickable

Bluesky doesn't auto-link. A URL in text is plain text unless a facet marks it. A facet says "bytes X to Y of the text are a link to Z." The positions are UTF-8 byte offsets, and that's where most implementations break. JavaScript's indexOf returns UTF-16 code-unit positions. Put one emoji before a link and the byte offset and the string index disagree, so the wrong characters get linked.

const enc = new TextEncoder()

export function linkFacets(text: string) {
  const facets = []
  for (const m of text.matchAll(/https?:\/\/[^\s]+/g)) {
    const url = m[0].replace(/[.,;:!?)\]]+$/, "") // drop trailing punctuation
    const byteStart = enc.encode(text.slice(0, m.index)).byteLength
    const byteEnd = byteStart + enc.encode(url).byteLength
    facets.push({
      index: { byteStart, byteEnd },
      features: [{ $type: "app.bsky.richtext.facet#link", uri: url }],
    })
  }
  return facets
}

// "Fresh 🍞 menu: https://example.com/menu"
// string index of the URL = 15, byteStart = 17 (the emoji is 4 bytes, 2 UTF-16 units)

Mentions work the same way with app.bsky.richtext.facet#mention and a did instead of a uri, which means you have to resolve each @handle to a DID first (com.atproto.identity.resolveHandle). Hashtags use #tag facets. If you'd rather not write this yourself, the official @atproto/api package has a RichText class that detects all three and computes the offsets.

Length is measured differently again: the 300 limit is in graphemes, so a family emoji built from several code points counts as one. Count with Intl.Segmenter, not .length. Our Bluesky character counter counts graphemes the same way Bluesky does.

Link preview cards

A facet makes a link clickable. It doesn't make the preview card. The card is a separate app.bsky.embed.external embed with uri, title, description and an optional thumb blob, and you have to fetch the page's Open Graph tags and upload the image yourself. The Bluesky app does this client-side when you paste a link, which is why API posts often look plain by comparison. A post can carry one embed, so it's a card or images, not both.

Images

Upload each image's raw bytes to com.atproto.repo.uploadBlob with the right Content-Type. You get back a blob reference. Embed up to four with app.bsky.embed.images, each with alt text and, ideally, an aspectRatio so the app can lay it out before the image loads.

curl -X POST "https://bsky.social/xrpc/com.atproto.repo.uploadBlob" \
  -H "Authorization: Bearer $ACCESS_JWT" \
  -H "Content-Type: image/jpeg" \
  --data-binary @focaccia.jpg

# {"blob": {"$type": "blob", "ref": {"$link": "bafkrei..."}, "mimeType": "image/jpeg", "size": 412233}}

# Then, in the record:
#   "embed": {
#     "$type": "app.bsky.embed.images",
#     "images": [{
#       "alt": "Tray of rosemary focaccia with flaky salt",
#       "image": { ...the blob object exactly as returned... },
#       "aspectRatio": {"width": 1600, "height": 1200}
#     }]
#   }

Pass the blob object back exactly as you received it. Bluesky's post docs give the image limit as 1,000,000 bytes (one newer docs page says 2 MB). Resize to under 1 MB and you're safe under either. Uploaded blobs that no record references are garbage-collected after a while, so upload right before you post, not days ahead.

Video

You can upload a video with uploadBlob and embed it with app.bsky.embed.video, but Bluesky recommends against it: processing only starts when the post appears, so people see a broken video for a while. The recommended flow uses the video service:

  1. Get a service token with com.atproto.server.getServiceAuth, audience set to your PDS's DID, scope com.atproto.repo.uploadBlob, expiry around 30 minutes.
  2. Upload the file to https://video.bsky.app/xrpc/app.bsky.video.uploadVideo with that token.
  3. Poll app.bsky.video.getJobStatus until it returns a blob reference.
  4. Create the post with app.bsky.embed.video and that blob.

Two account-level rules: Bluesky-hosted accounts must have a verified email before uploading video (check with com.atproto.server.getSession), and there's a cap on video posts per day. Separately, the PDS rejects any single blob over 50 MB.

Threads and replies

A reply carries a reply object with two strong refs: root (the first post of the thread) and parent (the post you're directly replying to). For a thread you write yourself, post 1 is the root for everything, and each later post's parent is the one before it.

type Ref = { uri: string; cid: string }

export async function postThread(pds: string, did: string, jwt: string, parts: string[]) {
  let root: Ref | undefined
  let parent: Ref | undefined
  for (const text of parts) {
    const record: Record<string, unknown> = {
      $type: "app.bsky.feed.post",
      text,
      createdAt: new Date().toISOString(),
      langs: ["en"],
      facets: linkFacets(text),
    }
    if (root && parent) record.reply = { root, parent }
    const res = await fetch(pds + "/xrpc/com.atproto.repo.createRecord", {
      method: "POST",
      headers: { Authorization: "Bearer " + jwt, "Content-Type": "application/json" },
      body: JSON.stringify({ repo: did, collection: "app.bsky.feed.post", record }),
    })
    if (!res.ok) throw new Error("Bluesky " + res.status + ": " + (await res.text()))
    const ref: Ref = await res.json()
    root ??= ref
    parent = ref
  }
}

Setting parent to the root every time also works, but it produces a fan of replies under the first post rather than a readable thread. To reply to someone else's post, fetch it with app.bsky.feed.getPosts to get its CID, and copy its own reply.root if it's already part of a thread.

Rate limits

LimitValue (Bluesky docs, Nov 2026)
Record writes per account5,000 points/hour, 35,000 points/day
Cost per writeCreate 3, update 2, delete 1
Max postsAbout 1,666/hour, 11,666/day
createSession30 per 5 min, 300 per day, per account
All PDS requests3,000 per 5 min, per IP
Single blob upload50 MB

Posting volume will almost never hit the write limits. The ones that bite are createSession (log in once) and the per-IP limit if you run many accounts from one server. A 429 means wait. Read the rate-limit headers on the response and back off accordingly. Treat 401 as an expired access token: refresh once, and if the refresh token is also rejected, the user needs to reconnect.

For the non-code side of the network, see our guide to scheduling Bluesky posts and how custom feeds decide what gets seen.

When to use a scheduling API instead of building it yourself

Bluesky is the friendliest network to build on: no app review, no paid tier, a documented open protocol. Building it yourself is reasonable. What adds up is everything around the post call: byte-offset facets, link cards, session refresh under a strict login limit, the video service flow, and then doing different versions of the same work for Mastodon and Threads.

Tesselith posts to Bluesky today, with link facets, alt text and threads handled, through the app or the REST API. Compare options with our scheduling API checklist and the automation walkthrough, or read the docs.

Questions people ask

How do I post to Bluesky with the API?
Call com.atproto.server.createSession to get an access token and DID, then com.atproto.repo.createRecord with collection app.bsky.feed.post and a record containing text and createdAt.
Why aren't links clickable in my Bluesky API posts?
Bluesky doesn't auto-detect links. Add a facet of type app.bsky.richtext.facet#link with byteStart and byteEnd as UTF-8 byte offsets into the text.
What are the Bluesky API rate limits?
5,000 write points per hour and 35,000 per day per account, with a post costing 3 points. createSession is limited to 30 calls per 5 minutes and 300 per day.
How many images can a Bluesky post have?
Up to four, each uploaded with uploadBlob and embedded with app.bsky.embed.images. Keep each image under 1,000,000 bytes.
How do I make a thread with the Bluesky API?
Add a reply object with root and parent strong refs (uri and cid). Root is the first post of the thread; parent is the post directly above.

Try Tesselith free

Connect your channels and schedule your first post in minutes. No credit card required.

Start free

Related pages

Schedule Bluesky posts with TesselithHow to schedule Bluesky postsMastodon API: post a statusBluesky character counter

More from the blog

Choosing a Social Media Scheduling API in 2026: A 12-Point Checklist for DevelopersX API Pricing in 2026: Pay-Per-Use Rates, What a Post Really Costs, and How to BudgetPublishing to Instagram with the Graph API: Containers, Status Polling, Carousels and ReelsPosting to LinkedIn via API in 2026: the Posts API, Versioned Headers, Images, and Personal vs Company Pages

Free to start

One calendar for everything you post.

No credit card. Connect your first channel and schedule a post in under two minutes.

Start free
Tesselith

The social scheduler for creators, teams and agencies. One calendar, every network you post to.

Product

  • Composer
  • Calendar
  • Analytics
  • Automation
  • AI assistant
  • Posting queue
  • API & webhooks
  • MCP server
  • All features

AI agents

  • Claude
  • Claude Code
  • ChatGPT
  • Codex
  • Cursor
  • Gemini CLI
  • n8n
  • All AI agents

Solutions

  • Creators
  • Agencies
  • Small business
  • E-commerce
  • All solutions

Compare

  • Scheduler pricing 2026
  • vs Buffer
  • vs Hootsuite
  • Metricool alternatives
  • Planoly alternatives
  • SocialBee alternatives
  • All comparisons
  • All alternatives

Free tools

  • Character counter
  • Best time to post
  • UTM builder
  • Engagement rate
  • All tools

Company

  • About
  • Blog
  • Research
  • Developer docs
  • Pricing
  • Contact
  • Security
  • Status

Legal

  • Privacy
  • Terms
  • Cookies
  • Acceptable Use
  • DPA
  • Refunds

Schedule posts for

  • X (Twitter)
  • Instagram
  • Facebook Pages
  • LinkedIn
  • YouTube
  • TikTok
  • Threads
  • Bluesky
  • Mastodon
  • Pinterest
  • Reddit
  • Discord
  • Telegram
  • Dev.to
  • Hashnode

Popular guides

  • Post to all social media at once
  • Schedule Discord messages
  • Cross-post to Bluesky, Mastodon and Threads
  • Buffer pricing
  • Sprout Social pricing
  • Metricool pricing
  • Sendible pricing
  • Loomly pricing
© 2026 Tesselith. All rights reserved.
PrivacyTermsCookiesSecurityData deletion
Tesselith