# API リファレンス: テンプレート

テンプレート: API v1 のすべての操作について、必要なスコープ、パラメーター、curl・JavaScript・Python の例、レスポンスを掲載します。認証、エラー、ページ分割、レート制限、冪等性は [API リファレンスの概要](/docs/api-reference)を参照してください。[SDK](/docs/sdks) と[コマンドラインツール](/docs/cli)もご覧ください。

> 自分のキーで試す: コンソールで API キーを作成し、ターミナルで `export APIDLY_API_KEY=...` を実行してから、下の curl の例を貼り付けてください。例の値は説明用です。このページにキーを入力する欄はありません。

操作とフィールドの説明は API 定義から取っており、英語のままです。

| 操作 | 必要なスコープ | 概要 |
| --- | --- | --- |
| `GET /templates` | `read` | 公開テンプレートと組織のテンプレート |
| `POST /templates` | `full` | 組織テンプレートを作成 |
| `GET /templates/{id}` | `read` | 1 件のテンプレート |
| `PATCH /templates/{id}` | `full` | 組織のテンプレートを更新 |
| `DELETE /templates/{id}` | `full` | テンプレートを削除、またはサーバーが参照している場合は非表示にする |
| `POST /templates/{id}/share` | `full` | 組織のテンプレートの共有リンクを作成 |
| `DELETE /templates/{id}/share` | `full` | テンプレートの共有リンクを無効化 |
| `GET /templates/{id}/share` | `full` | テンプレートの共有リンク |
| `POST /templates/{id}/duplicate` | `full` | 組織のテンプレートをコピー |
| `GET /templates/{id}/revisions` | `read` | テンプレートのリビジョン履歴 (新しい順) |
| `POST /templates/{id}/revisions/{rev}/restore` | `full` | 古いリビジョンを新しいリビジョンとして復元 |
| `GET /templates/{id}/export` | `full` | テンプレートを持ち運べるファイルとして書き出す |
| `POST /templates/import` | `full` | 書き出したファイルからテンプレートを作成 |
| `POST /template-shares/{token}/import` | `full` | 共有されたテンプレートを組織にコピー |
| `POST /template-shares/{token}/report` | `servers` | 共有テンプレートをスタッフに報告（組織ごとに1時間あたり最大10件） |

### GET /templates

公開テンプレートと組織のテンプレート

