> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# टेम्पलेट रन बनाएं

POST https://api.elevenlabs.io/v1/flows/templates/{template_id}/runs
Content-Type: application/json

फ़्लोज़ टेम्प्लेट का रन शुरू करें। किसी स्नैपशॉट को पिन करने के लिए `version_id` दें या नवीनतम प्रकाशित वर्शन चलाने के लिए इसे छोड़ दें / `latest` दें। इनपुट पोर्ट ID के आधार पर `inputs` में इनपुट वैल्यू सेट करें। रिस्पॉन्स में रन अपनी शुरुआती स्थिति में होगा और हर आउटपुट पहले से `outputs` में उसकी पोर्ट ID के अंतर्गत सूचीबद्ध होगा। रन पूरा होने पर, जब उसका `status` `completed` या `failed` हो, तब `flows_template_run` इवेंट पाने के लिए `webhook` शामिल करें; इंतज़ार करने का यही सुझाया गया तरीका है। इसके बिना, `status` टर्मिनल होने तक सामान्य अंतराल पर `GET /v1/flows/templates/{template_id}/runs/{run_id}` फ़ेच करें।

Reference: https://elevenlabs.io/docs/api-reference/flows/templates/runs/create

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

- `template_id` (string, required) — टेम्प्लेट की ID, जैसा ElevenLabs ऐप में या `GET /v1/flows/templates` द्वारा दिखाया गया है।

### Body (application/json)

This endpoint expects a TemplateRunCreateRequest.

- `inputs` (map from string to TemplateRunInput, required) — इनपुट port id के अनुसार इनपुट मान। चलाए जा रहे वर्ज़न का हर इनपुट port देना ज़रूरी है; अनुपस्थित या अज्ञात id अस्वीकार कर दी जाती है। बिना इनपुट वाले टेम्पलेट के लिए `{}` दें।
- `version_id` (string, optional, nullable) — चलाने के लिए टेम्पलेट स्नैपशॉट। उस स्नैपशॉट को पिन करने के लिए कोई विशेष वर्ज़न id दें, या टेम्पलेट का सबसे हाल में प्रकाशित वर्ज़न चलाने के लिए `latest` दें (छोड़े जाने पर डिफ़ॉल्ट)। केवल प्रकाशित वर्ज़न पिन किए जा सकते हैं, सिवाय टेम्पलेट के मालिक के, जो प्रकाशित करने से पहले आज़माने के लिए किसी अप्रकाशित सेव किए गए स्नैपशॉट को भी पिन कर सकता है। लाइव ड्राफ़्ट कभी भी इस API के ज़रिए नहीं चलाया जाता।
- `webhook` (WebhookTarget, optional, nullable) — जब run का `status` `completed` या `failed` हो जाए, तो उसका परिणाम workspace के कॉन्फ़िगर किए गए flows webhooks पर भेजने के लिए शामिल करें। पूरे run के लिए एक इवेंट: `flows_template_run` इवेंट का `data`, `GET /v1/flows/templates/{template_id}/runs/{run_id}` के अंतिम रिस्पॉन्स से मेल खाता है।

## Response

### 200

सफल रिस्पॉन्स

- `id` (string, required) — रन का यूनीक आइडेंटिफ़ायर।
- `template_id` (string, required) — वह टेम्पलेट जिसे इस रन ने चलाया, ताकि कई टेम्पलेट चलाने वाला वेबहुक कंज़्यूमर रन-टू-टेम्पलेट मैप रखे बिना उनके रनों में अंतर कर सके।
- `version_id` (string, required) — वह टेम्पलेट वर्ज़न जिसे इस रन ने चलाया। रन बनते समय इसका समाधान हो जाता है, इसलिए `latest` से शुरू किया गया रन उस वास्तविक वर्ज़न को रिकॉर्ड करता है जो उसने चलाया।
- `status` (enum, required) — रन का स्टेटस, जो उसके आउटपुट्स से समेकित होता है: आउटपुट शुरू होने तक `pending`, कोई आउटपुट अधूरा होने तक `generating`, सभी आउटपुट पूरे होने पर `completed`, और सभी आउटपुट समाप्त होने व कम से कम एक के विफल होने पर `failed`। `completed` और `failed` अंतिम स्टेटस हैं: रन के इनमें से किसी एक तक पहुंचने पर `flows_template_run` वेबहुक ट्रिगर होता है।
  - Allowed values: `pending`, `generating`, `completed`, `failed`
