One-shot import of a public image or MP4 video URL
POST/media/upload-from-url
Fetches the URL server-side and stores it — no presign/PUT/complete dance.
Images (JPEG/PNG/GIF/WebP/HEIC/HEIF, max 25 MB) import
synchronously: the response media_id is ready immediately.
Videos (MP4 only, max 500 MB) import ASYNCHRONOUSLY: the response
returns instantly with media_status: "uploading" while the file
streams in server-side. Poll GET /media/{id} until media_status
is ready (typically seconds), then attach via media_ids. If it
becomes failed, the poll response's error_message states exactly
why (too large, not actually an MP4, storage quota, source URL died).
Oversize videos with a Content-Length return 413 up front; storage
quota returns 403 storage_quota_exceeded.
30 s fetch timeout to first byte, SSRF-guarded including redirects
(no localhost/private addresses, 400 invalid_url). Unreachable or
slow URLs return 502/504 fetch_failed. Consumes the media
upload quota.
Request
Responses
- 200
- 400
- 401
- 402
- 403
- 413
- 415
- 429
- 500
- 502
- 504
Imported. Images return media_status "ready"; videos return "uploading" — poll GET /media/{id} until ready before attaching.
Validation error — see error.code and error.details
Missing/invalid/revoked/expired API key (codes invalid_api_key, api_key_revoked, api_key_expired, api_key_required, auth_failed). Auth-layer 401s omit error.retryable and meta.request_id.
No active subscription (code subscription_required — the error object also carries subscription_status), or insufficient AI credits (insufficient_credits) / paid plan required (upgrade_required).
API key missing the required scope (insufficient_scope), storage quota exceeded (storage_quota_exceeded), or account limit reached (account_limit_reached)
Downloaded file exceeds 25 MB
Video URL — use the 3-step upload flow instead
Rate limit exceeded (rate_limit_exceeded, or plan budgets post_limit_reached / daily_limit_reached on schedulePost). All 429s carry Retry-After. The API-key limiter additionally sets the X-RateLimit-* headers and error.details {limit, remaining, reset_at}.
Response Headers
Seconds to wait before retrying
Requests allowed in the window (API-key limiter only)
Requests remaining (API-key limiter only)
Unix seconds when the window resets (API-key limiter only)
Internal error (internal_error and endpoint-specific 5xx codes). Retryable.
Source URL unreachable or upstream image service unavailable
Source URL timed out (over 30 s)