# API-viite: Mallipohjat

Mallipohjat: kaikki API v1:n toiminnot scopeineen, parametreineen, curl-, JavaScript- ja Python-esimerkkeineen sekä vastauksineen. Tunnistautuminen, virheet, sivutus, rajoitukset ja idempotenssi on kuvattu [API-viitteen yleiskatsauksessa](/docs/api-reference); katso myös [SDK:t](/docs/sdks) ja [komentorivi](/docs/cli).

> Kokeile avaimellasi: luo API-avain konsolissa, suorita päätteessä `export APIDLY_API_KEY=...` ja liitä jokin alla olevista curl-esimerkeistä. Esimerkkiarvot ovat havainnollistavia. Tällä sivulla ei voi syöttää avainta.

Toimintojen ja kenttien kuvaukset tulevat API-määrittelystä ja ovat englanniksi.

| Toiminto | Vaadittu scope | Yhteenveto |
| --- | --- | --- |
| `GET /templates` | `read` | Julkiset mallipohjat ja organisaatiosi omat |
| `POST /templates` | `full` | Luo organisaation mallipohja |
| `GET /templates/{id}` | `read` | Yksi mallipohja |
| `PATCH /templates/{id}` | `full` | Päivitä organisaatiosi mallipohja |
| `DELETE /templates/{id}` | `full` | Poista mallipohja tai piilota se, kun palvelimet viittaavat siihen vielä |
| `POST /templates/{id}/share` | `full` | Luo jakolinkki organisaatiosi mallipohjalle |
| `DELETE /templates/{id}/share` | `full` | Peruuta mallipohjan jakolinkit |
| `GET /templates/{id}/share` | `full` | Mallipohjan jakolinkit |
| `POST /templates/{id}/duplicate` | `full` | Kopioi organisaatiosi mallipohja |
| `GET /templates/{id}/revisions` | `read` | Mallipohjan versiohistoria, uusin ensin |
| `POST /templates/{id}/revisions/{rev}/restore` | `full` | Palauta vanhempi versio uutena |
| `GET /templates/{id}/export` | `full` | Vie mallipohja siirrettävään tiedostoon |
| `POST /templates/import` | `full` | Luo mallipohja viedystä tiedostosta |
| `POST /template-shares/{token}/import` | `full` | Kopioi jaettu mallipohja organisaatioosi |
| `POST /template-shares/{token}/report` | `servers` | Ilmoita jaetusta mallipohjasta henkilökunnallemme (enintään 10 tunnissa organisaatiota kohden) |

### GET /templates

Julkiset mallipohjat ja organisaatiosi omat

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.

**Vaadittu scope:** `read`

**Parametrit**

| Nimi | Missä | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | ei |  |
| `cursor` | query | string | ei |  |
| `q` | query | string | ei |  |
| `category` | query | `base` \| `llm` \| `image` \| `notebook` \| `training` \| `custom` | ei |  |
| `source` | query | `builtin` \| `own` | ei |  |
| `vramGb` | query | integer | ei |  |

