Skip to content

Social media posting API

Publish text, images, video, threads, Reels and Shorts to X, Instagram, Facebook, TikTok, LinkedIn, YouTube, Pinterest and Google Business with one POST request. You get a result back for every account.

No card required.

POST/v1/posts201 Created · 954 ms
{
  "content": "First tray of brown butter cookies is out.",
  "mediaItems": [
    {
      "type": "image",
      "url": "https://img.mariabakes.co/tray1.jpg"
    }
  ],
  "platforms": [
    { "platform": "twitter", "accountId": "int_x_789" },
    { "platform": "linkedin", "accountId": "int_li_456" },
    { "platform": "instagram", "accountId": "int_ig_123" }
  ],
  "publishNow": true
}

Maria's Bakery@maria_bakes · now

First tray of brown butter cookies is out.

Maria's Bakery

1,204 followers

Now ·

First tray of brown butter cookies is out.

LikeCommentRepostSend
maria.bakes
Brown butter cookies on a dark table

maria.bakes First tray of brown butter cookies is out.

  • Posted to X as @maria_bakes
  • Posted to LinkedIn as Maria's Bakery
  • Posted to Instagram as maria.bakes

One integration, every network

  • X
  • Instagram
  • Facebook
  • TikTok
  • LinkedIn
  • YouTube
  • Pinterest
  • Google Business

What you'd maintain without it

Every network has its own login, upload steps, review process and rules, and each one changes a few times a year. This is the folder Postkey keeps up to date so yours stays one file.

Without Postkey · 8 integrations
  • social/
  • instagram/
  • login.ts# Instagram Login or Facebook Login + Page
  • publish.ts# create container → poll status → publish
  • app-review/# screencast + use-case write-up for Meta
  • x/
  • oauth2-pkce.ts
  • media-upload.ts# INIT → APPEND × n → FINALIZE → STATUS
  • threads.ts# reply chain, stop on first failure
  • tiktok/
  • direct-post.ts# private-only until the audit passes
  • linkedin/
  • documents.ts# initializeUpload → PUT → attach
  • youtube/resumable-upload.ts
  • facebook/ pinterest/ google-business/
  • shared/
  • refresh-tokens.cron.ts# 8 expiry rules
  • media-rules.ts# length, size, ratio, duration × 8
  • retry-without-double-post.ts
  • api-version-changes.md# never finished
With Postkey · 1 file
// post.ts
const res = await fetch("https://api.postkey.dev/v1/posts", {
  method: "POST",
  headers: {
    "x-access-key": process.env.POSTKEY_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    content: "Spring menu is live: 12 new dishes",
    mediaItems: [{ type: "image", url: imageUrl }],
    platforms: accounts, // [{ platform, accountId }]
    publishNow: true,
  }),
});

Your users connect through a link. Tokens, uploads, rules and retries happen on our side.

The whole integration is three calls

Your user connects an account once. After that, every post is one request.

  1. Send a connect link

    Ask Postkey for a link and send your user to it. They sign in with the network's own login screen.

    GET /v1/connect/twitter
      ?profileId=prof_harbor_st
      &redirectUri=https://yourapp.com/connected
    { "url":
      "https://x.com/i/oauth2/…" }
  2. Get the account id

    When they come back, list the connected accounts for that profile. Each one has an id.

    GET /v1/connect/integrations
      ?profileId=prof_harbor_st
    { "id": "int_x_789",
      "platform": "twitter",
      "username": "harborstbakery" }
  3. Post

    Send the content and the account ids. One result comes back per network, and by webhook.

    POST /v1/posts
    { "content": "Spring menu starts Monday.",
      "platforms": [{ "platform": "twitter",
        "accountId": "int_x_789" }],
      "publishNow": true }
    { "status": "published",
      "platforms": [{ "success": true, … }] }

Try a request

Pick a post. You see the code, what comes back from each network and what it costs.

A release note on X and LinkedIn.

POST https://api.postkey.dev/v1/posts
x-access-key: pk_live_…
Content-Type: application/json

{
  "content": "v2.4 is out: bulk scheduling and CSV import. Full changelog on our blog.",
  "platforms": [
    {
      "platform": "twitter",
      "accountId": "int_x_789"
    },
    {
      "platform": "linkedin",
      "accountId": "int_li_456"
    }
  ],
  "publishNow": true
}
Response200 · published
  • X5 credits
  • LinkedIn1 credit
  • Total for this request6 credits
{
  "success": true,
  "postId": "post_te7c41",
  "status": "published",
  "platforms": [
    {
      "platform": "twitter",
      "accountId": "int_x_789",
      "success": true,
      "platformPostUrl": "https://x.com/harborstbakery/status/…"
    },
    {
      "platform": "linkedin",
      "accountId": "int_li_456",
      "success": true,
      "platformPostUrl": "https://www.linkedin.com/feed/update/…"
    }
  ]
}

Credits are only spent on networks that publish. A failed network gives its credits back.

Posting is one of six APIs

Every API uses the same key, profiles and connected accounts. Pick a network to see its formats and limits.

Which networks each Postkey API supports
APIXInstagramYouTubeFacebookTikTokLinkedInPinterestGoogle Business
PublishingYou're here
Scheduling
Analytics
Comments
Comment to DM
Reviews

Call it from code, a workflow or an agent

The same request works everywhere, so you can start in n8n and move to code later.

Claude Codepostkey MCP

Post Friday's changelog to X and LinkedIn for Northwind, with the screenshot from the 2.4 release.

● postkey.create_post

{ "content": "v2.4: bulk scheduling and CSV import.",
  "mediaItems": [{ "type": "image", … }],
  "platforms": ["twitter", "linkedin"] }

Posted to X and LinkedIn for Northwind. Both are live. It used 6 credits.

  • x.com/northwindhq/status/1866…
  • linkedin.com/feed/update/urn:li:share:7262…
$ claude mcp add --transport http postkey https://mcp.postkey.dev --header "x-access-key: $POSTKEY_API_KEY"

Posting API questions

Something not here? Email hello@postkey.dev. I answer every one myself.

Book a 15-minute call
  • X, Instagram, Facebook, TikTok, LinkedIn, YouTube, YouTube Shorts, Pinterest and Google Business. Each one has its own page with the formats, the limits Postkey checks and a request you can copy.

  • No. They open a connect link and sign in with each network's normal login, under Postkey's approved app. If you'd rather show your own brand on the consent screen, plug in your own app. Nothing else in your code changes.

  • The others still publish. The post comes back as partial, the failed network has a plain reason, and its credits are refunded. Retry sends only the failed network, so nothing double-posts.

  • Any language that can send an HTTP request. The examples come in cURL, Node.js and Python, there's an OpenAPI spec, and AI agents can use the MCP server.

  • Send a public URL or upload the file to Postkey first. Postkey runs each network's upload flow, waits for processing, and sends a webhook when the video is live or tells you why it isn't.

  • 1 credit per network on most networks. X costs 5 credits per post (50 with a link) because X charges per post. Every plan has unlimited connected accounts, and the free plan has 20 credits a month. See pricing.

  • One API key for your whole project, a profile per customer, connect links under our app or yours, unlimited connected accounts on every plan, and credits that come back when a network fails. Compare alternatives.

Send your first post today.

$ curl -X POST api.postkey.dev/v1/posts -H "x-access-key: …"

No card required.