Skip to main content
This endpoint requires a valid Bearer token. Obtain a token via the authentication endpoints.

Endpoint

POST /api/posts

Plan limits

Post creation is gated by the checkUserPostLimit middleware. If your account has reached the maxPosts limit for your current plan, the request returns 403 with details about your current usage.
Once usage.postsCreated reaches limits.maxPosts for your plan, all create requests are rejected until you upgrade your subscription or your limit resets on the next billing cycle.

Request body

content
object
required
Post content.
selectedPlatforms
string[]
required
One or more platforms to publish to. At least one value is required. Accepted values: bluesky, threads, instagram, facebook, mastodon, tumblr.
platformSpecificContent
object
Per-platform content overrides. Keys are platform names. Each value may contain text and mediaItems that replace the top-level content fields for that platform only.
scheduledAt
string
ISO 8601 datetime string. When provided, the post is queued with status SCHEDULED and published at this time. Omit to publish immediately (PENDING).
timezone
string
default:"UTC"
IANA timezone name used to interpret scheduledAt, e.g. America/New_York.
status
string
Set to DRAFT to save without queueing. Any other value (or omitting) follows the scheduledAt-based logic above.

Status determination

status fieldscheduledAt presentResulting status
DRAFTanyDRAFT — not queued
omitted or otheryesSCHEDULED
omitted or othernoPENDING — queued immediately
Draft posts are not dispatched to the delivery queue. Publish a draft by updating the post and setting status to something other than DRAFT.

Response

success
boolean
required
true on success.
message
string
required
"Post created successfully"
data
object
required

Examples

curl --request POST \
  --url 'https://api.hayon.app/api/posts' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "content": {
      "text": "Hello from Hayon!"
    },
    "selectedPlatforms": ["bluesky", "mastodon"]
  }'

Example response

201
{
  "success": true,
  "message": "Post created successfully",
  "data": {
    "postId": "64f1a2b3c4d5e6f7a8b9c0d1",
    "status": "SCHEDULED",
    "scheduledAt": "2024-12-01T09:00:00.000Z"
  }
}

Error responses

403 Plan limit reached
{
  "message": "Post creation limit reached (50/50). Upgrade to Pro for more.",
  "usage": 50,
  "limit": 50
}
400 Validation error
{
  "success": false,
  "message": "Invalid request data",
  "data": {
    "selectedPlatforms": {
      "_errors": ["At least one platform must be selected"]
    }
  }
}

Build docs developers (and LLMs) love