Examples
Short, complete examples. Replace the ids with your own from GET /brands and GET /brands/{id}/channels.
Python: create a post and wait for the approval
import os, time, uuid
import requests
BASE = "https://app.postaki.io/api/v1"
HEAD = {"Authorization": f"Bearer {os.environ['POSTAKI_KEY']}"}
def call(method, path, key=None, **kw):
headers = dict(HEAD)
key = key or str(uuid.uuid4()) # the same key on a retry, so it can never make two posts
if method != "GET":
headers["Idempotency-Key"] = key
r = requests.request(method, BASE + path, headers=headers, timeout=30, **kw)
if r.status_code == 429:
time.sleep(int(r.headers.get("Retry-After", "5")))
return call(method, path, key=key, **kw)
r.raise_for_status()
return r.json() if r.content else None
body = {
"brand_id": 12,
"text": "Our new summer menu is here.",
"ai_generated": False,
"scheduled_at": "2026-12-01T09:00:00+02:00",
"submit": True,
"channels": [{"channel_id": 345}, {"channel_id": 346}],
}
post = call("POST", "/posts", json=body)
print("Waiting for approval at", post["approval_url"])
A photo and a TikTok post
upload = call("POST", "/media/uploads", json={
"brand_id": 12, "filename": "dish.jpg", "content_type": "image/jpeg",
"size": os.path.getsize("dish.jpg"), "rights_confirmed": True})
with open("dish.jpg", "rb") as f:
requests.put(upload["upload_url"], data=f, timeout=120).raise_for_status()
call("POST", f"/media/uploads/{upload['upload_id']}/complete")
while call("GET", f"/media/{upload['media_id']}")["status"] not in ("ready", "failed"):
time.sleep(2)
creator = call("GET", "/channels/347/options")["creator_info"] # the TikTok account's own settings: pick a privacy level from it
body = {
"brand_id": 12, "text": "Dish of the day", "ai_generated": False, "submit": True,
"scheduled_at": "2026-12-01T12:00:00+02:00", "media_ids": [upload["media_id"]],
"channels": [{"channel_id": 347, "options": {"privacy_level": "SELF_ONLY"}}],
}
privacy_level has no default: use one the account offers (see TikTok options).
Dry run: see every problem at once
POST /posts/validate answers with the issues per channel and field and saves nothing:
curl https://app.postaki.io/api/v1/posts/validate -H "Authorization: Bearer $POSTAKI_KEY" \
-H "Content-Type: application/json" \
-d '{"brand_id": 12, "ai_generated": true, "channels": [{"channel_id": 348}], "text": "Hello"}'
Node: receive a webhook
import crypto from "node:crypto";
import express from "express";
const app = express();
app.post("/postaki-hook", express.raw({ type: "application/json" }), (req, res) => {
const parts = Object.fromEntries(req.get("Postaki-Signature").split(",").map(p => p.split("=")));
const expected = crypto.createHmac("sha256", process.env.POSTAKI_WEBHOOK_SECRET)
.update(`${parts.t}.`).update(req.body).digest("hex");
const ok = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300 &&
crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
if (!ok) return res.sendStatus(400);
const event = JSON.parse(req.body);
// De-duplicate on req.get("Postaki-Delivery-Id"), then handle event.type.
res.sendStatus(204);
});
app.listen(3000);
MCP: a prompt to give an assistant
Look at my Postaki brands and channels. Draft a post for Friday at 9:00 (Athens time) about our new opening hours, one text for Facebook and a shorter one for Threads. Check it first, then create it and send it for approval. Tell me when it is waiting and give me the link. I wrote the text myself, so it is not AI-generated.
The assistant should answer that the post is waiting for your approval, with the link, and never that it is published.