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
| Name | Type | Description |
|---|---|---|
url | string | uri, 0 to 2048 characters |
data_base64 | string | 0 to 140000000 characters |
mime_type | string | 0 to 100 characters |
alt_text | string | 0 to 1500 characters |
idempotency_key | string | 8 to 128 characters |
Output
| Name | Type | Description |
|---|---|---|
media_id Required | string | — |
status Required | "uploading" | "processing" | "ready" | "rejected" | — |
kind Required | string | — |
width Required | integer | null | — |
height Required | integer | 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
UNAUTHENTICATEDINSUFFICIENT_SCOPERATE_LIMITEDINTERNALVALIDATION_FAILEDPOLICY_DENIEDSUBSCRIPTION_INACTIVEIDEMPOTENCY_CONFLICT
Rate limit
20 calls a minute per connection, and 300 a minute across all tools.