Media
Download Chat Media
Downloads encrypted media bytes from an XChat conversation. The response body contains raw binary bytes. A media item too large to return in one response fails with a 413 problem of type https://api.x.com/2/problems/response-too-large, and a retry fails the same way.
GET
/
2
/
chat
/
media
/
{id}
/
{media_hash_key}
xurl
xurl /2/chat/media/1895000000000000000/exampleimport os
from xdk import Client
client = Client(access_token=os.environ["X_ACCESS_TOKEN"])
response = client.chat.media_download(id="1895000000000000000", media_hash_key="example")
print(response)import { Client } from "@xdevplatform/xdk";
const client = new Client({ accessToken: process.env.X_ACCESS_TOKEN });
const response = await client.chat.mediaDownload("1895000000000000000", "example");
console.log(response);import com.x.xdk.XClient;
XClient client = XClient.builder()
.accessToken(System.getenv("X_ACCESS_TOKEN"))
.build();
var response = client.chat().mediaDownload("1895000000000000000", "example");
System.out.println(response);using System;
using Xdk;
using var client = new XClient(new XClientOptions
{
AccessToken = Environment.GetEnvironmentVariable("X_ACCESS_TOKEN"),
});
var response = await client.Chat.MediaDownloadAsync("1895000000000000000", "example");
Console.WriteLine(response);"<string>"{
"code": 123,
"message": "<string>"
}Authorizations
OAuth2UserTokenUserToken
Path Parameters
Response
The request has succeeded.
The response is of type file.
⌘I
xurl
xurl /2/chat/media/1895000000000000000/exampleimport os
from xdk import Client
client = Client(access_token=os.environ["X_ACCESS_TOKEN"])
response = client.chat.media_download(id="1895000000000000000", media_hash_key="example")
print(response)import { Client } from "@xdevplatform/xdk";
const client = new Client({ accessToken: process.env.X_ACCESS_TOKEN });
const response = await client.chat.mediaDownload("1895000000000000000", "example");
console.log(response);import com.x.xdk.XClient;
XClient client = XClient.builder()
.accessToken(System.getenv("X_ACCESS_TOKEN"))
.build();
var response = client.chat().mediaDownload("1895000000000000000", "example");
System.out.println(response);using System;
using Xdk;
using var client = new XClient(new XClientOptions
{
AccessToken = Environment.GetEnvironmentVariable("X_ACCESS_TOKEN"),
});
var response = await client.Chat.MediaDownloadAsync("1895000000000000000", "example");
Console.WriteLine(response);"<string>"{
"code": 123,
"message": "<string>"
}