import_media

Changes state

Imports an image or video from an https URL, or from base64 data with its MIME type, for use in posts. Returns while it is processing; posts can use it once ready.

Permission

Scope posts:write: Create and edit drafts, and upload media. Allowed in every mode. Changing an approved post sends it back for approval.

Input

Input
NameTypeDescription
urlstringuri, 0 to 2048 characters
data_base64string0 to 140000000 characters
mime_typestring0 to 100 characters
alt_textstring0 to 1500 characters
idempotency_keystring8 to 128 characters

Output

Output
NameTypeDescription
media_id Requiredstring—
status Required"uploading" | "processing" | "ready" | "rejected"—
kind Requiredstring—
width Requiredinteger | null—
height Requiredinteger | null—

Example

Request

{
  "url": "https://example.com/launch.png",
  "alt_text": "The Lumen 2.0 app on a phone and a laptop"
}

Response

{
  "media_id": "med_…",
  "status": "processing",
  "kind": "image",
  "width": null,
  "height": null
}

Errors

Rate limit

20 calls a minute per connection, and 300 a minute across all tools.

Related tools