AI writing
Write a native post per network from one idea, without publishing.
POST /api/generate writes one draft per network: each within that network's length, with its own hashtags and format. Nothing is published. Feed drafts back into POST /api/post as per_platform to publish exactly what was written. Drafts count against the plan's AI drafts a day.
POST /api/generate: Write a native post per network, without publishing
Write a native post per network, without publishing
/api/generateReturns one draft per requested network. Feed `drafts` straight back into /api/post as `per_platform` to publish exactly what was written. platforms may be an array or a comma-separated string ("tiktok, instagram"); the idea may be sent as prompt, idea, text or topic. With no platforms, the account's connected networks are used. 400 codes: prompt_required, platforms_required, unknown_platform; 502 ai_failed when the writer fails.
Needs an API key: Authorization: Bearer pw_live_….
Body (JSON)
| Field | Type | Description |
|---|---|---|
prompt required | string | The idea to communicate. Up to 4000 characters. |
platforms required | array of string | One of: tiktok, instagram, youtube, linkedin, facebook, bluesky, mastodon, telegram, discord. |
media_url | string (uri) | |
brand_voice | string | Up to 1500 characters. |
Responses
| Status | Means |
|---|---|
200 | { drafts: { <platform>: { text } } } |
400 | prompt or platforms[] missing |
429 | Daily generation cap for the plan reached |
503 | AI not configured |
curl -X POST "https://postwire.io/api/generate" \
-H "Authorization: Bearer $POSTWIRE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "We now proof our sourdough for 36 hours",
"platforms": [
"tiktok",
"linkedin",
"bluesky"
],
"brand_voice": "warm, specific, no hype"
}'const res = await fetch("https://postwire.io/api/generate", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.POSTWIRE_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
"prompt": "We now proof our sourdough for 36 hours",
"platforms": [
"tiktok",
"linkedin",
"bluesky"
],
"brand_voice": "warm, specific, no hype"
}),
});
console.log(res.status, await res.json());import os, requests
r = requests.post(
"https://postwire.io/api/generate",
headers={"Authorization": f"Bearer {os.environ['POSTWIRE_API_KEY']}"},
json={
"prompt": "We now proof our sourdough for 36 hours",
"platforms": ["tiktok", "linkedin", "bluesky"],
"brand_voice": "warm, specific, no hype",
},
)
print(r.status_code, r.json())Example response
{
"drafts": {
"tiktok": {
"text": "36 hours. That's how long this dough rests… #sourdough #bakery"
},
"linkedin": {
"text": "We doubled our proofing time to 36 hours. Three things changed…"
},
"bluesky": {
"text": "Sourdough, now proofed for 36 hours. The crumb is open, the crust cracks. Worth the wait."
}
}
}Texts shortened. Publish them with POST /api/post and per_platform: drafts.