SDKs
Rust SDK
Publish articles, manage series, and run AI tools with the MisarBlog Rust SDK, plus post-embed helpers.
The Rust SDK (misarblog-sdk v1.0.0) provides an async client for the developer API (https://api.misar.io/blog/v1) plus the iframe embed helpers.
Installation
[dependencies]
misarblog-sdk = "1"
tokio = { version = "1", features = ["full"] }API Client
MisarBlog::new authenticates with an mbk_ key and defaults to https://api.misar.io/blog/v1 (the gateway strips /api). All methods are async.
use misarblog_sdk::{MisarBlog, types::ListArticlesParams};
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let blog = MisarBlog::new("mbk_YOUR_KEY");
// Override the base URL: MisarBlog::new("mbk_...").with_base_url("https://api.misar.io/blog/v1")
// List your articles
let list = blog.articles.list(&ListArticlesParams {
status: Some("published".into()),
limit: Some(20),
..Default::default()
}).await?;
println!("{list}");
// Publish
let created = blog.articles.publish(&json!({
"title": "Getting Started with the MisarBlog API",
"body_markdown": "## Introduction\n\nThis guide covers…",
"tags": ["rust", "api"],
"visibility": "public"
})).await?;
println!("{}", created.slug);
Ok(())
}Other resources
blog.articles.get("my-first-article").await?;
blog.articles.update("my-first-article", &json!({ "publish": true })).await?;
blog.articles.create_draft(&json!({ "title": "WIP" })).await?;
blog.articles.recommendations(article_id, Some(5)).await?;
blog.series.list().await?;
blog.series.create(&json!({ "title": "A Series" })).await?;
blog.ai.titles(&json!({ "action": "seo", "prompt": "AI writing tools 2026" })).await?;
blog.ai.complete(&json!({ "prompt": "Tighten this: …", "max_tokens": 300 })).await?;
blog.images.generate(&json!({ "prompt": "A minimalist cover", "size": "1792x1024" })).await?;
blog.account.me().await?;
blog.analytics.summary(Some(30)).await?;
blog.plan.get().await?;
blog.plan.trial_status().await?;
blog.reactions.get(article_id).await?;
blog.reactions.add(&json!({ "article_id": article_id, "type": "like" })).await?;
blog.reactions.remove(article_id, "like").await?;Resources
| Resource | Methods |
|---|---|
blog.articles | list · get · publish · update · create_draft · search · recommendations |
blog.series | list · create · add_article |
blog.reactions | get · add · remove |
blog.ai | titles · complete |
blog.images | generate · upload |
blog.account | me |
blog.analytics | summary · upsell_funnel (admin only) |
blog.plan | get · trial_status · start_trial |
Methods return typed structs (Article, Series) or serde_json::Value, and errors surface as BlogApiError.
Embed helpers
use misarblog_sdk::{embed_url, refresh_token};
let url = embed_url("johndoe", None, "auto");
let post_url = embed_url("johndoe", Some("my-first-post"), "dark");
// For gated (paywalled) embeds
let result = refresh_token("current-session-token", "https://misar.blog").await?;embed_url(username: &str, slug: Option<&str>, theme: &str) -> String returns a public embed-viewer URL. refresh_token(token, base_url).await returns a TokenResult { token, expires_at }.