**Esimerkkipyyntö (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()
```

**Komentorivityökalu:** `apidly templates`, `apidly export`, `apidly plan`, `apidly apply` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (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"
}
```

Virhetilat: `401`, `403`, `429`.

### POST /templates

Luo organisaation mallipohja

**Vaadittu scope:** `full` · **Luojan rooli:** `admin` · **Turvallisesti toistettavissa avaimella:** `Idempotency-Key`

**Pyynnön runko**

| Nimi | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- |
| `name` | string | kyllä |  |
| `summary` | string | ei |  |
| `description` | string | ei |  |
| `image` | string | kyllä |  |
| `tag` | string | ei |  |
| `launchMode` | `ssh` \| `jupyter` \| `app` | kyllä |  |
| `env` | object | ei |  |
| `secretEnv` | object | ei |  |
| `ports` | taulukko: object | ei |  |
| `startScript` | string | ei | Shell script run on the server after each start (up to 64 KB). Replaces the deprecated `onStart`. |
| `onStart` | string | ei | Deprecated name of `startScript`, read until 2027-05-31. Send `startScript`. |
| `args` | string | ei |  |
| `appPort` | integer tai null | ei |  |
| `defaultDiskGb` | integer | ei |  |
| `minVramGb` | integer | ei |  |
| `constraints` | object | ei |  |
| `recommendedVramGb` | integer tai null | ei |  |
| `inference` | object tai null | ei |  |
| `registryId` | string tai null | ei |  |
| `latestCudaTag` | boolean | ei |  |
| `inheritSecretsFrom` | string | ei |  |

**Esimerkkipyyntö (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",
})
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (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"
  }
}
```

Virhetilat: `400`, `401`, `403`, `409`, `429`.

### GET /templates/{id}

Yksi mallipohja

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

**Vaadittu scope:** `read`

**Parametrit**

| Nimi | Missä | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- | --- |
| `id` | path | string | kyllä |  |

**Esimerkkipyyntö (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")
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (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"
  }
}
```

Virhetilat: `401`, `403`, `404`, `429`.

### PATCH /templates/{id}

Päivitä organisaatiosi mallipohja

**Vaadittu scope:** `full` · **Luojan rooli:** `admin`

**Parametrit**

| Nimi | Missä | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- | --- |
| `id` | path | string | kyllä |  |

**Pyynnön runko**

| Nimi | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- |
| `name` | string | ei |  |
| `summary` | string | ei |  |
| `description` | string | ei |  |
| `image` | string | ei |  |
| `tag` | string | ei |  |
| `launchMode` | `ssh` \| `jupyter` \| `app` | ei |  |
| `env` | object | ei |  |
| `secretEnv` | object | ei |  |
| `ports` | taulukko: object | ei |  |
| `startScript` | string | ei | Shell script run on the server after each start (up to 64 KB). Replaces the deprecated `onStart`. |
| `onStart` | string | ei | Deprecated name of `startScript`, read until 2027-05-31. Send `startScript`. |
| `args` | string | ei |  |
| `appPort` | integer tai null | ei |  |
| `defaultDiskGb` | integer | ei |  |
| `minVramGb` | integer | ei |  |
| `constraints` | object | ei |  |
| `recommendedVramGb` | integer tai null | ei |  |
| `inference` | object tai null | ei |  |
| `registryId` | string tai null | ei |  |
| `latestCudaTag` | boolean | ei |  |

**Esimerkkipyyntö (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",
})
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (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"
  }
}
```

Virhetilat: `400`, `401`, `403`, `404`, `429`.

### DELETE /templates/{id}

Poista mallipohja tai piilota se, kun palvelimet viittaavat siihen vielä

**Vaadittu scope:** `full` · **Luojan rooli:** `admin`

**Parametrit**

| Nimi | Missä | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- | --- |
| `id` | path | string | kyllä |  |

**Esimerkkipyyntö (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")
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (200)

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

Virhetilat: `401`, `403`, `404`, `429`.

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

Luo jakolinkki organisaatiosi mallipohjalle

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.

**Vaadittu scope:** `full` · **Oikeus:** `templates.manage`

**Parametrit**

| Nimi | Missä | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- | --- |
| `id` | path | string | kyllä |  |

**Pyynnön runko**

| Nimi | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- |
| `displayName` | string tai null | ei |  |
| `includeStartScript` | boolean | ei |  |
| `expiresInDays` | integer tai null | ei |  |

**Esimerkkipyyntö (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")
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (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"
  }
}
```

Virhetilat: `400`, `401`, `403`, `404`, `409`, `429`.

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

Peruuta mallipohjan jakolinkit

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

**Vaadittu scope:** `full` · **Oikeus:** `templates.manage`

**Parametrit**