Optional filters: `q` (up to 60 characters, case-insensitive, found in the name, slug, summary, image or category), `category`, `source` (`builtin` for the public catalogue, `own` for your organization's templates) and `vramGb` (only templates whose `minVramGb` is at most this, so they run on a GPU with that much memory). Repeat the same filters on every page so the `cursor` stays valid.

**必要なスコープ:** `read`

**パラメーター**

| 名前 | 場所 | 型 | 必須 | 説明 |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | いいえ |  |
| `cursor` | query | string | いいえ |  |
| `q` | query | string | いいえ |  |
| `category` | query | `base` \| `llm` \| `image` \| `notebook` \| `training` \| `custom` | いいえ |  |
| `source` | query | `builtin` \| `own` | いいえ |  |
| `vramGb` | query | integer | いいえ |  |

**リクエスト例 (curl)**

```bash
curl "https://apidly.com/api/v1/templates?limit=20" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.templates.list({ limit: 20 });
```

**Python (SDK)**

```python
client.templates.list()
```

**コマンドラインツール:** `apidly templates`, `apidly export`, `apidly plan`, `apidly apply` ([CLI リファレンス](/docs/cli))

**レスポンス例** (200)

```json
{
  "templates": [
    {
      "id": "example",
      "slug": "example",
      "name": "example",
      "summary": "example",
      "category": "example",
      "image": "docker.io/library/ubuntu",
      "tag": "example",
      "launchMode": "ssh",
      "env": {
        "key": "example"
      },
      "ports": [
        {
          "port": null,
          "protocol": null,
          "label": null
        }
      ],
      "startScript": "example",
      "onStart": "example",
      "args": "example",
      "description": "example",
      "secretEnvKeys": [
        "example"
      ],
      "registryId": "id_example",
      "appPort": 1,
      "defaultDiskGb": 1,
      "minVramGb": 1,
      "recommendedVramGb": 1,
      "constraints": {
        "key": null
      },
      "latestCudaTag": false,
      "inference": {
        "api": "http",
        "healthPath": "example",
        "port": 1
      },
      "custom": false,
      "firstBootMinutes": 1,
      "revision": 1,
      "sort": 1,
      "createdAt": "2026-11-21T10:00:00.000Z"
    }
  ],
  "nextCursor": "example"
}
```

エラーステータス: `401`, `403`, `429`.

### POST /templates

組織テンプレートを作成

**必要なスコープ:** `full` · **作成者のロール:** `admin` · **安全に再試行できるヘッダー:** `Idempotency-Key`

**リクエストボディ**

| 名前 | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `name` | string | はい |  |
| `summary` | string | いいえ |  |
| `description` | string | いいえ |  |
| `image` | string | はい |  |
| `tag` | string | いいえ |  |
| `launchMode` | `ssh` \| `jupyter` \| `app` | はい |  |
| `env` | object | いいえ |  |
| `secretEnv` | object | いいえ |  |
| `ports` | object の配列 | いいえ |  |
| `startScript` | string | いいえ | Shell script run on the server after each start (up to 64 KB). Replaces the deprecated `onStart`. |
| `onStart` | string | いいえ | Deprecated name of `startScript`, read until 2027-05-31. Send `startScript`. |
| `args` | string | いいえ |  |
| `appPort` | integer または null | いいえ |  |
| `defaultDiskGb` | integer | いいえ |  |
| `minVramGb` | integer | いいえ |  |
| `constraints` | object | いいえ |  |
| `recommendedVramGb` | integer または null | いいえ |  |
| `inference` | object または null | いいえ |  |
| `registryId` | string または null | いいえ |  |
| `latestCudaTag` | boolean | いいえ |  |
| `inheritSecretsFrom` | string | いいえ |  |

**リクエスト例 (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/templates" \
  -H "Authorization: Bearer $APIDLY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"name":"example","image":"docker.io/library/ubuntu","launchMode":"ssh"}'
```

**JavaScript (SDK)**

```js
await apidly.templates.create({
  name: "example",
  image: "docker.io/library/ubuntu",
  launchMode: "ssh"
});
```

**Python (SDK)**

```python
client.templates.create(body={
    "name": "example",
    "image": "docker.io/library/ubuntu",
    "launchMode": "ssh",
})
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (201)

```json
{
  "template": {
    "id": "example",
    "slug": "example",
    "name": "example",
    "summary": "example",
    "category": "example",
    "image": "docker.io/library/ubuntu",
    "tag": "example",
    "launchMode": "ssh",
    "env": {
      "key": "example"
    },
    "ports": [
      {
        "port": 1,
        "protocol": "tcp",
        "label": "example"
      }
    ],
    "startScript": "example",
    "onStart": "example",
    "args": "example",
    "description": "example",
    "secretEnvKeys": [
      "example"
    ],
    "registryId": "id_example",
    "appPort": 1,
    "defaultDiskGb": 1,
    "minVramGb": 1,
    "recommendedVramGb": 1,
    "constraints": {
      "key": null
    },
    "latestCudaTag": false,
    "inference": {
      "api": "http",
      "healthPath": "example",
      "port": 1
    },
    "custom": false,
    "firstBootMinutes": 1,
    "revision": 1,
    "sort": 1,
    "createdAt": "2026-11-21T10:00:00.000Z"
  }
}
```

エラーステータス: `400`, `401`, `403`, `409`, `429`.

### GET /templates/{id}

1 件のテンプレート

`id` is a template id or the slug the catalogue lists (`pytorch`). Built-in templates are shown read-only (`custom: false`).

**必要なスコープ:** `read`

**パラメーター**

| 名前 | 場所 | 型 | 必須 | 説明 |
| --- | --- | --- | --- | --- |
| `id` | path | string | はい |  |

**リクエスト例 (curl)**

```bash
curl "https://apidly.com/api/v1/templates/tpl_example" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.templates.get("tpl_example");
```

**Python (SDK)**

```python
client.templates.get("tpl_example")
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (200)

```json
{
  "template": {
    "id": "example",
    "slug": "example",
    "name": "example",
    "summary": "example",
    "category": "example",
    "image": "docker.io/library/ubuntu",
    "tag": "example",
    "launchMode": "ssh",
    "env": {
      "key": "example"
    },
    "ports": [
      {
        "port": 1,
        "protocol": "tcp",
        "label": "example"
      }
    ],
    "startScript": "example",
    "onStart": "example",
    "args": "example",
    "description": "example",
    "secretEnvKeys": [
      "example"
    ],
    "registryId": "id_example",
    "appPort": 1,
    "defaultDiskGb": 1,
    "minVramGb": 1,
    "recommendedVramGb": 1,
    "constraints": {
      "key": null
    },
    "latestCudaTag": false,
    "inference": {
      "api": "http",
      "healthPath": "example",
      "port": 1
    },
    "custom": false,
    "firstBootMinutes": 1,
    "revision": 1,
    "sort": 1,
    "createdAt": "2026-11-21T10:00:00.000Z"
  }
}
```

エラーステータス: `401`, `403`, `404`, `429`.

### PATCH /templates/{id}

組織のテンプレートを更新

**必要なスコープ:** `full` · **作成者のロール:** `admin`

**パラメーター**

| 名前 | 場所 | 型 | 必須 | 説明 |
| --- | --- | --- | --- | --- |
| `id` | path | string | はい |  |

**リクエストボディ**

| 名前 | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `name` | string | いいえ |  |
| `summary` | string | いいえ |  |
| `description` | string | いいえ |  |
| `image` | string | いいえ |  |
| `tag` | string | いいえ |  |
| `launchMode` | `ssh` \| `jupyter` \| `app` | いいえ |  |
| `env` | object | いいえ |  |
| `secretEnv` | object | いいえ |  |
| `ports` | object の配列 | いいえ |  |
| `startScript` | string | いいえ | Shell script run on the server after each start (up to 64 KB). Replaces the deprecated `onStart`. |
| `onStart` | string | いいえ | Deprecated name of `startScript`, read until 2027-05-31. Send `startScript`. |
| `args` | string | いいえ |  |
| `appPort` | integer または null | いいえ |  |
| `defaultDiskGb` | integer | いいえ |  |
| `minVramGb` | integer | いいえ |  |
| `constraints` | object | いいえ |  |
| `recommendedVramGb` | integer または null | いいえ |  |
| `inference` | object または null | いいえ |  |
| `registryId` | string または null | いいえ |  |
| `latestCudaTag` | boolean | いいえ |  |

**リクエスト例 (curl)**

```bash
curl -X PATCH "https://apidly.com/api/v1/templates/tpl_example" \
  -H "Authorization: Bearer $APIDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"example","summary":"example","description":"example"}'
```

**JavaScript (SDK)**

```js
await apidly.templates.update("tpl_example", {
  name: "example",
  summary: "example",
  description: "example"
});
```

**Python (SDK)**

```python
client.templates.update("tpl_example", body={
    "name": "example",
    "summary": "example",
    "description": "example",
})
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (200)

```json
{
  "template": {
    "id": "example",
    "slug": "example",
    "name": "example",
    "summary": "example",
    "category": "example",
    "image": "docker.io/library/ubuntu",
    "tag": "example",
    "launchMode": "ssh",
    "env": {
      "key": "example"
    },
    "ports": [
      {
        "port": 1,
        "protocol": "tcp",
        "label": "example"
      }
    ],
    "startScript": "example",
    "onStart": "example",
    "args": "example",
    "description": "example",
    "secretEnvKeys": [
      "example"
    ],
    "registryId": "id_example",
    "appPort": 1,
    "defaultDiskGb": 1,
    "minVramGb": 1,
    "recommendedVramGb": 1,
    "constraints": {
      "key": null
    },
    "latestCudaTag": false,
    "inference": {
      "api": "http",
      "healthPath": "example",
      "port": 1
    },
    "custom": false,
    "firstBootMinutes": 1,
    "revision": 1,
    "sort": 1,
    "createdAt": "2026-11-21T10:00:00.000Z"
  }
}
```

エラーステータス: `400`, `401`, `403`, `404`, `429`.

### DELETE /templates/{id}

テンプレートを削除、またはサーバーが参照している場合は非表示にする

**必要なスコープ:** `full` · **作成者のロール:** `admin`

**パラメーター**

| 名前 | 場所 | 型 | 必須 | 説明 |
| --- | --- | --- | --- | --- |
| `id` | path | string | はい |  |

**リクエスト例 (curl)**

```bash
curl -X DELETE "https://apidly.com/api/v1/templates/tpl_example" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.templates.delete("tpl_example");
```

**Python (SDK)**

```python
client.templates.delete("tpl_example")
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (200)

```json
{
  "deleted": false,
  "hidden": false
}
```

エラーステータス: `401`, `403`, `404`, `429`.

### POST /templates/{id}/share

組織のテンプレートの共有リンクを作成

Anyone with the link sees the template's name, description, image, ports, minimum GPU memory and the NAMES of its plain environment variables, and can copy it into their own organization. Secret values, registry logins and (unless `includeStartScript` is true) the start script are never shared.

**必要なスコープ:** `full` · **権限:** `templates.manage`

**パラメーター**

| 名前 | 場所 | 型 | 必須 | 説明 |
| --- | --- | --- | --- | --- |
| `id` | path | string | はい |  |

**リクエストボディ**

| 名前 | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `displayName` | string または null | いいえ |  |
| `includeStartScript` | boolean | いいえ |  |
| `expiresInDays` | integer または null | いいえ |  |

**リクエスト例 (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/templates/tpl_example/share" \
  -H "Authorization: Bearer $APIDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"displayName":"example","includeStartScript":false,"expiresInDays":null}'
```

**JavaScript (SDK)**

```js
await apidly.templates.share("tpl_example");
```

**Python (SDK)**

```python
client.templates.share("tpl_example")
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (201)

```json
{
  "share": {
    "id": "example",
    "templateId": "id_example",
    "token": "example",
    "displayName": "example",
    "includeStartScript": false,
    "expiresAt": "2026-11-21T10:00:00.000Z",
    "status": "active",
    "viewCount": 1,
    "importCount": 1,
    "createdAt": "2026-11-21T10:00:00.000Z"
  }
}
```

エラーステータス: `400`, `401`, `403`, `404`, `409`, `429`.

### DELETE /templates/{id}/share

テンプレートの共有リンクを無効化

Revokes one link with `?shareId=`, or every active link of the template when omitted.

**必要なスコープ:** `full` · **権限:** `templates.manage`

**パラメーター**

| 名前 | 場所 | 型 | 必須 | 説明 |
| --- | --- | --- | --- | --- |
| `id` | path | string | はい |  |

**リクエスト例 (curl)**

```bash
curl -X DELETE "https://apidly.com/api/v1/templates/tpl_example/share" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.templates.unshare("tpl_example");
```

**Python (SDK)**

```python
client.templates.unshare("tpl_example")
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (200)

```json
{
  "revoked": 1
}
```

エラーステータス: `401`, `403`, `404`, `429`.

### GET /templates/{id}/share

テンプレートの共有リンク

**必要なスコープ:** `full` · **権限:** `templates.manage`

**パラメーター**

| 名前 | 場所 | 型 | 必須 | 説明 |
| --- | --- | --- | --- | --- |
| `id` | path | string | はい |  |

**リクエスト例 (curl)**

```bash
curl "https://apidly.com/api/v1/templates/tpl_example/share" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.templates.listShares("tpl_example");
```

**Python (SDK)**

```python
client.templates.list_shares("tpl_example")
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (200)

```json
{
  "shares": [
    {
      "id": "example",
      "templateId": "id_example",
      "token": "example",
      "displayName": "example",
      "includeStartScript": false,
      "expiresAt": "2026-11-21T10:00:00.000Z",
      "status": "active",
      "viewCount": 1,
      "importCount": 1,
      "createdAt": "2026-11-21T10:00:00.000Z"
    }
  ]
}
```

エラーステータス: `401`, `403`, `404`, `429`.

### POST /templates/{id}/duplicate

組織のテンプレートをコピー

**必要なスコープ:** `full` · **権限:** `templates.manage`

**パラメーター**

| 名前 | 場所 | 型 | 必須 | 説明 |
| --- | --- | --- | --- | --- |
| `id` | path | string | はい |  |

**リクエスト例 (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/templates/tpl_example/duplicate" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.templates.duplicate("tpl_example");
```

**Python (SDK)**

```python
client.templates.duplicate("tpl_example")
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (201)

```json
{
  "template": {
    "id": "example",
    "slug": "example",
    "name": "example",
    "summary": "example",
    "category": "example",
    "image": "docker.io/library/ubuntu",
    "tag": "example",
    "launchMode": "ssh",
    "env": {
      "key": "example"
    },
    "ports": [
      {
        "port": 1,
        "protocol": "tcp",
        "label": "example"
      }
    ],
    "startScript": "example",
    "onStart": "example",
    "args": "example",
    "description": "example",
    "secretEnvKeys": [
      "example"
    ],
    "registryId": "id_example",
    "appPort": 1,
    "defaultDiskGb": 1,
    "minVramGb": 1,
    "recommendedVramGb": 1,
    "constraints": {
      "key": null
    },
    "latestCudaTag": false,
    "inference": {
      "api": "http",
      "healthPath": "example",
      "port": 1
    },
    "custom": false,
    "firstBootMinutes": 1,
    "revision": 1,
    "sort": 1,
    "createdAt": "2026-11-21T10:00:00.000Z"
  }
}
```

エラーステータス: `401`, `403`, `404`, `409`, `429`.

### GET /templates/{id}/revisions

テンプレートのリビジョン履歴 (新しい順)

Secret values are never included.

**必要なスコープ:** `read`

**パラメーター**

| 名前 | 場所 | 型 | 必須 | 説明 |
| --- | --- | --- | --- | --- |
| `id` | path | string | はい |  |

**リクエスト例 (curl)**

```bash
curl "https://apidly.com/api/v1/templates/tpl_example/revisions" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.templates.listRevisions("tpl_example");
```

**Python (SDK)**

```python
client.templates.list_revisions("tpl_example")
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (200)

```json
{
  "revisions": [
    {
      "rev": 1,
      "kind": "example",
      "restoredFrom": 1,
      "createdAt": "2026-11-21T10:00:00.000Z",
      "createdByName": "example",
      "current": false,
      "servers": 1,
      "snapshot": {
        "key": null
      }
    }
  ]
}
```

エラーステータス: `401`, `403`, `404`, `429`.

### POST /templates/{id}/revisions/{rev}/restore

古いリビジョンを新しいリビジョンとして復元

History is never rewritten: the restored copy becomes the newest revision.

**必要なスコープ:** `full` · **権限:** `templates.manage`

**パラメーター**

| 名前 | 場所 | 型 | 必須 | 説明 |
| --- | --- | --- | --- | --- |
| `id` | path | string | はい |  |
| `rev` | path | string | はい |  |

**リクエスト例 (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/templates/tpl_example/revisions/1/restore" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.templates.restoreRevision("tpl_example", "1");
```

**Python (SDK)**

```python
client.templates.restore_revision("tpl_example", "1")
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (200)

```json
{
  "template": {
    "id": "example",
    "slug": "example",
    "name": "example",
    "summary": "example",
    "category": "example",
    "image": "docker.io/library/ubuntu",
    "tag": "example",
    "launchMode": "ssh",
    "env": {
      "key": "example"
    },
    "ports": [
      {
        "port": 1,
        "protocol": "tcp",
        "label": "example"
      }
    ],
    "startScript": "example",
    "onStart": "example",
    "args": "example",
    "description": "example",
    "secretEnvKeys": [
      "example"
    ],
    "registryId": "id_example",
    "appPort": 1,
    "defaultDiskGb": 1,
    "minVramGb": 1,
    "recommendedVramGb": 1,
    "constraints": {
      "key": null
    },
    "latestCudaTag": false,
    "inference": {
      "api": "http",
      "healthPath": "example",
      "port": 1
    },
    "custom": false,
    "firstBootMinutes": 1,
    "revision": 1,
    "sort": 1,
    "createdAt": "2026-11-21T10:00:00.000Z"
  },
  "revision": 1
}
```

エラーステータス: `401`, `403`, `404`, `429`.

### GET /templates/{id}/export

テンプレートを持ち運べるファイルとして書き出す

The file the console downloads. Secret variables appear as names in `secretEnvNames`, never with values; the registry login is never included. Send its text to `POST /templates/import` to copy it into an organization. Only your organization's own templates can be exported: a built-in template answers 409 `invalid_state` (read it with `GET /templates/{id}`).

**必要なスコープ:** `full` · **権限:** `templates.manage`

**パラメーター**

| 名前 | 場所 | 型 | 必須 | 説明 |
| --- | --- | --- | --- | --- |
| `id` | path | string | はい |  |

**リクエスト例 (curl)**

```bash
curl "https://apidly.com/api/v1/templates/tpl_example/export" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.templates.export("tpl_example");
```

**Python (SDK)**

```python
client.templates.export("tpl_example")
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (200)

```json
{
  "format": "apidly-template",
  "version": 1,
  "template": {
    "name": "example",
    "summary": "example",
    "description": "example",
    "image": "docker.io/library/ubuntu",
    "tag": "example",
    "launchMode": "ssh",
    "env": {
      "key": "example"
    },
    "secretEnvNames": [
      "example"
    ],
    "ports": [
      {
        "port": 1,
        "protocol": "tcp",
        "label": "example"
      }
    ],
    "appPort": 1,
    "inference": {
      "key": null
    },
    "startScript": "example",
    "onStart": "example",
    "args": "example",
    "defaultDiskGb": 1,
    "minVramGb": 1
  }
}
```

エラーステータス: `401`, `403`, `404`, `409`, `429`.

### POST /templates/import

書き出したファイルからテンプレートを作成

`json` is the text of a file from `GET /templates/{id}/export` (or the console's Export). Secret variables arrive blank and the registry unset. 400 `invalid_file` when it is not such a file.

**必要なスコープ:** `full` · **権限:** `templates.manage` · **安全に再試行できるヘッダー:** `Idempotency-Key`

**リクエストボディ**

| 名前 | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `json` | string | はい |  |

**リクエスト例 (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/templates/import" \
  -H "Authorization: Bearer $APIDLY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"json":"example"}'
```

**JavaScript (SDK)**

```js
await apidly.templates.import("example");
```

**Python (SDK)**

```python
client.templates.import_file(file="example")
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (201)

```json
{
  "template": {
    "id": "example",
    "slug": "example",
    "name": "example",
    "summary": "example",
    "category": "example",
    "image": "docker.io/library/ubuntu",
    "tag": "example",
    "launchMode": "ssh",
    "env": {
      "key": "example"
    },
    "ports": [
      {
        "port": 1,
        "protocol": "tcp",
        "label": "example"
      }
    ],
    "startScript": "example",
    "onStart": "example",
    "args": "example",
    "description": "example",
    "secretEnvKeys": [
      "example"
    ],
    "registryId": "id_example",
    "appPort": 1,
    "defaultDiskGb": 1,
    "minVramGb": 1,
    "recommendedVramGb": 1,
    "constraints": {
      "key": null
    },
    "latestCudaTag": false,
    "inference": {
      "api": "http",
      "healthPath": "example",
      "port": 1
    },
    "custom": false,
    "firstBootMinutes": 1,
    "revision": 1,
    "sort": 1,
    "createdAt": "2026-11-21T10:00:00.000Z"
  }
}
```

エラーステータス: `400`, `401`, `403`, `409`, `429`.

### POST /template-shares/{token}/import

共有されたテンプレートを組織にコピー

`token` is the 32-character token of a share link (`/t/{token}`). 404 when the link is revoked, expired or unknown.

**必要なスコープ:** `full` · **権限:** `templates.manage` · **安全に再試行できるヘッダー:** `Idempotency-Key`

**パラメーター**

| 名前 | 場所 | 型 | 必須 | 説明 |
| --- | --- | --- | --- | --- |
| `token` | path | string | はい |  |

**リクエスト例 (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/template-shares/templateshare_example/import" \
  -H "Authorization: Bearer $APIDLY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

**JavaScript (SDK)**

```js
await apidly.templates.importShared("templateshare_example");
```

**Python (SDK)**

```python
client.templates.import_shared("templateshare_example")
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (201)

```json
{
  "template": {
    "id": "example",
    "slug": "example",
    "name": "example",
    "summary": "example",
    "category": "example",
    "image": "docker.io/library/ubuntu",
    "tag": "example",
    "launchMode": "ssh",
    "env": {
      "key": "example"
    },
    "ports": [
      {
        "port": 1,
        "protocol": "tcp",
        "label": "example"
      }
    ],
    "startScript": "example",
    "onStart": "example",
    "args": "example",
    "description": "example",
    "secretEnvKeys": [
      "example"
    ],
    "registryId": "id_example",
    "appPort": 1,
    "defaultDiskGb": 1,
    "minVramGb": 1,
    "recommendedVramGb": 1,
    "constraints": {
      "key": null
    },
    "latestCudaTag": false,
    "inference": {
      "api": "http",
      "healthPath": "example",
      "port": 1
    },
    "custom": false,
    "firstBootMinutes": 1,
    "revision": 1,
    "sort": 1,
    "createdAt": "2026-11-21T10:00:00.000Z"
  }
}
```

エラーステータス: `401`, `403`, `404`, `409`, `429`.

### POST /template-shares/{token}/report

共有テンプレートをスタッフに報告（組織ごとに1時間あたり最大10件）

Opens a support ticket for staff with the reason (`malware`, `illegal`, `secrets`, `other`) and your details. Five reports an hour per key and ten an hour per organization, across all its keys.

**必要なスコープ:** `servers` · **安全に再試行できるヘッダー:** `Idempotency-Key`

**パラメーター**

| 名前 | 場所 | 型 | 必須 | 説明 |
| --- | --- | --- | --- | --- |
| `token` | path | string | はい |  |

**リクエストボディ**

| 名前 | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `details` | string | いいえ |  |
| `reason` | `malware` \| `illegal` \| `secrets` \| `other` | はい |  |

**リクエスト例 (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/template-shares/templateshare_example/report" \
  -H "Authorization: Bearer $APIDLY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"reason":"malware"}'
```

**JavaScript (SDK)**

```js
await apidly.templates.reportShared("templateshare_example", {
  reason: "malware"
});
```

**Python (SDK)**

```python
client.templates.report_shared("templateshare_example", reason="malware")
```

**コマンドラインツール:** `apidly templates` ([CLI リファレンス](/docs/cli))

**レスポンス例** (201)

```json
{
  "ticketId": "id_example"
}
```

エラーステータス: `400`, `401`, `403`, `404`, `429`.
