Get Template Run
GET https://api.elevenlabs.io/v1/flows/templates//runs/
Retrieve a template run: its status, rolled up from its outputs, and each output's own status and download URL once completed.
Reference: https://elevenlabs.io/docs/api-reference/flows/templates/runs/get
Servers
https://api.elevenlabs.io(Production, default)https://api.us.elevenlabs.io(Production US)https://api.eu.residency.elevenlabs.io(Production EU)https://api.in.residency.elevenlabs.io(Production India)https://api.sg.residency.elevenlabs.io(Production Singapore)
Request
Path parameters
Section titled “Path parameters”template_id(string, required) — The ID of the template, as shown in the ElevenLabs app or byGET /v1/flows/templates.run_id(string, required)
Response
Section titled “Response”200
Successful Response
id(string, required) — The unique identifier of the run.template_id(string, required) — The template this run executed, so a webhook consumer running several templates can tell their runs apart without keeping a run-to-template map.version_id(string, required) — The template version this run executed. Resolved when the run is created, so a run started withlatestrecords the concrete version it ran.status(enum, required) — The run's status, rolled up from its outputs:pendinguntil an output starts,generatingwhile any output is unfinished,completedonce every output has completed, andfailedonce every output has finished and at least one failed.completedandfailedare terminal: theflows_template_runwebhook fires once the run reaches either.- Allowed values:
pending,generating,completed,failed
- Allowed values:
outputs(map from string to TemplateOutput, required) — The run's outputs, keyed by output port id. Each is aTemplateOutputdiscriminated ontype, thetypeof its port'scontent_schema.
Errors
Section titled “Errors”422 Unprocessable Entity Error
Section titled “422 Unprocessable Entity Error”Validation Error
detail(list of ValidationError, optional)
Types
TemplateOutput
Section titled “TemplateOutput”One output of a template run, discriminated on type: the type of the port's content_schema. Check status for where it is in its lifecycle.
type:array(TemplateArrayOutput)has_more(boolean, required) — Whether the list has elements beyondcontent.id(string, required) — The id of the generation behind this output. Pass it as agenerationreference to use the output as an input elsewhere.status(enum, required) — The lifecycle status of the output. It ends atcompleted, when the output's content fields are set, orfailed, whenfailure_reasonanderror_messageare set.- Allowed values:
pending,generating,completed,failed
- Allowed values:
content(list of TemplateOutput, optional, nullable) — The first elements of the list, in order, each following the shape of the schema'sitems. Present only whenstatusiscompleted. Whenhas_moreis true this is not the whole list. Reserved: no template produces this kind of output yet; it is published so that templates which do can be run with the same client.error_message(string, optional, nullable) — A human-readable description of the failure. Present only whenstatusisfailed. Failed generations are not charged.failure_reason(enum, optional, nullable) — The category of failure. Present only whenstatusisfailed.- Allowed values:
timeout,model_error,moderated,invalid_parameters,dependency_failed,charging_failed,internal_error
- Allowed values:
next_cursor(string, optional, nullable) — Pass ascursorto a later endpoint to fetch the elements aftercontent.nullwhencontentholds the whole list, or before the output completes. Reserved: no template produces this kind of output yet; it is published so that templates which do can be run with the same client.
type:audio(TemplateAudioOutput)id(string, required) — The id of the generation behind this output. Pass it as agenerationreference to use the output as an input elsewhere.status(enum, required) — The lifecycle status of the output. It ends atcompleted, when the output's content fields are set, orfailed, whenfailure_reasonanderror_messageare set.- Allowed values:
pending,generating,completed,failed
- Allowed values:
content_mime_type(string, optional, nullable) — The MIME type of the generated media. Present only whenstatusiscompleted.content_url(string, optional, nullable) — A signed URL to download the generated media from. Present only whenstatusiscompleted. It expires about an hour after this response is returned; fetch the run again for a fresh URL.error_message(string, optional, nullable) — A human-readable description of the failure. Present only whenstatusisfailed. Failed generations are not charged.failure_reason(enum, optional, nullable) — The category of failure. Present only whenstatusisfailed.- Allowed values:
timeout,model_error,moderated,invalid_parameters,dependency_failed,charging_failed,internal_error
- Allowed values:
type:boolean(TemplateBooleanOutput)id(string, required) — The id of the generation behind this output. Pass it as agenerationreference to use the output as an input elsewhere.status(enum, required) — The lifecycle status of the output. It ends atcompleted, when the output's content fields are set, orfailed, whenfailure_reasonanderror_messageare set.- Allowed values:
pending,generating,completed,failed
- Allowed values:
content(boolean, optional, nullable) — The generated boolean. Present only whenstatusiscompleted. Reserved: no template produces this kind of output yet; it is published so that templates which do can be run with the same client.error_message(string, optional, nullable) — A human-readable description of the failure. Present only whenstatusisfailed. Failed generations are not charged.failure_reason(enum, optional, nullable) — The category of failure. Present only whenstatusisfailed.- Allowed values:
timeout,model_error,moderated,invalid_parameters,dependency_failed,charging_failed,internal_error
- Allowed values:
type:image(TemplateImageOutput)id(string, required) — The id of the generation behind this output. Pass it as agenerationreference to use the output as an input elsewhere.status(enum, required) — The lifecycle status of the output. It ends atcompleted, when the output's content fields are set, orfailed, whenfailure_reasonanderror_messageare set.- Allowed values:
pending,generating,completed,failed
- Allowed values:
content_mime_type(string, optional, nullable) — The MIME type of the generated media. Present only whenstatusiscompleted.content_url(string, optional, nullable) — A signed URL to download the generated media from. Present only whenstatusiscompleted. It expires about an hour after this response is returned; fetch the run again for a fresh URL.error_message(string, optional, nullable) — A human-readable description of the failure. Present only whenstatusisfailed. Failed generations are not charged.failure_reason(enum, optional, nullable) — The category of failure. Present only whenstatusisfailed.- Allowed values:
timeout,model_error,moderated,invalid_parameters,dependency_failed,charging_failed,internal_error
- Allowed values:
type:integer(TemplateIntegerOutput)id(string, required) — The id of the generation behind this output. Pass it as agenerationreference to use the output as an input elsewhere.status(enum, required) — The lifecycle status of the output. It ends atcompleted, when the output's content fields are set, orfailed, whenfailure_reasonanderror_messageare set.- Allowed values:
pending,generating,completed,failed
- Allowed values:
content(integer, optional, nullable) — The generated integer. Present only whenstatusiscompleted. Reserved: no template produces this kind of output yet; it is published so that templates which do can be run with the same client.error_message(string, optional, nullable) — A human-readable description of the failure. Present only whenstatusisfailed. Failed generations are not charged.failure_reason(enum, optional, nullable) — The category of failure. Present only whenstatusisfailed.- Allowed values:
timeout,model_error,moderated,invalid_parameters,dependency_failed,charging_failed,internal_error
- Allowed values:
type:number(TemplateNumberOutput)id(string, required) — The id of the generation behind this output. Pass it as agenerationreference to use the output as an input elsewhere.status(enum, required) — The lifecycle status of the output. It ends atcompleted, when the output's content fields are set, orfailed, whenfailure_reasonanderror_messageare set.- Allowed values:
pending,generating,completed,failed
- Allowed values:
content(double, optional, nullable) — The generated number. Present only whenstatusiscompleted. Reserved: no template produces this kind of output yet; it is published so that templates which do can be run with the same client.error_message(string, optional, nullable) — A human-readable description of the failure. Present only whenstatusisfailed. Failed generations are not charged.failure_reason(enum, optional, nullable) — The category of failure. Present only whenstatusisfailed.- Allowed values:
timeout,model_error,moderated,invalid_parameters,dependency_failed,charging_failed,internal_error
- Allowed values:
type:object(TemplateObjectOutput)id(string, required) — The id of the generation behind this output. Pass it as agenerationreference to use the output as an input elsewhere.status(enum, required) — The lifecycle status of the output. It ends atcompleted, when the output's content fields are set, orfailed, whenfailure_reasonanderror_messageare set.- Allowed values:
pending,generating,completed,failed
- Allowed values:
content(map from string to TemplateOutput, optional, nullable) — One output per field, keyed by field name, each following the shape of that field's schema. Present only whenstatusiscompleted. Reserved: no template produces this kind of output yet; it is published so that templates which do can be run with the same client.error_message(string, optional, nullable) — A human-readable description of the failure. Present only whenstatusisfailed. Failed generations are not charged.failure_reason(enum, optional, nullable) — The category of failure. Present only whenstatusisfailed.- Allowed values:
timeout,model_error,moderated,invalid_parameters,dependency_failed,charging_failed,internal_error
- Allowed values:
type:string(TemplateStringOutput)id(string, required) — The id of the generation behind this output. Pass it as agenerationreference to use the output as an input elsewhere.status(enum, required) — The lifecycle status of the output. It ends atcompleted, when the output's content fields are set, orfailed, whenfailure_reasonanderror_messageare set.- Allowed values:
pending,generating,completed,failed
- Allowed values:
content(string, optional, nullable) — The generated text. Present only whenstatusiscompleted.error_message(string, optional, nullable) — A human-readable description of the failure. Present only whenstatusisfailed. Failed generations are not charged.failure_reason(enum, optional, nullable) — The category of failure. Present only whenstatusisfailed.- Allowed values:
timeout,model_error,moderated,invalid_parameters,dependency_failed,charging_failed,internal_error
- Allowed values:
type:video(TemplateVideoOutput)id(string, required) — The id of the generation behind this output. Pass it as agenerationreference to use the output as an input elsewhere.status(enum, required) — The lifecycle status of the output. It ends atcompleted, when the output's content fields are set, orfailed, whenfailure_reasonanderror_messageare set.- Allowed values:
pending,generating,completed,failed
- Allowed values:
content_mime_type(string, optional, nullable) — The MIME type of the generated media. Present only whenstatusiscompleted.content_url(string, optional, nullable) — A signed URL to download the generated media from. Present only whenstatusiscompleted. It expires about an hour after this response is returned; fetch the run again for a fresh URL.error_message(string, optional, nullable) — A human-readable description of the failure. Present only whenstatusisfailed. Failed generations are not charged.failure_reason(enum, optional, nullable) — The category of failure. Present only whenstatusisfailed.- Allowed values:
timeout,model_error,moderated,invalid_parameters,dependency_failed,charging_failed,internal_error
- Allowed values:
ValidationError
loc(list of ValidationErrorLocItems, required)msg(string, required)type(string, required)
ValidationErrorLocItems
Examples
Response
{
"id": "sess_JWr5N6X9ZTqf8jD2LmQb",
"template_id": "tmpl_abc123",
"version_id": "ver_01hxyz",
"status": "generating",
"outputs": {
"marketing_title": {
"type": "string",
"id": "Kx2mP7Y4WVrg9kE3NnRc",
"status": "completed",
"content": "Ride the wave."
},
"product_demo": {
"type": "video",
"id": "QWr5N6X9ZTqf8jD2La3B",
"status": "generating"
},
"product_still": {
"type": "image",
"id": "JWr5N6X9ZTqf8jD2LmQb",
"status": "completed",
"content_mime_type": "image/png",
"content_url": "https://storage.googleapis.com/generations/JWr5N6X9ZTqf8jD2LmQb"
}
}
}SDK Code
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
async function main() {
const client = new ElevenLabsClient();
await client.flows.templates.runs.get("template_id", "run_id");
}
main();
from elevenlabs import ElevenLabs
client = ElevenLabs()
client.flows.templates.runs.get(
template_id="template_id",
run_id="run_id",
)
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.elevenlabs.io/v1/flows/templates/template_id/runs/run_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.elevenlabs.io/v1/flows/templates/template_id/runs/run_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyimport com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
HttpResponse<String> response = Unirest.get("https://api.elevenlabs.io/v1/flows/templates/template_id/runs/run_id")
.asString();<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://api.elevenlabs.io/v1/flows/templates/template_id/runs/run_id');
echo $response->getBody();using RestSharp;
var client = new RestClient("https://api.elevenlabs.io/v1/flows/templates/template_id/runs/run_id");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/flows/templates/template_id/runs/run_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()