- `outputs` (map from string to TemplateOutput, required) — The run's outputs, keyed by output port id. Each is a `TemplateOutput` discriminated on `type`, the `type` of its port's `content_schema`.

## Errors

### 422 Unprocessable Entity Error

वैलिडेशन एरर

- `detail` (list of ValidationError, optional)

## Types

### TemplateRunInput

template input port से बंधा एक मान, उस स्वरूप में जिसकी उसके `content_schema` को आवश्यकता है। `string` port स्वयं text लेता है; `number`, `integer` और `boolean` ports उस प्रकार का JSON मान लेते हैं। कहीं और संग्रहीत कोई भी चीज़ `type` के आधार पर अलग किया गया reference है: पिछली `generation`, अपलोड किया गया `asset`, `voice`, या `inline_base64` से भेजा गया media। `array` port, schema के `items` के लिए स्वीकार्य हर element का एक मान रखने वाला JSON array लेता है। `object` ports को अभी इस API के ज़रिए bind नहीं किया जा सकता। यहां wire shape के अलावा कोई constraints नहीं हैं: कोई port क्या स्वीकार करता है (`enum`, लंबाई), यह उसके `content_schema` में बताया जाता है और run path उसी schema के अनुसार validation करता है।

### WebhookTarget

- `type`: `all` (WebhookTargetAll)
- `type`: `ids` (WebhookTargetIds)
  - `ids` (list of string, required) — नतीजा भेजने के लिए workspace flows webhooks के ID। हर ID workspace के कॉन्फ़िगर किए गए flows webhooks में से एक होना चाहिए।

### TemplateOutput

template run का एक output, `type` के आधार पर अलग किया गया: port के `content_schema` का `type`। इसके lifecycle में इसकी स्थिति जानने के लिए `status` देखें।

- `type`: `array` (TemplateArrayOutput)
  - `has_more` (boolean, required) — क्या सूची में `content` के अलावा और elements हैं।
  - `id` (string, required) — इस आउटपुट के पीछे की जनरेशन की id। आउटपुट को कहीं और इनपुट के रूप में इस्तेमाल करने के लिए इसे `generation` रेफ़रेंस के रूप में पास करें।
  - `status` (enum, required) — आउटपुट की लाइफ़साइकल स्थिति। जब आउटपुट के कॉन्टेंट फ़ील्ड सेट होते हैं, तब यह `completed` पर समाप्त होती है; या जब `failure_reason` और `error_message` सेट होते हैं, तब `failed` पर।
    - Allowed values: `pending`, `generating`, `completed`, `failed`
  - `content` (list of TemplateOutput, optional, nullable) — सूची के शुरुआती एलिमेंट, क्रम में; हर एक schema के `items` के आकार का पालन करता है। केवल तब मौजूद होता है, जब `status` `completed` हो। `has_more` true होने पर यह पूरी सूची नहीं है। आरक्षित: अभी कोई टेम्प्लेट इस प्रकार का आउटपुट नहीं बनाता; इसे प्रकाशित किया गया है ताकि ऐसा करने वाले टेम्प्लेट एक ही क्लाइंट के साथ चलाए जा सकें।
  - `error_message` (string, optional, nullable) — विफलता का इंसानों के पढ़ने योग्य विवरण। केवल तब मौजूद होता है जब `status` `failed` हो। विफल जनरेशन के लिए शुल्क नहीं लिया जाता।
  - `failure_reason` (enum, optional, nullable) — विफलता की कैटेगरी। यह केवल तब मौजूद होती है जब `status`, `failed` हो।
    - Allowed values: `timeout`, `model_error`, `moderated`, `invalid_parameters`, `dependency_failed`, `charging_failed`, `internal_error`
  - `next_cursor` (string, optional, nullable) — `content` के बाद के elements पाने के लिए बाद के endpoint में `cursor` के रूप में पास करें। जब `content` में पूरी सूची हो या output पूरा होने से पहले, तो `null`। आरक्षित: अभी कोई template ऐसा output नहीं बनाता; इसे इसलिए प्रकाशित किया गया है ताकि भविष्य में ऐसे templates को उसी client के साथ चलाया जा सके।
