# Video · assemble a template

`POST /v1/videos/edits/assemble` — Put the rendered shots of a several-shot template back into its clip — one clip, over the clip's own sound.

- Base URL: https://eroq.ai/v1
- Auth: `Authorization: Bearer eroq_sk_…` (create keys at https://eroq.ai/dashboard/keys)
- Credits: free

Free — the shots were billed. Render each shot of the template first (POST /v1/videos/edits with `source: "template:<id>:<n>"`), then send their job ids here in shot order, right away: the cut waits for shots still rendering. A shot you left out or that failed (refunded) plays as filmed; when every shot failed it answers `400 pieces_failed`.

Returns a job to poll like any render (GET /v1/videos/generations/{id}); the finished clip lands in your library. `voice: "female"` lays it over the clip's female-voice version (the template's `voices.female`) — for a woman cast in the man's part.

Answers `404 template_not_found` for a template without shots, `400 pieces_mismatch` when the number of pieces is not the number of shots, `404 piece_not_found` for a job that is not a video edit of your workspace, `400 private_piece` for a private render (never stored), `503 assembly_unavailable` when cutting is down.

## POST /v1/videos/edits/assemble

Put the rendered shots of a several-shot template back into its clip — one clip, over the clip's own sound.

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `template` | string | yes | The template's `id` (GET /v1/videos/templates), one with `shots`. |
| `pieces` | array | yes | The shots' edit job ids, in shot order — `null` for a shot you did not render. |
| `voice` | string | no | `female`: the clip's female-voice version under the cut. |
| `title` | string | no | The clip's title in your library — the template's name by default. |

### Example request

```bash
curl https://eroq.ai/v1/videos/edits/assemble \
  -H "Authorization: Bearer $EROQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "template": "gta-goodbye",
  "pieces": [
    "8f3c2a10-…",
    "0b7e91d4-…",
    "c41f6a77-…"
  ],
  "voice": "female",
  "title": "Goodbye GTA with Mara"
}'
```

```javascript
const res = await fetch('https://eroq.ai/v1/videos/edits/assemble', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.EROQ_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "template": "gta-goodbye",
    "pieces": [
      "8f3c2a10-…",
      "0b7e91d4-…",
      "c41f6a77-…"
    ],
    "voice": "female",
    "title": "Goodbye GTA with Mara"
  }),
})
console.log(await res.json())
```

```python
import os, requests

res = requests.post(
    "https://eroq.ai/v1/videos/edits/assemble",
    headers={"Authorization": f"Bearer {os.environ['EROQ_API_KEY']}"},
    json={
        "template": "gta-goodbye",
        "pieces": [
            "8f3c2a10-…",
            "0b7e91d4-…",
            "c41f6a77-…"
        ],
        "voice": "female",
        "title": "Goodbye GTA with Mara"
    },
)
print(res.json())
```

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{
  "template": "gta-goodbye",
  "pieces": [
    "8f3c2a10-…",
    "0b7e91d4-…",
    "c41f6a77-…"
  ],
  "voice": "female",
  "title": "Goodbye GTA with Mara"
}`)

	req, _ := http.NewRequest("POST", "https://eroq.ai/v1/videos/edits/assemble", body)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("EROQ_API_KEY"))
	req.Header.Set("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	out, _ := io.ReadAll(res.Body)
	fmt.Println(string(out))
}
```

### Response


```json
{
  "id": "5d1e7b3a-…",
  "object": "video.edit",
  "created": 1794600000,
  "status": "processing",
  "model": "eroq-replace-pro",
  "duration": "22s",
  "poll": "/v1/videos/generations/5d1e7b3a-…",
  "usage": { "credits_spent": 0, "credits_remaining": 1840 }
}
```

---
Canonical: https://eroq.ai/docs/video-edit-assemble · Index for agents: https://eroq.ai/llms.txt · OpenAPI: https://eroq.ai/openapi.json
