Skip to main content
Posts

Create Post

Publish content to one or more social platforms with a single API call.

Endpoint

POST https://api.postpeer.dev/v1/posts

Request Body

FieldTypeRequiredDescription
contentstringYesThe text body of your post
publishNowbooleanYes*Set to true to publish immediately
scheduledForstringNoISO 8601 datetime for scheduled posts
timezonestringNoIANA timezone (default: "UTC")

*Required when scheduledFor is not provided.

platforms (required)

An array of platform targets (min 1).

FieldTypeRequiredDescription
platformstringYes"twitter", "instagram", "youtube", "tiktok", "pinterest", "linkedin", or "reddit"
accountIdstringYesIntegration ID from /v1/connect/integrations
platformSpecificDataobjectNoPlatform-specific options (see Platforms)

mediaItems (optional)

An array of media attachments.

FieldTypeRequiredDescription
typestringYes"image", "video", or "gif"
urlstringYesPublic URL to the media file
thumbnailstringNoThumbnail URL (YouTube only)

Example: Publish Now

curl -X POST "https://api.postpeer.dev/v1/posts" \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Launching our new feature today!",
    "platforms": [
      { "platform": "twitter", "accountId": "abc123" },
      { "platform": "instagram", "accountId": "def456" }
    ],
    "mediaItems": [
      { "type": "image", "url": "https://example.com/image.png" }
    ],
    "publishNow": true
  }'

Example: Cross-Post to Multiple Platforms

curl -X POST "https://api.postpeer.dev/v1/posts" \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Check out our latest video!",
    "platforms": [
      { "platform": "twitter", "accountId": "tw_123" },
      { "platform": "youtube", "accountId": "yt_456", "platformSpecificData": { "title": "Our Latest Video", "privacyStatus": "public" } }
    ],
    "mediaItems": [
      { "type": "video", "url": "https://example.com/video.mp4" }
    ],
    "publishNow": true
  }'

Response

{
  "success": true,
  "status": "published",
  "postId": "post_abc123",
  "platforms": [
    {
      "platform": "twitter",
      "success": true,
      "platformPostUrl": "https://twitter.com/you/status/123456"
    },
    {
      "platform": "instagram",
      "success": true,
      "platformPostUrl": "https://instagram.com/p/abc123"
    }
  ]
}

Status Codes

CodeMeaning
202Post accepted — published, scheduled, partial, or failed
400Validation error (bad request body)
402Not enough credits
403Forbidden
503Scheduling unavailable

Partial Failures

When posting to multiple platforms, some may succeed and others fail. A 202 response with "status": "partial" includes per-platform results:

{
  "success": true,
  "status": "partial",
  "postId": "post_abc123",
  "platforms": [
    { "platform": "twitter", "success": true, "platformPostUrl": "..." },
    { "platform": "instagram", "success": false, "error": "Image URL is not publicly accessible" }
  ]
}

Failed platform posts don't consume credits.

On this page