---
title: "Edit asset"
method: POST
path: "/api/v1/tools/edit_asset"
---

# Edit asset

`POST /api/v1/tools/edit_asset`

## Request

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

Run pipeline nodes over ONE video, image, or audio file the account already has and get the edited file back: captions, an upscale, background removal, lipsync, a crop, an overlay, a cutaway, a thumbnail, a trim, or any other transform in list_node_types. To put music under a video, use assemble_video with musicPrompt instead. Operations run in order, each fed the output of the one before, so "caption it and upscale it" is one call with two operations; a Transcribe stage is added wherever an operation needs a transcript. Check a node's config and ports with get_node_type first. A setting the node does not define, or a value outside what it offers, is refused with the valid ones listed. The source, and any url given as an input, must come from list_assets or a run's outputs in get_run. Renders in the background and spends credits: poll get_run with the returned pipelineId and runId. The same edit asked for again within a few minutes returns the render already started (repeat: true) rather than charging for another; to render it a second time on purpose, pass a new requestId. Needs the pipelines:run and pipelines:write scopes.

## Request body

- object
  - `sourceUrl` string, required: The asset to edit, from list_assets or a run output.
  - `operations` object[], required: The nodes to run over the asset, in order.
    - `nodeType` string, required: A node type from list_node_types, spelled exactly, e.g. "captions", "video-upscale", "extract-clip".
    - `config` object: The node's config as get_node_type describes it. Omitted fields take the node's defaults.
    - `inputs` object: Extra input on a named port: an asset url, e.g. {"audio": "<url>"} for lipsync, or, for a port that takes words, the text itself, e.g. {"transcript": "Seven metres of wing."}. The asset being edited is wired for you.
  - `name` string: What to call the render, e.g. "Captioned short".
  - `requestId` string: Any id you choose for this one request. A call with an id that already started a render returns that render; a new id renders again even when everything else is identical.

## 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)
