Skip to content

Examples

Ready-to-use examples for the most common API workflows. Each example includes code in 8 languages with full request and response samples.


Fetch a paginated list of your posts.

Terminal window
curl -X GET "https://api.postproxy.dev/api/posts?page=0&per_page=5" \
-H "Authorization: Bearer YOUR_API_KEY"

Response:

{
"total": 42,
"page": 0,
"per_page": 5,
"data": [
{
"id": "abc123xyz",
"body": "Check out our latest update!",
"status": "processed",
"scheduled_at": null,
"created_at": "2024-01-15T10:30:00.000Z",
"platforms": [
{
"platform": "twitter",
"status": "published",
"params": null,
"attempted_at": "2024-01-15T10:30:01.000Z",
"insights": {
"impressions": 1523,
"on": "2024-01-15T18:00:00.000Z"
}
}
]
}
]
}

See Posts API Reference for all query parameters including filtering by status, platform, and schedule date.


Retrieve full details for a post including media, platform results, and insights.

Terminal window
curl -X GET "https://api.postproxy.dev/api/posts/abc123xyz" \
-H "Authorization: Bearer YOUR_API_KEY"

Response:

{
"id": "abc123xyz",
"body": "Check out our latest update!",
"status": "processed",
"scheduled_at": null,
"created_at": "2024-01-15T10:30:00.000Z",
"media": [
{
"id": "med123",
"status": "processed",
"error_message": null,
"content_type": "image/jpeg",
"source_url": "https://example.com/photo.jpg",
"url": "https://cdn.postproxy.dev/uploads/photo.jpg"
}
],
"platforms": [
{
"platform": "twitter",
"status": "published",
"params": null,
"attempted_at": "2024-01-15T10:30:01.000Z",
"insights": {
"impressions": 1523,
"on": "2024-01-15T18:00:00.000Z"
}
},
{
"platform": "instagram",
"status": "published",
"params": {
"format": "post"
},
"attempted_at": "2024-01-15T10:30:02.000Z",
"insights": {
"impressions": 3842,
"on": "2024-01-15T18:00:00.000Z"
}
}
]
}

Publish a simple post with an image to a single platform.

Terminal window
curl -X POST "https://api.postproxy.dev/api/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"post": {
"body": "Exciting news — we just launched our new feature!"
},
"profiles": ["twitter"],
"media": ["https://example.com/launch.jpg"]
}'

Response:

{
"id": "xyz789abc",
"body": "Exciting news — we just launched our new feature!",
"status": "processed",
"scheduled_at": null,
"created_at": "2024-01-15T10:30:00.000Z",
"platforms": [
{
"platform": "twitter",
"status": "published",
"error": null,
"params": null,
"attempted_at": "2024-01-15T10:30:01.000Z"
}
]
}

Post a video to YouTube, TikTok, and Instagram simultaneously with platform-specific parameters for each.

Terminal window
curl -X POST "https://api.postproxy.dev/api/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"post": {
"body": "New video is live!"
},
"profiles": ["youtube", "tiktok", "instagram"],
"media": ["https://example.com/video.mp4"],
"platforms": {
"youtube": {
"title": "Getting Started Tutorial",
"privacy_status": "public"
},
"tiktok": {
"format": "video",
"privacy_status": "PUBLIC_TO_EVERYONE"
},
"instagram": {
"format": "reel",
"first_comment": "Full tutorial on our channel!"
}
}
}'

Response:

{
"id": "vid456abc",
"body": "New video is live!",
"status": "processed",
"scheduled_at": null,
"created_at": "2024-01-15T10:30:00.000Z",
"platforms": [
{
"platform": "youtube",
"status": "processing",
"params": {
"title": "Getting Started Tutorial",
"privacy_status": "public",
"made_for_kids": false
},
"attempted_at": "2024-01-15T10:30:01.000Z"
},
{
"platform": "tiktok",
"status": "processing",
"params": {
"format": "video",
"privacy_status": "PUBLIC_TO_EVERYONE"
},
"attempted_at": "2024-01-15T10:30:02.000Z"
},
{
"platform": "instagram",
"status": "published",
"params": {
"format": "reel",
"first_comment": "Full tutorial on our channel!"
},
"attempted_at": "2024-01-15T10:30:03.000Z"
}
]
}

Each platform gets its own params — YouTube gets a title and privacy setting, TikTok gets its privacy status, and Instagram is published as a reel with a first comment. See Platform Parameters for all available options.


Post a multi-part thread to X (Twitter) and Threads. Each item in the thread array becomes a reply to the previous post. Thread children can also include media.

Terminal window
curl -X POST "https://api.postproxy.dev/api/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"post": {
"body": "1/ Here is a thread about our product launch"
},
"profiles": ["twitter", "threads"],
"thread": [
{ "body": "2/ First, we built the foundation..." },
{ "body": "3/ Then we added the key features...", "media": ["https://example.com/screenshot.jpg"] },
{ "body": "4/ And finally, we launched! Check it out at example.com" }
]
}'

Response:

