MisarMisar Docs
MisarMailMisarBlogMisarReachMisarPostMisarDevMisarCoderMisarSEOMisar PlatformMisar SSO
SDKs

Kotlin SDK

Publish articles, manage series, and run AI tools with the MisarBlog Kotlin SDK, plus post-embed helpers.

The Kotlin SDK (blog.misar:misarblog-sdk v1.0.0) provides a coroutine-based client for the developer API (https://api.misar.io/blog/v1) plus iframe embed helpers.

Installation

dependencies {
    implementation("blog.misar:misarblog-sdk:1.0.0")
}

API Client

Construct with your mbk_ key. The base URL defaults to https://api.misar.io/blog/v1 (the gateway strips /api). Resource methods are suspend functions.

import blog.misar.sdk.MisarBlog

suspend fun main() {
    val blog = MisarBlog("mbk_YOUR_KEY")
    // Override: MisarBlog("mbk_YOUR_KEY", baseUrl = "https://api.misar.io/blog/v1")

    // List your articles
    val list = blog.articles.list(mapOf("status" to "published", "limit" to 20))

    // Publish
    val created = blog.articles.publish(mapOf(
        "title" to "Getting Started with the MisarBlog API",
        "body_markdown" to "## Introduction\n\nThis guide covers…",
        "tags" to listOf("kotlin", "api"),
        "visibility" to "public",
    ))
    println(created.slug)
}

Other resources

blog.articles.get("my-first-article")
blog.articles.update("my-first-article", mapOf("publish" to true))
blog.articles.createDraft(mapOf("title" to "WIP"))
blog.articles.recommendations(articleId, limit = 5)

blog.series.list()
blog.series.create(mapOf("title" to "A Series"))

blog.ai.titles(mapOf("action" to "seo", "prompt" to "AI writing tools 2026"))
blog.ai.complete(mapOf("prompt" to "Tighten this: …", "max_tokens" to 300))

blog.images.generate(mapOf("prompt" to "A minimalist cover", "size" to "1792x1024"))

blog.account.me()
blog.analytics.summary(30)
blog.analytics.upsellFunnel(30)   // admin only
blog.plan.get()
blog.plan.trialStatus()

blog.reactions.get(articleId)
blog.reactions.add(mapOf("article_id" to articleId, "type" to "like"))
blog.reactions.remove(articleId, "like")

Resources

ResourceMethods (all suspend)
blog.articleslist · get · publish · update · createDraft · search · recommendations
blog.serieslist · create · addArticle
blog.reactionsget · add · remove
blog.aititles · complete
blog.imagesgenerate · upload
blog.accountme
blog.analyticssummary · upsellFunnel (admin only)
blog.planget · trialStatus · startTrial

get, publish, update, createDraft, and series.create return typed Article / Series; other methods return Map<String, Any>. Failures throw a BlogApiException.

Embed helpers

The companion helpers need no key:

val url = MisarBlog.embedUrl("johndoe")
val postUrl = MisarBlog.embedUrl("johndoe", slug = "my-first-post", theme = "dark")

// For gated (paywalled) embeds (suspend)
val result = MisarBlog.refreshToken("current-session-token")

MisarBlog.embedUrl(username, slug = null, theme = "auto"): String returns a public embed-viewer URL. suspend MisarBlog.refreshToken(token, baseUrl = "https://misar.blog"): TokenResult returns a TokenResult(token, expiresAt).