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

# Pobierz szablon

GET https://api.elevenlabs.io/v1/flows/templates/{template_id}

Pobierz jeden szablon flows wraz z wejściami i wyjściami każdej uruchamialnej wersji. `versions` jest puste, gdy żadna opublikowana wersja nie jest uruchamialna przez to API. Działa dla każdego szablonu, który możesz otworzyć, także udostępnionego ci linkiem lub opublikowanego w Explore z innego obszaru roboczego, których `GET /v1/flows/templates` nie wyświetla.

Reference: https://elevenlabs.io/docs/api-reference/flows/templates/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

- `template_id` (string, required) — ID szablonu, wyświetlane w aplikacji ElevenLabs lub przez `GET /v1/flows/templates`.

### Query parameters

- `versions_per_template` (integer, optional, default: 10) — Ile opublikowanych wersji każdego szablonu zwrócić, od najnowszych. `has_more_versions` wskazuje, czy szablon ma więcej wersji.

## Response

### 200

Pomyślna odpowiedź

- `id` (string, required) — Przekaż jako `template_id` w `POST /v1/flows/templates/{template_id}/runs`.
- `name` (string, required) — Nazwa szablonu.
- `versions` (list of TemplateVersion, required) — Opublikowane wersje, które wywołujący może uruchomić, od najnowszej. Pomijane są wersje, których graf używa modelu niedostępnego przez API, oraz te, których zapisany snapshot już nie istnieje; dlatego lista może być pusta, choć szablon nadal ma wersje możliwe do uruchomienia w aplikacji ElevenLabs.
- `has_more_versions` (boolean, required) — Czy ten szablon ma kolejne opublikowane wersje poza zwróconymi tutaj w `versions_per_template`. Aby zobaczyć więcej, pobierz `GET /v1/flows/templates/{template_id}` z większą wartością `versions_per_template`.
- `description` (string, optional, nullable) — Opis szablonu, jeśli jest dostępny.

## Errors

### 422 Unprocessable Entity Error

Błąd walidacji

- `detail` (list of ValidationError, optional)

## Types

### TemplateVersion

Opublikowany snapshot szablonu i porty, z których korzysta.

- `version_id` (string, required) — Przekaż jako `version_id` w `POST /v1/flows/templates/{template_id}/runs`, aby przypiąć uruchomienie do tego snapshotu.
- `published_at_unix` (integer, required) — Kiedy opublikowano tę wersję, jako znacznik czasu Unix w sekundach.
- `is_latest` (boolean, required) — Czy jest to wersja używana przez uruchomienie, gdy `version_id` pominięto lub ustawiono na `latest`.
- `inputs` (list of TemplatePort, required) — Dane wejściowe akceptowane przez tę wersję, w kolejności na kanwie. Każde są wymagane przy uruchomieniu.
- `outputs` (list of TemplatePort, required) — Dane wyjściowe tworzone przez tę wersję, w kolejności na kanwie.

### ValidationError

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

### TemplatePort

Jeden port wejściowy lub wyjściowy opublikowanej wersji szablonu.

- `id` (string, required) — Identyfikator portu. Identyfikatory wejściowe są kluczami mapy `inputs` w `POST /v1/flows/templates/{template_id}/runs`; identyfikatory wyjściowe są kluczami mapy `outputs` w odpowiedzi uruchomienia.
- `content_schema` (ContentSchema, required) — Co ten port przyjmuje lub generuje jako `ContentSchema`. Jego `title` to wyświetlana nazwa portu, a `description` to tekst pomocy napisany przez autora szablonu. Dla wejścia `type` określa, jaka wartość jest akceptowana: `string` przyjmuje zwykły ciąg lub odwołanie `generation`, `voice` przyjmuje odwołanie `voice`, a `image`/`video`/`audio` przyjmują odwołanie `asset`, `generation` lub `inline_base64`. `number`, `integer` i `boolean` przyjmują wartość JSON tego typu. Wejście `array` przyjmuje tablicę JSON z jedną wartością na element, z których każda jest dopuszczalna dla jego `items`. Wejść `object` nie można jeszcze powiązać przez to API. Schemat `string` może zawierać `enum` jedynych akceptowanych wartości. Dla wyjścia jego `type` określa, który kształt `Template<Kind>Output` odpowiedź uruchomienia zawiera pod ID portu.

### ValidationErrorLocItems

- string
- integer

### ContentSchema

- `type`: `array` (ArraySchema)
  - `items` (ContentSchema, required)
  - `description` (string, optional, nullable)
  - `title` (string, optional, nullable)
- `type`: `audio` (AudioSchema)
  - `description` (string, optional, nullable)
  - `title` (string, optional, nullable)
- `type`: `boolean` (BooleanSchema)
  - `description` (string, optional, nullable)
  - `title` (string, optional, nullable)
- `type`: `image` (ImageSchema)
  - `description` (string, optional, nullable)
  - `title` (string, optional, nullable)
- `type`: `integer` (IntegerSchema)
  - `description` (string, optional, nullable)
  - `title` (string, optional, nullable)
- `type`: `number` (NumberSchema)
  - `description` (string, optional, nullable)
  - `enum` (list of double, optional, nullable)
  - `title` (string, optional, nullable)
- `type`: `object` (ObjectSchema)
  - `description` (string, optional, nullable)
  - `properties` (map from string to ContentSchema, optional)
  - `required` (list of string, optional)
  - `title` (string, optional, nullable)
- `type`: `string` (StringSchema)
  - `description` (string, optional, nullable)
  - `enum` (list of string, optional, nullable)
  - `title` (string, optional, nullable)
- `type`: `video` (VideoSchema)
  - `description` (string, optional, nullable)
  - `title` (string, optional, nullable)
- `type`: `voice` (VoiceSchema)
  - `description` (string, optional, nullable)
  - `title` (string, optional, nullable)

## Examples

**Response**

```json
{
  "id": "tmpl_abc123",
  "name": "Product shot",
  "versions": [
    {
      "version_id": "ver_01hxyz",
      "published_at_unix": 1,
      "is_latest": true,
      "inputs": [
        {
          "id": "prompt",
          "content_schema": {
            "type": "string",
            "description": "string",
            "enum": [
              "string"
            ],
            "title": "string"
          }
        }
      ],
      "outputs": [
        {
          "id": "prompt",
          "content_schema": {
            "type": "string",
            "description": "string",
            "enum": [
              "string"
            ],
            "title": "string"
          }
        }
      ]
    }
  ],
  "has_more_versions": true,
  "description": "string"
}
```

**SDK Code**

```python
import requests

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

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/flows/templates/template_id';
const options = {method: 'GET'};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://api.elevenlabs.io/v1/flows/templates/template_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))

}
```

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

url = URI("https://api.elevenlabs.io/v1/flows/templates/template_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_body
```

```java
import 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")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/flows/templates/template_id');

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/flows/templates/template_id");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/flows/templates/template_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()
```