Quickstart: post to X in 3 minutes
Give an AI agent or your code the ability to post to X (Twitter). One API key, no X developer account, no OAuth. Pick REST, MCP, or the CLI below.
1. Get an API key
Create a key (prefix ot_) in your developer dashboard. Send it on every request as an Authorization: Bearer header. Keep it server-side.
Keep keys secret
Never ship anot_ key in client-side code or a public repo. Anyone with the key can post to your X account.2a. Post with the REST API
Publish immediately with publish_now:
bash
curl -X POST https://opentweet.io/api/v1/posts \
-H "Authorization: Bearer ot_your_key" \
-H "Content-Type: application/json" \
-d '{"text": "Hello from my code.", "publish_now": true}'Or schedule with scheduled_date (ISO 8601, mutually exclusive with publish_now):
bash
curl -X POST https://opentweet.io/api/v1/posts \
-H "Authorization: Bearer ot_your_key" \
-H "Content-Type: application/json" \
-d '{"text": "Launch day.", "scheduled_date": "2026-07-10T09:00:00Z"}'Full endpoint list is in the REST API reference.
2b. Connect an AI agent with MCP
Paste the hosted endpoint into any MCP client (Claude Code, Cursor, Windsurf) to give your agent all 36 tools. Nothing to install:
mcp config
{
"mcpServers": {
"opentweet": {
"type": "streamable-http",
"url": "https://mcp.opentweet.io/mcp",
"headers": { "Authorization": "Bearer ot_your_key" }
}
}
}Per-client setup and the local npm option are in the MCP setup guide.
2c. Post from the terminal
bash
npm install -g @opentweet/cli
opentweet auth # paste your ot_ key
opentweet tweet "Shipped a new release." --now
opentweet tweet "Scheduled for later." --schedule "2026-07-10 09:00"Next steps
- • Authentication: key scopes, rotation, and verifying with
GET /me. - • MCP tools reference: all 36 tools your agent can call.
- • REST API reference: threads, batch scheduling, articles, analytics.