T

Twit · Tweets MediaUpload

by Twit

POSTBase

$0.006

per call · USD Coin on Base

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.

Endpoint

POST https://x402.twit.sh/tweets/mediaUpload

6

Calls / 30d

1

Unique payers / 30d

Sep 2

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://x402.twit.sh/tweets/mediaUpload", {
  method: "POST",
});
const data = await res.json();
cURL
curl -X POST \
  "https://x402.twit.sh/tweets/mediaUpload" \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

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

Payment details

Pay to0x9dba414637c611a16bea6f0796bfcbcbdc410df8
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase
Schemesexact

Is this your API?

Pin it to the top of Social & Community and the homepage with a featured placement.

Get featured →

More from Twit & similar services