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

# Wyświetl szablony

GET https://api.elevenlabs.io/v1/flows/templates

Wyświetla opublikowane szablony flows w workspace wraz z wejściami i wyjściami każdej uruchamialnej wersji. Użyj tych identyfikatorów jako `template_id` / `version_id` w `POST /v1/flows/templates/{template_id}/runs`. Wersje oparte na modelach niedostępnych przez API są pomijane, więc `versions` jest puste, gdy żadnej opublikowanej wersji szablonu nie można uruchomić przez to API. Szablony udostępnione ci linkiem lub opublikowane w Explore z innego workspace nie są wyświetlane, ale nadal można je pobrać i uruchomić przez `template_id`.

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

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

### Query parameters

- `cursor` (string, optional, nullable) — Kursor paginacji: wartość `next_cursor` z odpowiedzi poprzedniej strony. Pomiń go dla pierwszej strony.
- `page_size` (integer, optional, default: 10) — Ile szablonów zwrócić na stronę. Limit jest niższy niż dla listy uruchomień, ponieważ każdy wiersz rozwija schematy wejścia i wyjścia swoich wersji.
- `versions_per_template` (integer, optional, default: 3) — Ile opublikowanych wersji każdego szablonu zwrócić, od najnowszych. `has_more_versions` wskazuje, czy szablon ma więcej wersji.
- `search` (string, optional, nullable) — Zwracaj tylko szablony, których nazwa lub opis zawiera ten tekst.

## Response

### 200

Pomyślna odpowiedź

- `templates` (list of TemplateSummary, required) — Szablony na tej stronie, od ostatnio zaktualizowanych. Strona może zawierać mniej niż `page_size` szablonów albo nie zawierać ich wcale, ponieważ szablony, których nie możesz uruchomić, są odfiltrowywane po odczytaniu strony — pobieraj kolejne strony, dopóki `has_more` ma wartość true.
- `next_cursor` (string, required, nullable) — Przekaż jako `cursor`, aby pobrać następną stronę. `null`, gdy nie ma kolejnej strony.
- `has_more` (boolean, required) — Czy poza tą stroną istnieją kolejne szablony.

## Errors

### 422 Unprocessable Entity Error

Błąd walidacji

- `detail` (list of ValidationError, optional)

## Types

### TemplateSummary

Szablon, który wywołujący może uruchomić, oraz jego wersje możliwe do uruchomienia.

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

### ValidationError

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

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

### ValidationErrorLocItems

- string
- integer

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

### 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
{
  "templates": [
    {
      "id": "tmpl_abc123",
      "name": "Product shot",
      "versions": [
        {
          "version_id": "ver_01hxyz",
          "published_at_unix": 1739721600,
          "is_latest": true,
          "inputs": [
            {
              "id": "prompt",
              "content_schema": {
                "type": "string",
                "title": "Prompt"
              }
            },
            {
              "id": "reference",
              "content_schema": {
                "type": "image",
                "description": "A clean product photo on any background.",
                "title": "Product photo"
              }
            }
          ],
          "outputs": [
            {
              "id": "product_still",
              "content_schema": {
                "type": "image",
                "title": "Final image"
              }
            }
          ]
        }
      ],
      "has_more_versions": false,
      "description": "Drop in a product photo, get a studio shot."
    }
  ],
  "next_cursor": "cGFnZXwx",
  "has_more": true
}
```

**SDK Code**

```python
import requests

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

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/flows/templates';
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"

	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")

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

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

$client = new \GuzzleHttp\Client();

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

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/flows/templates");
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")! 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()
```