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
contentstringNoPer-platform text override. When set, this replaces the top-level content for this platform only. Useful when different platforms call for different copy (e.g. hashtags on Instagram, shorter on Twitter).
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
  }'

Example: Per-Platform Content Override

Each platform entry accepts its own content field. When provided, it replaces the top-level content for that platform only — handy when you want a punchy tweet but a longer caption on Instagram.

curl -X POST "https://api.postpeer.dev/v1/posts" \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Shipped: faster scheduling, fewer clicks. 🚀",
    "platforms": [
      {
        "platform": "twitter",
        "accountId": "tw_123"
      },
      {
        "platform": "linkedin",
        "accountId": "li_789",
        "content": "Excited to share that we just shipped a major update to our scheduling engine. The team focused on two things: cutting time-to-publish and reducing the number of clicks it takes to get a post live across multiple channels. If you manage social for a brand or team, I would love your feedback."
      }
    ],
    "publishNow": true
  }'

Twitter falls back to the top-level content, while LinkedIn gets its own longer, more professional version.

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