POST /twitter/upload_media_v2

Changed on

Upload media to twitter.You must set the login_cookies.You can get the login_cookies from /twitter/user_login_v2.Price: 60 credits ($0.0006 per call). Long videos: if X is still processing the video after about 90 seconds, the response has status 'success', the media_id and processing_state ('pending' or 'in_progress'); wait about 30-60 seconds before attaching that media_id to a tweet.

Request

  • Base URL
    https://api.twitterapi.io
  • URL
    https://api.twitterapi.io/twitter/upload_media_v2
  • Auth
    API key in header X-API-Key

Request body multipart/form-data

filestring binary required

The media file to upload (image, video, etc.)

proxystring required

The proxy to use.Please use high-quality residential proxies and avoid free proxies. Required. Example: http://username:password@ip:port . You can get proxy from: https://www.webshare.io/?referral_code=4e0q1n00a504

login_cookiesstring required

The login cookies of the user. You can get the login_cookie from /twitter/user_login_v2. Required (the media is uploaded as this account)

is_long_videoboolean

If this is True, videos longer than 2:20 can be uploaded.(Twitter Premium only)

Response

Upload media response

media_idstring

The id of the uploaded media.

statusstring

Status of the request.success or error

messagestring

Message of the request.error message

processing_statestring

Only for videos that X is still processing when the upload returns: pending or in_progress. Wait 30-60 seconds before using the media_id in a tweet.

Changes

    • warning

      removed the optional property from the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status