{
"id": "thr123abc",
"body": "1/ Here is a thread about our product launch",
"status": "processed",
"scheduled_at": null,
"created_at": "2024-01-15T10:30:00.000Z",
"platforms": [
{ "platform": "twitter", "status": "processing" },
{ "platform": "threads", "status": "processing" }
],
"thread": [
{ "id": "def456", "body": "2/ First, we built the foundation..." },
{ "id": "ghi789", "body": "3/ Then we added the key features..." },
{ "id": "jkl012", "body": "4/ And finally, we launched! Check it out at example.com" }
]
}

Set scheduled_at with an ISO 8601 timestamp to publish a post at a specific time. Postproxy handles the scheduling automatically.

Terminal window
curl -X POST "https://api.postproxy.dev/api/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"post": {
"body": "Big announcement coming at noon!",
"scheduled_at": "2024-01-20T12:00:00Z"
},
"profiles": ["twitter", "linkedin"]
}'

Response:

{
"id": "sch789abc",
"body": "Big announcement coming at noon!",
"status": "scheduled",
"scheduled_at": "2024-01-20T12:00:00.000Z",
"created_at": "2024-01-15T10:30:00.000Z",
"platforms": [
{
"platform": "twitter",
"status": "processing",
"error": null,
"params": null,
"attempted_at": null
},
{
"platform": "linkedin",
"status": "processing",
"error": null,
"params": null,
"attempted_at": null
}
]
}

The post status is scheduled and attempted_at is null until the scheduled time arrives.


Set draft: true to create a post without publishing it. Review the content, then publish it with a separate API call when ready.

Step 1: Create the draft.

Terminal window
curl -X POST "https://api.postproxy.dev/api/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"post": {
"body": "Draft content to review before posting",
"draft": true
},
"profiles": ["instagram", "facebook"],
"media": ["https://example.com/photo.jpg"]
}'

Response:

{
"id": "drf456abc",
"body": "Draft content to review before posting",
"status": "draft",
"scheduled_at": null,
"created_at": "2024-01-15T10:30:00.000Z",
"platforms": [
{
"platform": "instagram",
"status": "processing",
"error": null,
"params": { "format": "post" },
"attempted_at": null
},
{
"platform": "facebook",
"status": "processing",
"error": null,
"params": null,
"attempted_at": null
}
]
}

Step 2: Publish when ready.

Terminal window
curl -X POST "https://api.postproxy.dev/api/posts/drf456abc/publish" \
-H "Authorization: Bearer YOUR_API_KEY"

The SDK examples above show both steps. See Publish post for details.


Retrieve engagement metrics (impressions, likes, comments, etc.) for one or more posts. Stats are collected periodically and returned as time-series snapshots. You can filter by platform and date range.

Terminal window
curl -X GET "https://api.postproxy.dev/api/posts/stats?post_ids=abc123,def456&profiles=instagram,twitter" \
-H "Authorization: Bearer YOUR_API_KEY"

Response:

{
"data": {
"abc123": {
"platforms": [
{
"profile_id": "prof_abc",
"platform": "instagram",
"records": [
{
"stats": {
"impressions": 1523,
"likes": 102,
"comments": 15,
"saved": 11
},
"recorded_at": "2026-02-21T04:00:00Z"
}
]
}
]
},
"def456": {
"platforms": [
{
"profile_id": "prof_def",
"platform": "twitter",
"records": [
{
"stats": {
"impressions": 430,
"likes": 22,
"retweets": 5
},
"recorded_at": "2026-02-20T12:00:00Z"
}
]
}
]
}
}
}

The stats fields vary by platform. See Stats fields by platform for the full breakdown.


List all connected social media profiles in your account.

Terminal window
curl -X GET "https://api.postproxy.dev/api/profiles" \
-H "Authorization: Bearer YOUR_API_KEY"

Response:

{
"data": [
{
"id": "prof123abc",
"name": "My Company Page",
"platform": "facebook",
"status": "active",
"profile_group_id": "grp456xyz",
"expires_at": null,
"post_count": 42
},
{
"id": "prof789def",
"name": "@mycompany",
"platform": "instagram",
"status": "active",
"profile_group_id": "grp456xyz",
"expires_at": null,
"post_count": 38
},
{
"id": "prof456ghi",
"name": "@mycompany",
"platform": "twitter",
"status": "active",
"profile_group_id": "grp456xyz",
"expires_at": null,
"post_count": 55
}
]
}

Use the id from the response when creating posts with specific profiles. You can also use platform names like "twitter" as a shorthand — Postproxy will pick the first connected profile for that platform.


Use the Initialize Connection endpoint to generate an OAuth URL for connecting a new social media account. Redirect the user to the returned URL — after they authenticate, they’ll be sent back to your redirect_url and the profile is created automatically.

Terminal window
curl -X POST "https://api.postproxy.dev/api/profile_groups/grp456xyz/initialize_connection" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "instagram",
"redirect_url": "https://myapp.com/oauth/callback"
}'

Response:

{
"url": "https://postproxy.com/partner_connect/inv789xyz",
"success": true
}

Redirect the user to the url in the response. Supported platforms: facebook, instagram, tiktok, linkedin, youtube, twitter, threads, pinterest. See Initialize Connection for full details.