Skip to main content
POST
/
2
/
chat
/
media
/
upload
/
initialize
Initialize Chat Media Upload
curl --request POST \
  --url https://api.x.com/2/chat/media/upload/initialize \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "conversation_id": "1603419216513746946:1603419216513746946",
  "total_bytes": 1
}
'
{
  "data": {
    "conversation_id": "1603419216513746946:1603419216513746946",
    "media_hash_key": "rByqeHiVlD",
    "session_id": "735401"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.x.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json

Request body for initializing a Chat media upload.

conversation_id
string

XChat conversation identifier for the upload.

Example:

"1603419216513746946:1603419216513746946"

total_bytes
integer

Total size of the media upload in bytes.

Required range: x >= 0

Response

The request has succeeded.

Response from initializing a Chat media upload.

data
object