# POST /v1/flows/templates/{template_id}/runs (ElevenLabs API)
Base URL: https://api.elevenlabs.io
Auth: xi-api-key: <ELEVENLABS_API_KEY>
Last verified: 2026-09-22

> Create Template Run

## Critical Gotchas
* Authentication uses the non-standard `xi-api-key` header, not `Authorization: Bearer`. Sending a Bearer token returns HTTP 401.
* Text-to-speech responses are raw binary audio, not JSON. Write the body to a file (`--output speech.mp3`) rather than parsing it.

## cURL
curl -X POST 'https://api.elevenlabs.io/v1/flows/templates/template-id/runs' \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"inputs":{"prompt":"a corgi on a surfboard","reference":{"asset_id":"5xM2KqOnZyce22SPZ9d4","type":"asset"}},"version_id":"latest"}'

## Parameters
| Name | In | Type | Required | Description |
| :--- | :--- | :--- | :--- | :--- |
| template_id | path | string | Yes | The ID of the template, as shown in t... |
| inputs | body | object | Yes | Input values keyed by input port id.... |
| version_id | body | string | No | The template snapshot to run. Pass a... |
Other params: webhook

## Response (200 OK)
{"id":"sess_JWr5N6X9ZTqf8jD2LmQb","outputs":{"marketing_title":{},"product_demo":{}}}

---
Need an API key? Get one at https://elevenlabs.io/app/sign-up