- `type`: `audio` (TemplateAudioOutput)
  - `id` (string, required) — इस आउटपुट के पीछे की जनरेशन की id। आउटपुट को कहीं और इनपुट के रूप में इस्तेमाल करने के लिए इसे `generation` रेफ़रेंस के रूप में पास करें।
  - `status` (enum, required) — आउटपुट की लाइफ़साइकल स्थिति। जब आउटपुट के कॉन्टेंट फ़ील्ड सेट होते हैं, तब यह `completed` पर समाप्त होती है; या जब `failure_reason` और `error_message` सेट होते हैं, तब `failed` पर।
    - Allowed values: `pending`, `generating`, `completed`, `failed`
  - `content_mime_type` (string, optional, nullable) — जनरेट किए गए मीडिया का MIME प्रकार। केवल `status` के `completed` होने पर मौजूद होता है।
  - `content_url` (string, optional, nullable) — जनरेट किया गया मीडिया डाउनलोड करने के लिए एक साइन किया हुआ URL। यह केवल तब मौजूद होता है जब `status`, `completed` हो। यह जवाब लौटने के लगभग एक घंटे बाद समाप्त हो जाता है; नया URL पाने के लिए रन को फिर से फ़ेच करें।
  - `error_message` (string, optional, nullable) — विफलता का इंसानों के पढ़ने योग्य विवरण। केवल तब मौजूद होता है जब `status` `failed` हो। विफल जनरेशन के लिए शुल्क नहीं लिया जाता।
  - `failure_reason` (enum, optional, nullable) — विफलता की कैटेगरी। यह केवल तब मौजूद होती है जब `status`, `failed` हो।
    - Allowed values: `timeout`, `model_error`, `moderated`, `invalid_parameters`, `dependency_failed`, `charging_failed`, `internal_error`
- `type`: `boolean` (TemplateBooleanOutput)
  - `id` (string, required) — इस आउटपुट के पीछे की जनरेशन की id। आउटपुट को कहीं और इनपुट के रूप में इस्तेमाल करने के लिए इसे `generation` रेफ़रेंस के रूप में पास करें।
  - `status` (enum, required) — आउटपुट की लाइफ़साइकल स्थिति। जब आउटपुट के कॉन्टेंट फ़ील्ड सेट होते हैं, तब यह `completed` पर समाप्त होती है; या जब `failure_reason` और `error_message` सेट होते हैं, तब `failed` पर।
    - Allowed values: `pending`, `generating`, `completed`, `failed`
  - `content` (boolean, optional, nullable) — जनरेट किया गया boolean। केवल तब मौजूद होता है, जब `status` `completed` हो। आरक्षित: अभी कोई टेम्प्लेट इस प्रकार का आउटपुट नहीं बनाता; इसे प्रकाशित किया गया है ताकि ऐसा करने वाले टेम्प्लेट एक ही क्लाइंट के साथ चलाए जा सकें।
  - `error_message` (string, optional, nullable) — विफलता का इंसानों के पढ़ने योग्य विवरण। केवल तब मौजूद होता है जब `status` `failed` हो। विफल जनरेशन के लिए शुल्क नहीं लिया जाता।
  - `failure_reason` (enum, optional, nullable) — विफलता की कैटेगरी। यह केवल तब मौजूद होती है जब `status`, `failed` हो।
    - Allowed values: `timeout`, `model_error`, `moderated`, `invalid_parameters`, `dependency_failed`, `charging_failed`, `internal_error`
