67 releases

Uses new Rust 2024

0.25.8 Mar 26, 2026
0.25.7 Dec 27, 2025
0.25.6 Oct 1, 2025
0.25.4 May 26, 2025
0.4.0 Jun 30, 2023

#92 in Web programming

Download history 729/week @ 2026-01-23 1265/week @ 2026-01-30 823/week @ 2026-02-06 848/week @ 2026-02-13 1463/week @ 2026-02-20 1270/week @ 2026-02-27 1081/week @ 2026-03-06 968/week @ 2026-03-13 909/week @ 2026-03-20 1388/week @ 2026-03-27 1238/week @ 2026-04-03 1095/week @ 2026-04-10 1041/week @ 2026-04-17 1417/week @ 2026-04-24 1111/week @ 2026-05-01 1243/week @ 2026-05-08

4,935 downloads per month
Used in 28 crates (21 directly)

MIT license

1MB
21K SLoC

ATrium API: Rust library for Bluesky's atproto services

Rust

ATrium API is a Rust library that includes the definitions of XRPC requests and their associated input/output model types. These codes are generated from the Lexicon schema on atproto.com.

Usage

Any HTTP client that implements atrium_xrpc::HttpClient can be used to handle XRPC requests. Since atrium_xrpc_client provides several implementations, it is recommended to use one of them that fits your project requirements.

use atrium_api::client::AtpServiceClient;
use atrium_xrpc_client::reqwest::ReqwestClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = AtpServiceClient::new(ReqwestClient::new("https://bsky.social"));
    let result = client
        .service
        .com
        .atproto
        .server
        .create_session(
            atrium_api::com::atproto::server::create_session::InputData {
                auth_factor_token: None,
                identifier: "alice@mail.com".into(),
                password: "hunter2".into(),
                allow_takendown: None,
            }
            .into(),
        )
        .await;
    println!("{:?}", result);
    Ok(())
}

AtpAgent (agent feature)

While AtpServiceClient can be used for simple XRPC calls, it is better to use AtpAgent, which has practical features such as session management.

use atrium_api::agent::atp_agent::{store::MemorySessionStore, AtpAgent};
use atrium_xrpc_client::reqwest::ReqwestClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let agent = AtpAgent::new(
        ReqwestClient::new("https://bsky.social"),
        MemorySessionStore::default(),
    );
    agent.login("alice@mail.com", "hunter2").await?;
    let result = agent
        .api
        .com
        .atproto
        .server
        .get_session()
        .await?;
    println!("{:?}", result);
    Ok(())
}

Features

The AtpAgent used in the above example is included in the agent feature. atrium-api enables the agent and bluesky features by default. It is possible to opt-out if not needed.

  • agent: enable the agent module.
  • bluesky: enable bluesky-specific lexicon definitions and XRPC methods.
    • It is also possible to enable only the namespace specified by namespace-*.

Dependencies

~7–12MB
~201K SLoC