---
title: "Import media"
method: POST
path: "/api/v1/tools/import_media"
---

# Import media

`POST /api/v1/tools/import_media`

## Request

- Base URL: `https://www.trezalabs.com`
- URL: `https://www.trezalabs.com/api/v1/tools/import_media`
- Auth: HTTP bearer

Add an image, video or audio file to the account's media library, so assemble_video and edit_asset can use it: a file the user attached in this conversation (file, where the client passes attachments), a public https link to the file itself (url), or a local file uploaded through create_upload_url (url set to its mediaUrl). Returns the library url. Putting an attached logo in the corner of a video or a picture is this, then edit_asset on the video or picture with an overlay operation whose inputs.image is the returned url and whose config.position names the corner (a picture comes back a PNG). Images up to 25 MB, audio 100 MB, video 200 MB; the type is read from the file, and anything else (SVG, PDF, a web page) is refused. When the user attached a file you cannot pass on (you see it but have no file or link to give), ask them to drop it into their Treza library at https://www.trezalabs.com/chat/assets and find it with list_assets. Needs the pipelines:write scope. Spends no credits.

## Request body

- object
  - `file` object: A file the user attached in this conversation.
    - `download_url` string, required: Where the uploaded file can be downloaded.
    - `file_id` string, required: The id of the uploaded file.
    - `mime_type` string: Its type as uploaded.
    - `file_name` string: Its name as uploaded.
  - `url` string: A public https link to an image, video or audio file, when there is no attachment. Pass file or url, not both.
  - `name` string: What to call it in the library, e.g. "Logo"; list_assets query matches it. Defaults to the file name.

## Response `200`

The tool's result.

- object

## Other responses

- `400`: The arguments were refused. `error` says why.
- `401`: No API key, or one that is not valid.
- `402`: The credit balance does not cover this run.
- `403`: The API key lacks a permission this tool needs.
- `404`: No such tool, or the pipeline, run or asset is not on this account.
- `429`: Too many runs started or in progress. Wait, then try again.

---

[API](https://skmtc.dev/trezalabs/apis/treza-pipelines-api.md) · [All operations](https://skmtc.dev/trezalabs/apis/treza-pipelines-api/llms.txt) · [OpenAPI document](https://skmtc.dev/trezalabs/apis/treza-pipelines-api/revisions/a76574c1731b?raw)
