Post with CrewAI
Share one PostLake tool across the crew (or MCP). Publishing stays one call; the normalised response is what the next agent reasons over.
Get started free →Free tier. No card · one API for every network · full MCP access
A CrewAI crew needs a publisher role (research → write → post) without each agent speaking a different social API.
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.Connect accounts once in the dashboard, then this is the publish call:
from crewai.tools import tool
import os, requests, uuid
@tool("Post to social")
def post_to_social(text: str) -> str:
"""Publish to the my-brand profile via PostLake. Returns JSON text."""
r = requests.post(
"https://api.postlake.dev/v1/posts",
headers={
"Authorization": f"Bearer {os.environ['POSTLAKE_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={"text": text, "profile": "my-brand"},
)
r.raise_for_status()
return r.text # full Post JSON for the next agent
# Agent(role="Publisher", tools=[post_to_social], ...)Tool-specific glue on top of the shared setup above:
/v1/posts and returns the response body so downstream agents can parse targets.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).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.
Pass a custom tool that calls PostLake /v1/posts (or enable MCP). Give it to the publisher agent. One tool covers every network on the profile.
No. Share one PostLake tool. Other agents should consume the JSON result, not call platform APIs.
Yes, when your CrewAI/MCP host supports it. Same server URL as the MCP docs.
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 →