MisarMisar Docs
MisarMailMisarBlogMisarReachMisarPostMisarDevMisarCoderMisarSEOMisar PlatformMisar SSO
SDKs

Go SDK

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

The Go SDK provides a full client for the developer API (https://api.misar.io/blog/v1) plus the iframe embed helpers.

Installation

go get github.com/misar-ai/misarblog-go

API Client

misarblog.New authenticates with an mbk_ key and defaults to https://api.misar.io/blog/v1 (the gateway strips /api). Every method takes a context.Context.

package main

import (
    "context"
    "fmt"
    "log"

    misarblog "github.com/misar-ai/misarblog-go"
)

func main() {
    client := misarblog.New("mbk_YOUR_KEY")
    // Override the base URL: misarblog.New("mbk_...", misarblog.WithBaseURL("https://api.misar.io/blog/v1"))

    ctx := context.Background()

    // List your articles
    list, err := client.Articles.List(ctx, &misarblog.ListArticlesParams{
        Status: "published",
        Limit:  20,
    })
    if err != nil {
        log.Fatal(err)
    }
    for _, a := range list.Articles {
        fmt.Println(a.Title, a.URL)
    }

    // Publish
    created, err := client.Articles.Publish(ctx, &misarblog.PublishArticleRequest{
        Title:        "Getting Started with the MisarBlog API",
        BodyMarkdown: "## Introduction\n\nThis guide covers…",
        Tags:         []string{"go", "api"},
        Visibility:   "public",
    })
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(created.Slug)
}

Other resources

client.Articles.Get(ctx, "my-first-article")
client.Articles.Update(ctx, "my-first-article", &misarblog.UpdateArticleRequest{Publish: true})
client.Articles.CreateDraft(ctx, &misarblog.CreateDraftRequest{Title: "WIP"})
client.Articles.Search(ctx, &misarblog.SearchParams{Q: "react", Sort: "newest"})
client.Articles.Recommendations(ctx, articleID, 5)

client.Series.List(ctx)
client.Series.Create(ctx, &misarblog.CreateSeriesRequest{Title: "A Series"})

client.AI.Titles(ctx, &misarblog.TitlesRequest{Action: "seo", Prompt: "AI writing tools 2026"})
client.AI.Complete(ctx, &misarblog.CompleteRequest{Prompt: "Tighten this: …", MaxTokens: 300})

client.Images.Generate(ctx, &misarblog.GenerateImageRequest{Prompt: "A minimalist cover", Size: "1792x1024"})

client.Analytics.Summary(ctx, 30)
client.Me.Get(ctx)
client.Plan.Get(ctx)
client.Trial.Status(ctx)

client.Reactions.Get(ctx, articleID)
client.Reactions.Add(ctx, articleID, "like")     // "like" | "clap" | "bookmark"
client.Reactions.Remove(ctx, articleID, "like")

Resources

ResourceMethods
client.ArticlesList · Get · Publish · Update · CreateDraft · Search · Recommendations
client.SeriesList · Create · AddArticle
client.AITitles · Complete
client.ImagesGenerate · Upload
client.AnalyticsSummary
client.MeGet
client.PlanGet
client.TrialStatus · Start
client.ReactionsGet · Add · Remove
client.UpsellFunnelGet — platform-admin only

Embed helpers

// Profile embed (pass "" for slug and "auto" for the default theme)
url := misarblog.EmbedURL("johndoe", "", "auto")
postURL := misarblog.EmbedURL("johndoe", "my-first-post", "dark")

// For gated (paywalled) embeds, refresh the session token
result, err := misarblog.RefreshToken("current-session-token", "https://misar.blog")

EmbedURL(username, slug, theme string) string returns a public embed-viewer URL. RefreshToken(token, baseURL string) (*TokenResult, error) returns *TokenResult{ Token, ExpiresAt }, or an error on a non-200 response.