Build an AI social agent
Most agent demos die on platform integrations. PostLake is the hands: one publish call. One analytics shape, MCP if you want zero wrapper code. Your model still decides what to say, PostLake only executes and reports.
Get started free →Free tier. No card · one API for every network · full MCP access
The product is the agent: it should decide, publish, measure, and improve without you maintaining platform APIs.
Same setup the docs quickstart uses. Do this once:
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.sk_live_…). It shows once; treat it like a password.The agent needs hands (publish) and feedback (analytics). Both match the docs. Same auth. Same profile. Same response discipline:
import os, uuid, requests
HEADERS = {"Authorization": f"Bearer {os.environ['POSTLAKE_API_KEY']}"}
def publish(text: str) -> dict:
"""Publish to every account on the profile. Always check targets[]."""
return requests.post(
"https://api.postlake.dev/v1/posts",
headers={**HEADERS, "Idempotency-Key": str(uuid.uuid4())},
json={"text": text, "profile": "my-brand"},
).json()
def performance(period: str = "30d") -> dict:
"""Same metric names on every network, agent-friendly."""
return requests.get(
f"https://api.postlake.dev/v1/analytics?period={period}",
headers=HEADERS,
).json()
# Or skip wrappers: connect https://api.postlake.dev/mcp (OAuth).Tool-specific glue on top of the shared setup above:
POST /v1/posts) and performance (GET /v1/analytics), or use MCP tools for both.partial as mixed results and to never claim success without reading targets.scheduledAt (UTC, or a local time plus timezone) so the agent can plan ahead without a second product.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 } }
]
}published: every target succeeded. partial: some published, some failed. failed: none published. processing: still going (async networks like TikTok).Idempotency-Key header on writes so a retry never double-posts.Same rules as the docs. Pick one addressing style:
"profile": "my-brand" posts to every account under that profile (the name on Channels)."platforms": ["bluesky", "linkedin"] narrows that set. It is a filter, not a selector: if you have two Pinterest boards, both match pinterest."accounts": ["acc_…"] for exact channels (copy an id on Channels, or GET /v1/social-accounts).profile? PostLake uses that profile. Multiple profiles and you omit it? You'll get an error that names them.See Publishing: where to post.
scheduledAt as UTC (trailing Z), or a naive local time plus timezone (IANA, e.g. Europe/London). Credits charge when it fires. Scheduling docs · scheduling guide.POST /v1/media, then pass the med_… id in media. Media docs.textOverrides (e.g. shorter text for X). Per-network options: platformOptions (Pinterest boardId, TikTok privacy, …). Live option lists: GET /v1/platforms/{platform}.POST /v1/posts/validate runs the same checks without publishing (free).GET /v1/platforms (or MCP equivalent) before posting so the agent respects length/media rules.POST /v1/posts/validate on drafts, free. Same checks as publish.Want zero wrapper code? Connect the hosted MCP server (https://api.postlake.dev/mcp) over OAuth. Same accounts and responses as this API path. Agents overview.
Give it PostLake publish (POST /v1/posts) and analytics (GET /v1/analytics), or connect MCP. The agent never talks to nine platform APIs, only one normalised contract.
Idempotency-Key on each logical publish. Retries with the same key return the original Post instead of creating another.
GET /v1/analytics returns the same metric names across networks. The agent compares without a translation layer. See the analytics guide and docs.
MCP (https://api.postlake.dev/mcp) is best when the host supports OAuth tools. REST tools are fine inside your own backend agent runtime.
These guides stay short on purpose. Canonical behaviour lives here:
Also: Media · Errors · MCP · Analytics
All guides · Full docs · llms.txt · Markdown
Stuck? The docs are the source of truth, start at Publishing.
Open the dashboard →