import_media
Upload media files to the library via direct URL (up to 200MB) or base64 data (up to 3MB) for attaching to social posts on TikTok, Instagram Reels, YouTube Shorts, and more.
Instructions
Import a file into the media library so it can be attached to posts. Two modes: (1) URL mode — pass url with an HTTPS direct-download link (up to 200MB; Dropbox and Canva share links supported via the matching source); (2) inline mode — pass data with base64-encoded bytes (3MB max before encoding) plus mimeType, with source='direct'. Exactly one of url or data must be provided. Returns the created library item including the id to use in create_post. For files over 3MB, always use URL mode.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | HTTPS direct-download URL of the file, up to 200MB. Mutually exclusive with `data`. | |
| data | No | Base64-encoded file bytes, 3MB maximum raw size. Mutually exclusive with `url`; requires `mimeType`. | |
| name | Yes | Display name for the library item, including the file extension (e.g. 'clip-01.mp4'). | |
| bytes | No | Optional declared file size in bytes, letting the API reject oversized files before downloading. | |
| source | Yes | Origin of the file: 'dropbox' or 'canva' when url is a share link from those services; 'direct' for base64 data or a generic HTTPS URL. | |
| mimeType | No | MIME type such as video/mp4 or image/png. Required with `data`; optional with `url` (detected from the download). |