- `type`: `image` (TemplateImageOutput)
  - `id` (string, required) — इस आउटपुट के पीछे की जनरेशन की id। आउटपुट को कहीं और इनपुट के रूप में इस्तेमाल करने के लिए इसे `generation` रेफ़रेंस के रूप में पास करें।
  - `status` (enum, required) — आउटपुट की लाइफ़साइकल स्थिति। जब आउटपुट के कॉन्टेंट फ़ील्ड सेट होते हैं, तब यह `completed` पर समाप्त होती है; या जब `failure_reason` और `error_message` सेट होते हैं, तब `failed` पर।
    - Allowed values: `pending`, `generating`, `completed`, `failed`
  - `content_mime_type` (string, optional, nullable) — जनरेट किए गए मीडिया का MIME प्रकार। केवल `status` के `completed` होने पर मौजूद होता है।
  - `content_url` (string, optional, nullable) — जनरेट किया गया मीडिया डाउनलोड करने के लिए एक साइन किया हुआ URL। यह केवल तब मौजूद होता है जब `status`, `completed` हो। यह जवाब लौटने के लगभग एक घंटे बाद समाप्त हो जाता है; नया URL पाने के लिए रन को फिर से फ़ेच करें।
  - `error_message` (string, optional, nullable) — विफलता का इंसानों के पढ़ने योग्य विवरण। केवल तब मौजूद होता है जब `status` `failed` हो। विफल जनरेशन के लिए शुल्क नहीं लिया जाता।
  - `failure_reason` (enum, optional, nullable) — विफलता की कैटेगरी। यह केवल तब मौजूद होती है जब `status`, `failed` हो।
    - Allowed values: `timeout`, `model_error`, `moderated`, `invalid_parameters`, `dependency_failed`, `charging_failed`, `internal_error`
- `type`: `integer` (TemplateIntegerOutput)
  - `id` (string, required) — इस आउटपुट के पीछे की जनरेशन की id। आउटपुट को कहीं और इनपुट के रूप में इस्तेमाल करने के लिए इसे `generation` रेफ़रेंस के रूप में पास करें।
  - `status` (enum, required) — आउटपुट की लाइफ़साइकल स्थिति। जब आउटपुट के कॉन्टेंट फ़ील्ड सेट होते हैं, तब यह `completed` पर समाप्त होती है; या जब `failure_reason` और `error_message` सेट होते हैं, तब `failed` पर।
    - Allowed values: `pending`, `generating`, `completed`, `failed`
  - `content` (integer, optional, nullable) — जनरेट किया गया integer। केवल तब मौजूद होता है, जब `status` `completed` हो। आरक्षित: अभी कोई टेम्प्लेट इस प्रकार का आउटपुट नहीं बनाता; इसे प्रकाशित किया गया है ताकि ऐसा करने वाले टेम्प्लेट एक ही क्लाइंट के साथ चलाए जा सकें।
  - `error_message` (string, optional, nullable) — विफलता का इंसानों के पढ़ने योग्य विवरण। केवल तब मौजूद होता है जब `status` `failed` हो। विफल जनरेशन के लिए शुल्क नहीं लिया जाता।
  - `failure_reason` (enum, optional, nullable) — विफलता की कैटेगरी। यह केवल तब मौजूद होती है जब `status`, `failed` हो।
    - Allowed values: `timeout`, `model_error`, `moderated`, `invalid_parameters`, `dependency_failed`, `charging_failed`, `internal_error`
- `type`: `number` (TemplateNumberOutput)
  - `id` (string, required) — इस आउटपुट के पीछे की जनरेशन की id। आउटपुट को कहीं और इनपुट के रूप में इस्तेमाल करने के लिए इसे `generation` रेफ़रेंस के रूप में पास करें।
  - `status` (enum, required) — आउटपुट की लाइफ़साइकल स्थिति। जब आउटपुट के कॉन्टेंट फ़ील्ड सेट होते हैं, तब यह `completed` पर समाप्त होती है; या जब `failure_reason` और `error_message` सेट होते हैं, तब `failed` पर।
    - Allowed values: `pending`, `generating`, `completed`, `failed`
  - `content` (double, optional, nullable) — जनरेट किया गया number। केवल तब मौजूद होता है, जब `status` `completed` हो। आरक्षित: अभी कोई टेम्प्लेट इस प्रकार का आउटपुट नहीं बनाता; इसे प्रकाशित किया गया है ताकि ऐसा करने वाले टेम्प्लेट एक ही क्लाइंट के साथ चलाए जा सकें।
  - `error_message` (string, optional, nullable) — विफलता का इंसानों के पढ़ने योग्य विवरण। केवल तब मौजूद होता है जब `status` `failed` हो। विफल जनरेशन के लिए शुल्क नहीं लिया जाता।
  - `failure_reason` (enum, optional, nullable) — विफलता की कैटेगरी। यह केवल तब मौजूद होती है जब `status`, `failed` हो।
    - Allowed values: `timeout`, `model_error`, `moderated`, `invalid_parameters`, `dependency_failed`, `charging_failed`, `internal_error`
