Skip to main content
GET
/
2
/
media
Get Media by media keys
curl --request GET \
  --url https://api.x.com/2/media \
  --header 'Authorization: Bearer <token>'
{
  "data": [
    {
      "type": "<string>",
      "preview_image_url": "<string>",
      "variants": [
        {
          "bit_rate": 123,
          "content_type": "<string>",
          "url": "<string>"
        }
      ],
      "height": 1,
      "media_key": "<string>",
      "width": 1
    }
  ],
  "errors": [
    {
      "title": "<string>",
      "type": "<string>",
      "detail": "<string>",
      "status": 123
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

media_keys
string[]
required

A comma separated list of Media Keys. Up to 100 are allowed in a single request.

Required array length: 1 - 100 elements

The Media Key identifier for this attachment.

media.fields
enum<string>[]

A comma separated list of Media fields to display. The fields available for a Media object.

Minimum array length: 1
Available options:
alt_text,
duration_ms,
height,
media_key,
non_public_metrics,
organic_metrics,
preview_image_url,
promoted_metrics,
public_metrics,
type,
url,
variants,
width
Example:
[
  "alt_text",
  "duration_ms",
  "height",
  "media_key",
  "non_public_metrics",
  "organic_metrics",
  "preview_image_url",
  "promoted_metrics",
  "public_metrics",
  "type",
  "url",
  "variants",
  "width"
]

Response

The request has succeeded.

data
object[]
Minimum array length: 1
errors
object[]
Minimum array length: 1

An HTTP Problem Details object, as defined in IETF RFC 7807 (https://tools.ietf.org/html/rfc7807).