# twit.sh Media Upload

> twit.sh Media Upload is a paid API for AI agents from x402.twit.sh, paid per call via x402, $0.006/call, status unknown (last checked 2026-09-15).

Uploads a media file (image/video) to X/Twitter via the twit.sh proxy, returning a media_id for use in subsequent tweet posts

## Facts

- Endpoint: POST https://x402.twit.sh/tweets/mediaUpload
- Price: $0.006/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/twit-sh-media-upload-c4c97872
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_sn-POFi62nEgBDkOlFk9R

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 twit-sh-media-upload-c4c97872 -d '<json body>'
```

Example prompt: Upload this JPEG image to X using twit.sh so I can attach it to a tweet — here's the image data.

## When to prefer this

Use this endpoint when you need to attach an image or media file to a tweet via twit.sh without managing your own X API credentials. It is the right choice when you want pay-per-use media uploads to X without sign-up, using USDC on Base. Prefer it over direct X API access when you don't have or want to manage Twitter OAuth tokens.

## Known failure modes

- Invalid or missing media file body returns an error
- Unsupported media type rejected by X API
- Payment failure via x402/USDC prevents request from processing
- Media file too large for X's upload limits
- Expired or invalid x402 payment header
- X API rate limit or service outage causes upstream failure

## How this service works

Uploads an image to Twitter/X for the authenticated user and returns a media_id to attach to a tweet. Send the file as multipart/form-data field "file" (e.g. -F "file=@photo.jpeg"); pass auth_token and ct0 as query params. Returns media_id, media_id_string, media_key, size, expires_after_secs, and image metadata.

## Output

Returns a JSON object containing the media_id (numeric and string forms), media_key, image dimensions (width and height in pixels), file size in bytes, image MIME type, and the number of seconds until the uploaded media expires (86400 seconds / 24 hours).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "required": {
   "type": "string"
  },
  "properties": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": {
   "size": 22610,
   "image": {
    "h": 683,
    "w": 1024,
    "image_type": "image/jpeg"
   },
   "media_id": 2066778128366940200,
   "media_key": "3_2066778128366940160",
   "media_id_string": "2066778128366940160",
   "expires_after_secs": 86400
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/twit-sh-media-upload-c4c97872/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.twit.sh](https://www.zero.xyz/host/x402.twit.sh/llms.txt)
