Post with PHP
PHP talks to PostLake with ordinary HTTPS. Same request body as the docs quickstart, profile name, text, optional filters.
Get started free →Free tier. No card · one API for every network · full MCP access
Your product or CMS is PHP and you want fan-out without Facebook/Twitter SDKs.
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:
<?php
$payload = json_encode([
"text" => "Hello from PHP 👋",
"profile" => "my-brand",
]);
$ch = curl_init("https://api.postlake.dev/v1/posts");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("POSTLAKE_API_KEY"),
"Content-Type: application/json",
"Idempotency-Key: hello-php-001",
],
CURLOPT_POSTFIELDS => $payload,
]);
$raw = curl_exec($ch);
$post = json_decode($raw, true);
foreach ($post["targets"] as $t) {
echo $t["platform"] . " " . $t["state"] . PHP_EOL;
}Tool-specific glue on top of the shared setup above:
profile set to your Channels profile name.json_decode the body and loop targets: don't stop at HTTP 200.scheduledAt) and media (med_… ids).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).curl_getinfo($ch, CURLINFO_HTTP_CODE) and the Post state separately.Content-Type: application/json and proper JSON encoding.Prefer an assistant over PHP code? Point it at MCP (https://api.postlake.dev/mcp). Prefer the dashboard? Use Quickstart → No code.
cURL or Guzzle POST to https://api.postlake.dev/v1/posts with Bearer auth and JSON { text, profile }. Decode targets[] for per-network results.
No. One HTTP call to PostLake covers every connected account on the profile.
Yes, add scheduledAt as UTC or a naive local time plus timezone. See docs → Scheduling for edit/cancel endpoints.
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 →