X Posting API
Post text, images, video and threads to X from your app, with each customer or agent on its own key.
- Text, images, video and threads from one endpoint
- Checked against X's length and media rules before it's sent
- Accounts connect through X's own OAuth login
- Per-key caps, so a looping agent can't post all night
const pk = new Postkey(process.env.POSTKEY_KEY);
await pk.posts.create({
accounts: [
"acc_x_789"
],
content: "We just shipped dark mode. Settings → Appearance."
});- Xpublished
1 call · key customer_42
Your first X post in three steps
- 1
Connect X
Your customer signs in through X's own login. You get an account ID, never a password.
- 2
Make a key
Create a key for that customer or agent, scoped to their accounts, with the caps you choose.
- 3
Post
Send the post to /v1/posts with that key. The X result comes back in the response and by webhook.
Every X format, one endpoint
Pick a format to see the exact request and what comes back. Options that only make sense on X sit under "x".
A plain post. The simplest call there is.
1POST https://api.postkey.dev/v1/posts2Authorization: Bearer pk_cust_42_…3Content-Type: application/json4 5{6 "accounts": [7 "acc_x_789"8 ],9 "content": "We just shipped dark mode. Settings → Appearance."10}200 · published
Counted against customer_42 only.
{
"id": "post_3k9d2",
"status": "published",
"results": [
{
"account": "acc_x_789",
"platform": "x",
"status": "published",
"url": "https://x.com/acme/status/…"
}
]
}Everything you need for X posting
Checked against X's rules
Before anything is sent, Postkey checks it against X's published limits:
Threads in one call
Send the replies as a list. Postkey posts them in order, each one replying to the last. If one fails, the rest stop and the webhook says which.
Media upload handled
Send a file or a URL. Postkey runs X's media upload, including the chunked flow for video, and attaches the result.
Duplicates stopped early
X rejects exact repeats. Postkey can block them per key before they reach X, so an agent retry doesn't burn a call.
X costs shown per key
X charges for API posting, so X posts count extra on your plan. Usage is split by key, so you see which customer or agent caused it.
No passwords
Accounts connect through X's OAuth login. Your customers never hand you a password, and you can disconnect one without touching the rest.
Also for X
Keys & control
Every X post has an owner
Each customer or agent posts to X through its own key: only its accounts, its own caps, its own log, and an off switch that touches nothing else.
Works with your stack
Your code
Node and Python SDKs with the same calls, or plain REST from anything that speaks HTTP.
- Node
- Python
- {}REST
No-code tools
Call the REST API from an HTTP step in n8n, Make or Zapier. Give each workflow its own key.
- n8n
- Make
- Zapier
AI agents & MCP
The MCP server lets Claude, Cursor and other agent tools post through their own key, with caps they can't change.
- MCP server
Beyond X
Same request shape on every platform. Add an account ID and the post goes there too.
- You're hereX Posting APIText · Image · Video · Thread
- Instagram Posting APIFeed post · Reel · Story · Carousel
- Facebook Posting APIText · Photo · Video
- TikTok Posting APIVideo · Photo
- LinkedIn Posting APIText · Image · Document
- YouTube Posting APIVideo
- YouTube Shorts Posting APIShort
- Pinterest Posting APIPin
- Google Business Posting APIUpdate post · Offer · Event
X posting questions
Something not here? Email hello@postkey.dev.
What can I post to X?
Text posts, posts with images, posts with a video, and threads. Each one is a single call to the same endpoint.
How do threads work?
Put the first post in content and the replies in a thread list. Postkey publishes them in order as replies. If one fails, it stops there and tells you which one and why.
Why do X posts count as more than one post?
X charges developers for posting through its API. Postkey passes that cost through as extra post credits for X only, and shows it per key.
Does Postkey check the length before sending?
Yes. Text and media are checked against X's published limits first, so you get a clear error instead of a failed post.
Can my customers connect their own X accounts?
Yes. They sign in with X's login screen. You get an account ID to post with and never see their password.
Can I schedule X posts instead?
Yes. Add scheduledFor to the same request. See the X Scheduling API page for details.
Post to X with a key per customer.
Get a key, connect an account, send the request above.
Free to start. Read the docs