Media Status
/tw-v2/interaction/media-status1 API unit per call · How billing works
Description
Check whether an uploaded video or GIF has finished processing.
Usage notes
Pass the mediaId from /tw-v2/interaction/upload-media with the same authToken; only the account that uploaded the media can check it. Wait checkAfterSecs seconds between checks. When state is succeeded, the media is ready to post. When it is failed, X couldn't process the file: the response is still a 200, and error holds X's reason. X discards an unused upload when expiresAfterSecs runs out.
Each status check costs one API unit. 400, 401, 403, 409, 422, 429 and 5xx errors are free.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| auth | string | required | Authentication token (auth_token cookie value) of the X account that uploaded the media |
| proxystringrequired | string | required | Proxy in format 'hostname:port@username:password' |
| media | string | required | mediaId returned by /tw-v2/interaction/upload-media |
Code Examples
const params = new URLSearchParams({
authToken: 'YOUR_AUTH_TOKEN',
proxy: 'proxy.example.com:8080@username:password',
mediaId: '2100000000000000002'
});
const response = await fetch(`https://api.tweetapi.com/tw-v2/interaction/media-status?${params}`, {
method: 'GET',
headers: {
'X-API-Key': 'YOUR_API_KEY'
}
});
const data = await response.json();
console.log(data);
Response
Success Response (200 OK)
Synthetic example:
{
"data": {
"mediaId": "2100000000000000002",
"state": "in_progress",
"progressPercent": 62,
"checkAfterSecs": 3,
"error": null,
"expiresAfterSecs": 86280
}
}When processing has finished, state is succeeded:
{
"data": {
"mediaId": "2100000000000000002",
"state": "succeeded",
"progressPercent": 100,
"checkAfterSecs": null,
"error": null,
"expiresAfterSecs": 86255
}
}When X couldn't process the file, state is failed and error holds X's reason:
{
"data": {
"mediaId": "2100000000000000002",
"state": "failed",
"progressPercent": null,
"checkAfterSecs": null,
"error": {
"code": 1,
"name": "InvalidMedia",
"message": "Unsupported video format"
},
"expiresAfterSecs": 86255
}
}Errors
Errors return { statusCode, message } with a non-2xx HTTP status.
{
"statusCode": 400,
"message": "Request validation failed"
}TweetAPI is a third-party API and is not affiliated with X Corp.