メインコンテンツへスキップ
POST
/
2
/
media
/
upload
/
initialize
メディアアップロードを初期化
curl --request POST \
  --url https://api.x.com/2/media/upload/initialize \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "additional_owners": [
    "2244994945"
  ],
  "media_category": "tweet_video",
  "media_type": "video/mp4",
  "shared": true,
  "total_bytes": 8589934592
}
'
{
  "data": {
    "id": "1146654567674912769",
    "media_key": "<string>",
    "expires_after_secs": 123,
    "processing_info": {
      "check_after_secs": 123,
      "progress_percent": 123
    },
    "size": 123
  },
  "errors": [
    {
      "title": "<string>",
      "type": "<string>",
      "detail": "<string>",
      "status": 123
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://generaltranslation.mintlify.app/llms.txt

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

承認

Authorization
string
header
必須

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

ボディ

application/json
additional_owners
string[]

このユーザーの一意の識別子。大きな整数値を扱えない言語やツールとの互換性の問題を避けるため、文字列として返されます。

Pattern: ^[0-9]{1,19}$
media_category
enum<string>

メディアのユースケースを識別する文字列の列挙型値。この識別子は、ユースケース固有の制約(例:ファイルサイズ、動画時間)を適用し、高度な機能を有効にするために使用されます。

利用可能なオプション:
amplify_video,
tweet_gif,
tweet_image,
tweet_video,
dm_gif,
dm_image,
dm_video,
subtitles
:

"tweet_video"

media_type
enum<string>

メディアタイプ。

利用可能なオプション:
video/mp4,
video/webm,
video/mp2t,
video/quicktime,
text/srt,
text/vtt,
image/jpeg,
image/gif,
image/bmp,
image/png,
image/webp,
image/pjpeg,
image/tiff,
model/gltf-binary,
model/vnd.usdz+zip
:

"video/mp4"

shared
boolean

このメディアが共有されているかどうか。

total_bytes
integer

メディアアップロードの合計サイズ(バイト単位)。

必須範囲: 0 <= x <= 17179869184

レスポンス

リクエストは成功しました。

メディアアップロードリクエストのステータス取得に対するレスポンス。

data
object
errors
object[]
Minimum array length: 1

IETF RFC 7807 (https://tools.ietf.org/html/rfc7807) で定義された HTTP Problem Details オブジェクト。