Post with Go

Post to social media
with Go.

Use the standard library against the same publish contract as the docs. One request. One Post struct worth of JSON.

Get started free →

Free tier. No card · one API for every network · full MCP access

In shortnet/http POST to /v1/posts from Go. Decode the Post JSON and inspect targets, stdlib only.

When this guide is for you

Your services are Go and you want outbound social with idiomatic HTTP, not a zoo of SDK wrappers.

Before you start

Same setup the docs quickstart uses. Do this once:

  1. Sign up at app.postlake.dev and verify your email (unlocks free credits).
  2. On Channels, create a profile (e.g. my-brand) and connect at least one account. Bluesky is the fastest first channel: no app review. Instagram/TikTok/Facebook need each platform's review before API posting.
  3. Account menu → API Keys → create a key (sk_live_…). It shows once; treat it like a password.

Working example in Go

Connect accounts once in the dashboard, then this is the publish call:

package main

import (
	"bytes"
	"encoding/json"
	"net/http"
	"os"
)

func main() {
	body, _ := json.Marshal(map[string]any{
		"text":    "Hello from Go 👋",
		"profile": "my-brand",
	})
	req, _ := http.NewRequest("POST", "https://api.postlake.dev/v1/posts", bytes.NewReader(body))
	req.Header.Set("Authorization", "Bearer "+os.Getenv("POSTLAKE_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Idempotency-Key", "hello-go-001")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	var post map[string]any
	json.NewDecoder(resp.Body).Decode(&post)
	// Inspect post["state"] and post["targets"].
}

Make it work in Go

Tool-specific glue on top of the shared setup above:

  1. Read the key from the environment; set profile to the Channels name.
  2. POST with net/http: no third-party social client.
  3. Decode JSON and range over targets (define a small struct if you prefer).
  4. Set Idempotency-Key for workers that retry on timeout.

Read the response (don't skip this)

You get one Post with an overall state and a targets[] array. One entry per account. Always check each target; partial success is normal.

{
  "id": "post_a1b2c3",
  "state": "partial",
  "targets": [
    { "platform": "bluesky",  "state": "published", "url": "https://bsky.app/…" },
    { "platform": "linkedin", "state": "failed",
      "error": { "type": "invalid_request", "message": "…", "retryable": false } }
  ]
}

Where the post goes

Same rules as the docs. Pick one addressing style:

See Publishing: where to post.

Do more (same API)

Pitfalls specific to this path

Prefer an assistant over Go code? Point it at MCP (https://api.postlake.dev/mcp). Prefer the dashboard? Use Quickstart → No code.

Common questions

How do I post to social media with Go?

Marshal JSON { text, profile }, POST to /v1/posts with Authorization: Bearer. Decode the Post and read targets for live URLs and errors.

Is there a Go SDK I need?

No. net/http is enough; PostLake is one REST endpoint for every network.

Can I schedule from Go?

Add scheduledAt (UTC, or a naive local time plus timezone) to the body map. Credits charge at fire time.

Go deeper in the docs

These guides stay short on purpose. Canonical behaviour lives here:

Also: Media · Errors · MCP · Analytics

Related guides

All guides · Full docs · llms.txt · Markdown

Stuck? The docs are the source of truth, start at Publishing.

Open the dashboard →