atproto

Atproto is a typed OCaml client for the AT Protocol. Resolve identities, read and write repos, follow the firehose, and call AppView, Ozone, and hosted Bluesky services (chat, video, Jetstream). Client only: this package does not host a PDS, chat backend, video transcoder, Tap, SMS gateway, or APNs/FCM.

Install, env, and examples: README. Release notes: CHANGELOG.

Install

opam update && opam install atproto

Then (libraries atproto) in dune. OCaml >= 4.14.1 and < 5.4 (CI: 4.14.1 and 5.3.0). Jetstream dict-zstd needs system libzstd (libzstd-dev / Homebrew zstd). Pin the GitHub repo or a local clone for an unreleased tip.

Quick start

These two calls need the public network, not ATP_AUTH. Identity.resolve_handle talks to the entryway (ATP_HOST, default bsky.social). Feed.search_posts talks to the public AppView (public.api.bsky.app). ATP_PUBLIC only gates tests, not this snippet.

let did = (Identity.resolve_handle "jay.bsky.team").did
let posts = Feed.search_posts ~q:"atproto" ~limit:5 ()

Where to go next

Modules

Identity. Handle and DID resolve, PLC, did:web / did:key.

Session. App passwords, invites, email, getServiceAuth.

AppView. Profiles, timelines, search, graphs, bookmarks, public labelers.

Records. create/put/delete/applyWrites and typed post / like / follow builders.

Firehose. subscribeRepos and Jetstream live tail / archive HTTP.

OAuth. PKCE, DPoP, public HTTPS client-metadata, browser login. You still host the metadata document. Authed AppView / Ozone / chat use Oauth.get_service_auth, not the DPoP access token.

Hosted clients. Chat (api.bsky.chat; extra DM scopes), video (video.bsky.app; no transcoder), contacts (no SMS gateway), registerPush (caller gateway).

Ozone and reports.

Sync and indexer. Repo CAR, MST, CID. Atproto.Repo_sync is a backfill toolkit, not a Tap host.

Protocol bits. at://, TIDs, XRPC, lexicons, labels, HTTP.

Also Atproto.Draft, Atproto.Ageassurance, Atproto.Site, Atproto.Germnetwork, Atproto.App, Atproto.Client, Atproto.Request, and Atproto.Response.

Experimental proposal 0016 (At_uri.Space plus the modules below). Not a spaces product API. No space host in this package.

Notes

Live public-network tests skip unless ATP_PUBLIC=1. Default opam install -t / @runtest stay offline.

Official lexicons are pinned at f0d4877a.

Atproto.Chat needs a DM grant (transition:chat.bsky or include:chat.bsky.authFullChatClient, or a privileged app-password). Atproto.Jetstream archive HTTP needs an operator JETSTREAM_API_KEY; live subscribe stays unauthenticated. Space helpers skip unless ATP_SPACE=1 and ATP_SPACE_HOST names a real host.