XreplyAIDevelopers
API ReferenceMedia Uploads

Upload an X (Twitter) image

Requires scope: `publish:write`. Uploads a base64 image to X and returns a `media_id` for use in a post's metadata. X media IDs are scoped to the uploading account — pass `social_account_id` when the user has more than one X account connected, or the media is minted under the oldest connected account and is invalid for the others.

POST
/twitter/media_uploads
AuthorizationBearer <token>

A personal API key created in the dashboard (Starter, Pro, and Team plans).

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/twitter/media_uploads" \  -H "Content-Type: application/json" \  -d '{    "content_type": "image/png",    "image": "<base64>",    "social_account_id": 27  }'
{  "media_id": "1789456123456789012"}