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

# テンプレートを一覧表示

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

ワークスペース内の公開済みフローテンプレートを、各実行可能バージョンの入力と出力とともに一覧表示します。ここにあるIDを、`POST /v1/flows/templates/{template_id}/runs`の`template_id`／`version_id`として使用します。API経由で利用できないモデルに基づくバージョンは除外されます。そのため、テンプレートの公開済みバージョンのいずれもこのAPI経由で実行できない場合、`versions`は空になります。リンクで共有されたテンプレートや、別のワークスペースからExploreに公開されたテンプレートは一覧表示されませんが、`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) — ページネーションカーソル：前のページのレスポンスに含まれる`next_cursor`値。最初のページでは省略します。
- `page_size` (integer, optional, default: 10) — 1ページあたりに返すテンプレート数です。各行でバージョンの入力・出力スキーマが展開されるため、実行リストの上限より低く設定されています。
- `versions_per_template` (integer, optional, default: 3) — 各テンプレートの公開済みバージョンを、新しい順にいくつ返すかを指定します。テンプレートにさらにバージョンがある場合は、`has_more_versions`で確認できます。
- `search` (string, optional, nullable) — 名前または説明にこのテキストを含むテンプレートのみを返します。

## Response

### 200

成功レスポンス。

- `templates` (list of TemplateSummary, required) — このページのテンプレート。最近更新されたものから順に表示されます。実行できないテンプレートはページの読み取り後に除外されるため、ページには`page_size`未満のテンプレートしかない場合や、まったくない場合があります。`has_more`がtrueの間はページングを続けてください。
- `next_cursor` (string, required, nullable) — 次のページを取得するには`cursor`として渡します。次のページがない場合は`null`です。
- `has_more` (boolean, required) — このページ以降にさらにテンプレートがあるかどうか。

## Errors

### 422 Unprocessable Entity Error

検証エラー

- `detail` (list of ValidationError, optional)

## Types

### TemplateSummary

呼び出し元が実行できるテンプレートと、その実行可能なバージョン。

- `id` (string, required) — `POST /v1/flows/templates/{template_id}/runs`で`template_id`として渡します。
- `name` (string, required) — テンプレートの名前。
- `versions` (list of TemplateVersion, required) — 呼び出し元が実行できる公開済みバージョン。新しい順に並びます。グラフでAPIから利用できないモデルを使用するバージョンや、保存済みスナップショットが失われたバージョンは除外されます。いずれの場合も、ElevenLabsアプリで実行可能なバージョンがテンプレートに残っていても、リストが空になることがあります。
- `has_more_versions` (boolean, required) — このテンプレートに、ここで返される`versions_per_template`以外の公開済みバージョンがあるかどうか。さらに表示するには、より大きい`versions_per_template`を指定して`GET /v1/flows/templates/{template_id}`を取得してください。
- `description` (string, optional, nullable) — テンプレートの説明（存在する場合）。

### ValidationError

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

### TemplateVersion

テンプレートの公開済みスナップショットと、それが実行されるポート。

- `version_id` (string, required) — 実行をこのスナップショットに固定するには、`POST /v1/flows/templates/{template_id}/runs`で`version_id`として渡します。
- `published_at_unix` (integer, required) — このバージョンが公開された日時（秒単位のUnixタイムスタンプ）。
- `is_latest` (boolean, required) — `version_id`が省略されるか`latest`に設定された場合に、実行で使用されるバージョンかどうか。
- `inputs` (list of TemplatePort, required) — このバージョンが受け付ける入力。キャンバスの順序で並びます。実行時にはすべての入力が必要です。
- `outputs` (list of TemplatePort, required) — このバージョンが生成する出力。キャンバス上の順序で並びます。

### ValidationErrorLocItems

### TemplatePort

公開済みテンプレートバージョンの1つの入力ポートまたは出力ポートです。

- `id` (string, required) — ポートID。入力IDは`POST /v1/flows/templates/{template_id}/runs`の`inputs`マップのキーであり、出力IDは実行レスポンスの`outputs`マップのキーです。
- `content_schema` (ContentSchema, required) — このポートが受け付ける、または生成する内容を`ContentSchema`として示します。`title`はポートの表示名、`description`はテンプレート作成者が記述したヘルプテキストです。入力では、`type`によって受け付ける値が決まります。`string`は文字列または`generation`参照、`voice`は`voice`参照、`image`／`video`／`audio`は`asset`、`generation`、または`inline_base64`参照を受け付けます。`number`、`integer`、`boolean`は該当する型のJSON値を受け付けます。`array`入力は、要素ごとに`items`で許容される値を1つ含むJSON配列を受け付けます。`object`入力は、まだこのAPIではバインドできません。`string`スキーマには、受け付ける値のみを指定した`enum`を含めることができます。出力では、`type`によって、実行レスポンス内でポートIDの下に格納される`Template<Kind>Output`の形状が決まります。

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