- `type`: `object` (TemplateObjectOutput)
  - `id` (string, required) — इस आउटपुट के पीछे की जनरेशन की id। आउटपुट को कहीं और इनपुट के रूप में इस्तेमाल करने के लिए इसे `generation` रेफ़रेंस के रूप में पास करें।
  - `status` (enum, required) — आउटपुट की लाइफ़साइकल स्थिति। जब आउटपुट के कॉन्टेंट फ़ील्ड सेट होते हैं, तब यह `completed` पर समाप्त होती है; या जब `failure_reason` और `error_message` सेट होते हैं, तब `failed` पर।
    - Allowed values: `pending`, `generating`, `completed`, `failed`
  - `content` (map from string to TemplateOutput, optional, nullable) — हर field के लिए एक output, field name के आधार पर key किया गया, और हर output उस field के schema के स्वरूप का अनुसरण करता है। केवल `status` के `completed` होने पर मौजूद होता है। आरक्षित: अभी कोई template इस तरह का output नहीं बनाता; इसे प्रकाशित किया गया है ताकि ऐसा करने वाले templates को उसी client से चलाया जा सके।
  - `error_message` (string, optional, nullable) — विफलता का इंसानों के पढ़ने योग्य विवरण। केवल तब मौजूद होता है जब `status` `failed` हो। विफल जनरेशन के लिए शुल्क नहीं लिया जाता।
  - `failure_reason` (enum, optional, nullable) — विफलता की कैटेगरी। यह केवल तब मौजूद होती है जब `status`, `failed` हो।
    - Allowed values: `timeout`, `model_error`, `moderated`, `invalid_parameters`, `dependency_failed`, `charging_failed`, `internal_error`
- `type`: `string` (TemplateStringOutput)
  - `id` (string, required) — इस आउटपुट के पीछे की जनरेशन की id। आउटपुट को कहीं और इनपुट के रूप में इस्तेमाल करने के लिए इसे `generation` रेफ़रेंस के रूप में पास करें।
  - `status` (enum, required) — आउटपुट की लाइफ़साइकल स्थिति। जब आउटपुट के कॉन्टेंट फ़ील्ड सेट होते हैं, तब यह `completed` पर समाप्त होती है; या जब `failure_reason` और `error_message` सेट होते हैं, तब `failed` पर।
    - Allowed values: `pending`, `generating`, `completed`, `failed`
  - `content` (string, optional, nullable) — जनरेट किया गया टेक्स्ट। केवल तब मौजूद होता है, जब `status` `completed` हो।
  - `error_message` (string, optional, nullable) — विफलता का इंसानों के पढ़ने योग्य विवरण। केवल तब मौजूद होता है जब `status` `failed` हो। विफल जनरेशन के लिए शुल्क नहीं लिया जाता।
  - `failure_reason` (enum, optional, nullable) — विफलता की कैटेगरी। यह केवल तब मौजूद होती है जब `status`, `failed` हो।
    - Allowed values: `timeout`, `model_error`, `moderated`, `invalid_parameters`, `dependency_failed`, `charging_failed`, `internal_error`
- `type`: `video` (TemplateVideoOutput)
  - `id` (string, required) — इस आउटपुट के पीछे की जनरेशन की id। आउटपुट को कहीं और इनपुट के रूप में इस्तेमाल करने के लिए इसे `generation` रेफ़रेंस के रूप में पास करें।
  - `status` (enum, required) — आउटपुट की लाइफ़साइकल स्थिति। जब आउटपुट के कॉन्टेंट फ़ील्ड सेट होते हैं, तब यह `completed` पर समाप्त होती है; या जब `failure_reason` और `error_message` सेट होते हैं, तब `failed` पर।
    - Allowed values: `pending`, `generating`, `completed`, `failed`
  - `content_mime_type` (string, optional, nullable) — जनरेट किए गए मीडिया का MIME प्रकार। केवल `status` के `completed` होने पर मौजूद होता है।
  - `content_url` (string, optional, nullable) — जनरेट किया गया मीडिया डाउनलोड करने के लिए एक साइन किया हुआ URL। यह केवल तब मौजूद होता है जब `status`, `completed` हो। यह जवाब लौटने के लगभग एक घंटे बाद समाप्त हो जाता है; नया URL पाने के लिए रन को फिर से फ़ेच करें।
  - `error_message` (string, optional, nullable) — विफलता का इंसानों के पढ़ने योग्य विवरण। केवल तब मौजूद होता है जब `status` `failed` हो। विफल जनरेशन के लिए शुल्क नहीं लिया जाता।
  - `failure_reason` (enum, optional, nullable) — विफलता की कैटेगरी। यह केवल तब मौजूद होती है जब `status`, `failed` हो।
    - Allowed values: `timeout`, `model_error`, `moderated`, `invalid_parameters`, `dependency_failed`, `charging_failed`, `internal_error`

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItems

