Skip to main content
Both endpoints require a valid Bearer token. You can only act on posts that belong to your account.

Retry failed platforms

POST /api/posts/:postId/retry
Identifies all platform entries in platformStatuses with status: "failed" and re-queues delivery jobs for them. Each failed platform’s status is reset to "pending" before re-enqueuing. If no platforms are in a failed state, the request returns 400.

Path parameters

postId
string
required
MongoDB ObjectId of the post to retry.

Response

success
boolean
required
true on success.
message
string
required
"Retry initiated for failed platforms"
data
object
required

Cancel a post

POST /api/posts/:postId/cancel
Cancels a post that is in a cancellable state (typically PENDING or SCHEDULED). Returns 404 if the post does not exist, is not owned by you, or is in a state that cannot be cancelled.

Path parameters

postId
string
required
MongoDB ObjectId of the post to cancel.

Response

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

Examples

curl --request POST \
  --url 'https://api.hayon.app/api/posts/64f1a2b3c4d5e6f7a8b9c0d1/retry' \
  --header 'Authorization: Bearer <token>'

Example response — retry

200
{
  "success": true,
  "message": "Retry initiated for failed platforms",
  "data": {
    "postId": "64f1a2b3c4d5e6f7a8b9c0d1",
    "retryingPlatforms": ["mastodon", "tumblr"]
  }
}

Example response — cancel

200
{
  "success": true,
  "message": "Post cancelled successfully",
  "data": {
    "postId": "64f1a2b3c4d5e6f7a8b9c0d1",
    "status": "CANCELLED"
  }
}

Error responses

400 No failed platforms
{
  "success": false,
  "message": "No failed platforms to retry"
}
404 Not found or not cancellable
{
  "success": false,
  "message": "Post not found, unauthorized, or not in a cancellable state"
}

Build docs developers (and LLMs) love