Create or update a post
http://localhost:4000/api/v1 /posts action decides what happens: draft saves, schedule publishes at scheduledAt, now publishes right away (both need the posts:publish scope). Send id to update a draft or scheduled post. When creating, send idempotencyKey to make a retry safe: the same key returns the first post. A part may name files by address in mediaUrls: each is added to the media library first (needs media:write; an address named twice in one call is fetched once). Scheduling the same text and files to a channel that already has them within 24 hours answers 409 with existingPostId; send allowDuplicate: true to schedule it anyway. A workspace's own rules (banned words, required tags) refuse scheduling with 400. For keys and tokens the answer carries previewUrl, a view-only link to the post as it will publish.
Request body
application/json
idpartsShow child parameters
textmediaIdsdelaySecondsmediaUrlstargetsShow child parameters
channelIdpartsShow child parameters
textmediaIdsdelaySecondsmediaUrlssettingsactionscheduledAttagIdsclientIdaiGeneratedidempotencyKeyallowDuplicate{
"id": "string",
"parts": [
{
"text": "string",
"mediaIds": [],
"delaySeconds": 0,
"mediaUrls": [
"string"
]
}
],
"targets": [
{
"channelId": "string",
"parts": [
{
"text": "string",
"mediaIds": [],
"delaySeconds": 0,
"mediaUrls": [
"string"
]
}
],
"settings": {}
}
],
"action": "draft",
"scheduledAt": "2024-01-01T00:00:00Z",
"tagIds": [
"string"
],
"clientId": "string",
"aiGenerated": true,
"idempotencyKey": "string",
"allowDuplicate": true
}Code samples
cURL
curl -X POST "http://localhost:4000/api/v1/posts" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"id":"string","parts":[{"text":"string","mediaIds":[],"delaySeconds":0,"mediaUrls":["string"]}],"targets":[{"channelId":"string","parts":[{"text":"string","mediaIds":[],"delaySeconds":0,"mediaUrls":["string"]}],"settings":{}}],"action":"draft","scheduledAt":"2024-01-01T00:00:00Z","tagIds":["string"],"clientId":"string","aiGenerated":true,"idempotencyKey":"string","allowDuplicate":true}'TypeScript
Python
Go
PHP
Ruby
Java
Responses
Example
{
"id": "string",
"previewUrl": "string"
}Schema
idpreviewUrl