| Nimi | Missä | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- | --- |
| `id` | path | string | kyllä |  |

**Esimerkkipyyntö (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")
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (200)

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

Virhetilat: `401`, `403`, `404`, `429`.

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

Mallipohjan jakolinkit

**Vaadittu scope:** `full` · **Oikeus:** `templates.manage`

**Parametrit**

| Nimi | Missä | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- | --- |
| `id` | path | string | kyllä |  |

**Esimerkkipyyntö (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")
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (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"
    }
  ]
}
```

Virhetilat: `401`, `403`, `404`, `429`.

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

Kopioi organisaatiosi mallipohja

**Vaadittu scope:** `full` · **Oikeus:** `templates.manage`

**Parametrit**

| Nimi | Missä | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- | --- |
| `id` | path | string | kyllä |  |

**Esimerkkipyyntö (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")
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (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"
  }
}
```

Virhetilat: `401`, `403`, `404`, `409`, `429`.

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

Mallipohjan versiohistoria, uusin ensin

Secret values are never included.

**Vaadittu scope:** `read`

**Parametrit**

| Nimi | Missä | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- | --- |
| `id` | path | string | kyllä |  |

**Esimerkkipyyntö (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")
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (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
      }
    }
  ]
}
```

Virhetilat: `401`, `403`, `404`, `429`.

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

Palauta vanhempi versio uutena

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

**Vaadittu scope:** `full` · **Oikeus:** `templates.manage`

**Parametrit**

| Nimi | Missä | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- | --- |
| `id` | path | string | kyllä |  |
| `rev` | path | string | kyllä |  |

**Esimerkkipyyntö (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")
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (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
}
```

Virhetilat: `401`, `403`, `404`, `429`.

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

Vie mallipohja siirrettävään tiedostoon

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

**Vaadittu scope:** `full` · **Oikeus:** `templates.manage`

**Parametrit**

| Nimi | Missä | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- | --- |
| `id` | path | string | kyllä |  |

**Esimerkkipyyntö (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")
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (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
  }
}
```

Virhetilat: `401`, `403`, `404`, `409`, `429`.

### POST /templates/import

Luo mallipohja viedystä tiedostosta

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

**Vaadittu scope:** `full` · **Oikeus:** `templates.manage` · **Turvallisesti toistettavissa avaimella:** `Idempotency-Key`

**Pyynnön runko**

| Nimi | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- |
| `json` | string | kyllä |  |

**Esimerkkipyyntö (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")
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (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"
  }
}
```

Virhetilat: `400`, `401`, `403`, `409`, `429`.

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

Kopioi jaettu mallipohja organisaatioosi

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

**Vaadittu scope:** `full` · **Oikeus:** `templates.manage` · **Turvallisesti toistettavissa avaimella:** `Idempotency-Key`

**Parametrit**

| Nimi | Missä | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- | --- |
| `token` | path | string | kyllä |  |

**Esimerkkipyyntö (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")
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (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"
  }
}
```

Virhetilat: `401`, `403`, `404`, `409`, `429`.

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

Ilmoita jaetusta mallipohjasta henkilökunnallemme (enintään 10 tunnissa organisaatiota kohden)

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.

**Vaadittu scope:** `servers` · **Turvallisesti toistettavissa avaimella:** `Idempotency-Key`

**Parametrit**

| Nimi | Missä | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- | --- |
| `token` | path | string | kyllä |  |

**Pyynnön runko**

| Nimi | Tyyppi | Pakollinen | Kuvaus |
| --- | --- | --- | --- |
| `details` | string | ei |  |
| `reason` | `malware` \| `illegal` \| `secrets` \| `other` | kyllä |  |

**Esimerkkipyyntö (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")
```

**Komentorivityökalu:** `apidly templates` ([CLI-viite](/docs/cli))

**Esimerkkivastaus** (201)

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

Virhetilat: `400`, `401`, `403`, `404`, `429`.
