Create or update a post

Embed
Preview of the card
<a href="https://indrava.forumulate.com/docs/ref-posts-save"><img src="https://indrava.forumulate.com/docs/_api/public/orgs/e421ace4-3e78-4ed8-9818-7b4899cf3aa0/spaces/2bcc7f09-4489-40af-85d8-9fdd3f3da314/pages/f2f49a59-818f-44fc-976a-f7cff623abd6/social-card.svg?v=3e7ae33eec8b" alt="Create or update a post" width="600" height="315"></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
id
string
parts
object[]
required
Show child parameters
text
string
required
mediaIds
string[]
= []
delaySeconds
integer
mediaUrls
string[]
targets
object[]
required
Show child parameters
channelId
string
required
parts
object[]
Show child parameters
text
string
required
mediaIds
string[]
= []
delaySeconds
integer
mediaUrls
string[]
settings
object
= {}
action
string
required
draft | schedule | now
scheduledAt
string
tagIds
string[]
clientId
string
aiGenerated
boolean
idempotencyKey
string
allowDuplicate
boolean
{
  "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

200 OK
Example
{
  "id": "string",
  "previewUrl": "string"
}
Schema
id
string
required
previewUrl
string
Updated