# twitr.sh X/Twitter Write API

> twitr.sh X/Twitter Write API is a paid API for AI agents from twitr.sh, paid per call via x402, $0.036/call, status unknown (last checked 2026-10-09).

Performs write actions on X/Twitter — post, reply, like, retweet, follow, DM, and more — paid per-call in USDC with no API key required

## Facts

- Endpoint: POST https://twitr.sh/api/tools/x_write?utm_source=zero.xyz
- Price: $0.036/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-09
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/twitr-sh-x-twitter-write-api-67d0e61a
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_EhqkRXMlnonukKWMJd2AX

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability twitr-sh-x-twitter-write-api-67d0e61a -d '<json body>'
```

Example prompt: Post a tweet from my X account @myhandle saying 'Excited to announce our new product launch — stay tuned for more details!'

## When to prefer this

Choose this endpoint when you need to perform write operations on X/Twitter without managing API keys or OAuth credentials, and you want pay-per-call billing in USDC. Prefer this over direct X API integration when building AI agents that need to post, engage, or DM programmatically with minimal setup friction.

## Known failure modes

- Invalid or unconnected X handle — the wallet does not own the specified account
- Missing required field for the chosen action (e.g. no reply_to_tweet_id for a reply action)
- Target tweet or user not found — invalid tweet ID or user ID
- Rate limit exceeded on the underlying X API — temporary failure
- Payment failure — insufficient USDC balance or x402 protocol error
- Attempting to like an already-liked tweet or follow an already-followed user

## How this service works

Pay-per-call X/Twitter API for AI agents. Read tweets, search, monitor accounts in real time, and post — paid in USDC via x402. No signup, no API keys.

## Output

Returns a JSON object containing an items array with the resulting tweet's ID and URL, a runId for tracing, a payment record showing amount charged in USD via x402, and the call duration in milliseconds.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string",
   "description": "post|reply|send_dm: the message body."
  },
  "action": {
   "enum": [
    "post",
    "reply",
    "like",
    "unlike",
    "retweet",
    "unretweet",
    "follow",
    "unfollow",
    "delete_tweet",
    "send_dm",
    "remove_follower",
    "upload_media"
   ],
   "type": "string",
   "description": "Which write to perform."
  },
  "account": {
   "type": "string",
   "description": "A connected X handle owned by this wallet (no @)."
  },
  "media_ids": {
   "type": "array",
   "items": {
    "type": "string"
   },
   "description": "send_dm: optional uploaded media ids to attach."
  },
  "media_url": {
   "type": "string",
   "description": "upload_media: public URL of the file to upload; returns a media_id."
  },
  "community_id": {
   "type": "string",
   "description": "post: optional community to post into."
  },
  "is_note_tweet": {
   "type": "boolean",
   "description": "post: long-form note tweet."
  },
  "target_user_id": {
   "type": "string",
   "description": "follow|unfollow|send_dm|remove_follower: the numeric X user id of the target (not the @handle). Get it from x_read get-user."
  },
  "target_tweet_id": {
   "type": "string",
   "description": "like|unlike|retweet|unretweet|delete_tweet: the target tweet ID."
  },
  "reply_to_tweet_id": {
   "type": "string",
   "description": "reply: the tweet being replied to."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "items": [
   {
    "id": "1893710452812718080",
    "url": "https://x.com/myhandle/status/1893710452812718080"
   }
  ],
  "runId": "tw_example",
  "payment": {
   "amount": "0.036000",
   "currency": "USD",
   "protocol": "x402"
  },
  "duration": 1
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/twitr-sh-x-twitter-write-api-67d0e61a/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from twitr.sh](https://www.zero.xyz/host/twitr.sh/llms.txt)
