API Reference / Posts
Publish a post
PostPiper API: publish an X, LinkedIn, or TikTok draft immediately to the connected account. No request body; returns updated post status.
POST
https://api.postpiper.ai/v1/posts/{postId}/publishThe draft needs a connected account for its platform. X supports text or images; LinkedIn requires text of 1–3,000 characters and supports up to 20 JPEG or PNG images from media_urls. TikTok posts use one MP4 or MOV video. The endpoint takes no request body.
An uncertain upstream failure can mean the post already exists. Check the platform account before retrying.
Path and query parameters
| Name | Type | Description |
|---|---|---|
| postId | UUID, required | ID of an owned draft. |
Example request
Terminal
curl -X POST -H "Authorization: Bearer $POSTPIPER_API_KEY" "https://api.postpiper.ai/v1/posts/<post-uuid>/publish"Response
200 OK. Returns a published post. The platform ID and URL may be null even after success.
JSON
{
"post": {
"id": "<post-uuid>",
"content": "Hello from PostPiper",
"media_urls": [],
"asset_ids": [],
"platform": "x",
"status": "published",
"account_id": "<account-uuid>",
"created_at": "2030-10-12T01:00:00.000Z",
"published_at": "2030-10-12T01:01:00.000Z",
"platform_post_id": "<platform-id>",
"platform_post_url": "https://x.com/example/status/123"
}
}Errors
400X_AUTH_EXPIRED or LINKEDIN_AUTH_EXPIRED.401Missing or invalid API key.403API key lacks the required scope.409POST_NOT_DRAFT.429Platform rate limit.502X_PUBLISH_FAILED or LINKEDIN_PUBLISH_FAILED; the outcome may be uncertain.