#notion-api #properties #notion #api-client #deserialize #user #documentation

notionrs

A Notion API client that provides type-safe request serialization and response deserialization

37 releases

Uses new Rust 2024

1.0.0-alpha.37 Mar 11, 2025
1.0.0-alpha.36 Mar 8, 2025
1.0.0-alpha.35 Feb 25, 2025
1.0.0-alpha.29 Jan 25, 2025
1.0.0-alpha.10 Oct 28, 2024

#107 in HTTP client

Download history 339/week @ 2024-11-27 304/week @ 2024-12-04 578/week @ 2024-12-11 22/week @ 2024-12-18 315/week @ 2024-12-25 216/week @ 2025-01-01 190/week @ 2025-01-08 22/week @ 2025-01-15 102/week @ 2025-01-22 129/week @ 2025-01-29 20/week @ 2025-02-05 7/week @ 2025-02-12 514/week @ 2025-02-19 249/week @ 2025-02-26 194/week @ 2025-03-05 84/week @ 2025-03-12

1,043 downloads per month
Used in elmethis-notion

MIT/Apache

455KB
10K SLoC

Notion API Client for Rust

Unit Test Check Documentation Build Crates.io

ogp

Status: Alpha Release! (Under Construction) 🚧

This project is currently under active development and is not yet ready for production use. Features and API stability may change without notice. Contributions and feedback are welcome!

Features currently released

As part of the alpha release, the following features are available. Please note that API changes may occur before the official release.

  • Blocks
    • Append block children
    • Retrieve a block
    • Retrieve block children
    • Update a block
    • Delete a block
  • Databases
    • Create a database
    • Query a database
    • Retrieve a database
    • Update a database
  • Pages
    • Create a page
    • Retrieve a page property item
    • Retrieve a page
    • Update page properties
  • Users
    • List all users
    • Retrieve a user
    • Retrieve your token's bot user
  • Search
    • Search by title

Basic Usage

Below is a basic example. (More detailed documentation is coming soon, so please stay tuned!)

use notionrs::{
    block::{Block, ParagraphBlock},
    error::Error,
    Client, RichText,
};

#[tokio::main]
async fn main() -> Result<(), Error> {
    dotenvy::dotenv().ok();

    let client = Client::new();

    // Here, we're retrieving the ID from an environment variable,
    // but you can change the method of retrieval to suit your needs.
    let block_id = std::env::var("NOTION_PAGE_ID").unwrap();

    let block = Block::Paragraph {
        paragraph: ParagraphBlock::new()
            .rich_text(vec![RichText::from("Time to start with Notion in Rust")]),
    };

    let request = client
        .append_block_children()
        .block_id(block_id.clone())
        .children(vec![block]);

    let response = request.send().await?;

    println!("{:?}", response);

    Ok(())
}

Dependencies

~5–20MB
~318K SLoC