## Examples

**Request**

```json
{
  "inputs": {
    "prompt": "a corgi on a surfboard",
    "reference": {
      "asset_id": "5xM2KqOnZyce22SPZ9d4",
      "type": "asset"
    }
  },
  "version_id": "latest",
  "webhook": {
    "type": "all"
  }
}
```

**Response**

```json
{
  "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**

```python
import requests

url = "https://api.elevenlabs.io/v1/flows/templates/template_id/runs"

payload = {
    "inputs": {
        "prompt": "a corgi on a surfboard",
        "reference": {
            "asset_id": "5xM2KqOnZyce22SPZ9d4",
            "type": "asset"
        }
    },
    "version_id": "latest",
    "webhook": { "type": "all" }
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/flows/templates/template_id/runs';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"inputs":{"prompt":"a corgi on a surfboard","reference":{"asset_id":"5xM2KqOnZyce22SPZ9d4","type":"asset"}},"version_id":"latest","webhook":{"type":"all"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.elevenlabs.io/v1/flows/templates/template_id/runs"

	payload := strings.NewReader("{\n  \"inputs\": {\n    \"prompt\": \"a corgi on a surfboard\",\n    \"reference\": {\n      \"asset_id\": \"5xM2KqOnZyce22SPZ9d4\",\n      \"type\": \"asset\"\n    }\n  },\n  \"version_id\": \"latest\",\n  \"webhook\": {\n    \"type\": \"all\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.elevenlabs.io/v1/flows/templates/template_id/runs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"inputs\": {\n    \"prompt\": \"a corgi on a surfboard\",\n    \"reference\": {\n      \"asset_id\": \"5xM2KqOnZyce22SPZ9d4\",\n      \"type\": \"asset\"\n    }\n  },\n  \"version_id\": \"latest\",\n  \"webhook\": {\n    \"type\": \"all\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.elevenlabs.io/v1/flows/templates/template_id/runs")
  .header("Content-Type", "application/json")
  .body("{\n  \"inputs\": {\n    \"prompt\": \"a corgi on a surfboard\",\n    \"reference\": {\n      \"asset_id\": \"5xM2KqOnZyce22SPZ9d4\",\n      \"type\": \"asset\"\n    }\n  },\n  \"version_id\": \"latest\",\n  \"webhook\": {\n    \"type\": \"all\"\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.elevenlabs.io/v1/flows/templates/template_id/runs', [
  'body' => '{
  "inputs": {
    "prompt": "a corgi on a surfboard",
    "reference": {
      "asset_id": "5xM2KqOnZyce22SPZ9d4",
      "type": "asset"
    }
  },
  "version_id": "latest",
  "webhook": {
    "type": "all"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/flows/templates/template_id/runs");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"inputs\": {\n    \"prompt\": \"a corgi on a surfboard\",\n    \"reference\": {\n      \"asset_id\": \"5xM2KqOnZyce22SPZ9d4\",\n      \"type\": \"asset\"\n    }\n  },\n  \"version_id\": \"latest\",\n  \"webhook\": {\n    \"type\": \"all\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "inputs": [
    "prompt": "a corgi on a surfboard",
    "reference": [
      "asset_id": "5xM2KqOnZyce22SPZ9d4",
      "type": "asset"
    ]
  ],
  "version_id": "latest",
  "webhook": ["type": "all"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/flows/templates/template_id/runs")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```