# Riferimento API: Modelli

Modelli: ogni operazione dell'API v1 con scope, parametri, esempi in curl, JavaScript e Python e le risposte. Autenticazione, errori, paginazione, limiti di frequenza e idempotenza sono nella [panoramica del riferimento API](/docs/api-reference); vedi anche gli [SDK](/docs/sdks) e la [riga di comando](/docs/cli).

> Provalo con la tua chiave: crea una chiave API nella console, esegui `export APIDLY_API_KEY=...` nel terminale e incolla uno degli esempi curl qui sotto. I valori degli esempi sono indicativi. In questa pagina non c'è alcun campo per inserire una chiave.

Le descrizioni delle operazioni e dei campi provengono dalla definizione dell'API e sono in inglese.

| Operazione | Scope richiesto | Riepilogo |
| --- | --- | --- |
| `GET /templates` | `read` | Modelli pubblici e quelli della tua organizzazione |
| `POST /templates` | `full` | Creare un modello dell'organizzazione |
| `GET /templates/{id}` | `read` | Un modello |
| `PATCH /templates/{id}` | `full` | Aggiornare un modello della tua organizzazione |
| `DELETE /templates/{id}` | `full` | Eliminare un modello, oppure nasconderlo quando dei server vi fanno ancora riferimento |
| `POST /templates/{id}/share` | `full` | Creare un link di condivisione per un modello della tua organizzazione |
| `DELETE /templates/{id}/share` | `full` | Revocare i link di condivisione di un modello |
| `GET /templates/{id}/share` | `full` | Link di condivisione di un template |
| `POST /templates/{id}/duplicate` | `full` | Copiare un modello della tua organizzazione |
| `GET /templates/{id}/revisions` | `read` | Cronologia delle revisioni di un modello, dalla più recente |
| `POST /templates/{id}/revisions/{rev}/restore` | `full` | Ripristinare una revisione precedente come nuova |
| `GET /templates/{id}/export` | `full` | Esportare un template come file portatile |
| `POST /templates/import` | `full` | Creare un template da un file esportato |
| `POST /template-shares/{token}/import` | `full` | Copiare un template condiviso nella tua organizzazione |
| `POST /template-shares/{token}/report` | `servers` | Segnalare un modello condiviso al nostro staff (al massimo 10 all'ora per organizzazione) |

### GET /templates

Modelli pubblici e quelli della tua organizzazione

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.

**Scope richiesto:** `read`

**Parametri**

| Nome | In | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | no |  |
| `cursor` | query | string | no |  |
| `q` | query | string | no |  |
| `category` | query | `base` \| `llm` \| `image` \| `notebook` \| `training` \| `custom` | no |  |
| `source` | query | `builtin` \| `own` | no |  |
| `vramGb` | query | integer | no |  |

**Richiesta di esempio (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()
```

**Strumento da riga di comando:** `apidly templates`, `apidly export`, `apidly plan`, `apidly apply` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (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"
}
```

Stati di errore: `401`, `403`, `429`.

### POST /templates

Creare un modello dell'organizzazione

**Scope richiesto:** `full` · **Ruolo del creatore:** `admin` · **Ripetibile in sicurezza con:** `Idempotency-Key`

**Corpo della richiesta**

| Nome | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `name` | string | sì |  |
| `summary` | string | no |  |
| `description` | string | no |  |
| `image` | string | sì |  |
| `tag` | string | no |  |
| `launchMode` | `ssh` \| `jupyter` \| `app` | sì |  |
| `env` | object | no |  |
| `secretEnv` | object | no |  |
| `ports` | array di object | no |  |
| `startScript` | string | no | Shell script run on the server after each start (up to 64 KB). Replaces the deprecated `onStart`. |
| `onStart` | string | no | Deprecated name of `startScript`, read until 2027-05-31. Send `startScript`. |
| `args` | string | no |  |
| `appPort` | integer o null | no |  |
| `defaultDiskGb` | integer | no |  |
| `minVramGb` | integer | no |  |
| `constraints` | object | no |  |
| `recommendedVramGb` | integer o null | no |  |
| `inference` | object o null | no |  |
| `registryId` | string o null | no |  |
| `latestCudaTag` | boolean | no |  |
| `inheritSecretsFrom` | string | no |  |

**Richiesta di esempio (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",
})
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (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"
  }
}
```

Stati di errore: `400`, `401`, `403`, `409`, `429`.

### GET /templates/{id}

Un modello

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

**Scope richiesto:** `read`

**Parametri**

| Nome | In | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- | --- |
| `id` | path | string | sì |  |

**Richiesta di esempio (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")
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (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"
  }
}
```

Stati di errore: `401`, `403`, `404`, `429`.

### PATCH /templates/{id}

Aggiornare un modello della tua organizzazione

**Scope richiesto:** `full` · **Ruolo del creatore:** `admin`

**Parametri**

| Nome | In | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- | --- |
| `id` | path | string | sì |  |

**Corpo della richiesta**

| Nome | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `name` | string | no |  |
| `summary` | string | no |  |
| `description` | string | no |  |
| `image` | string | no |  |
| `tag` | string | no |  |
| `launchMode` | `ssh` \| `jupyter` \| `app` | no |  |
| `env` | object | no |  |
| `secretEnv` | object | no |  |
| `ports` | array di object | no |  |
| `startScript` | string | no | Shell script run on the server after each start (up to 64 KB). Replaces the deprecated `onStart`. |
| `onStart` | string | no | Deprecated name of `startScript`, read until 2027-05-31. Send `startScript`. |
| `args` | string | no |  |
| `appPort` | integer o null | no |  |
| `defaultDiskGb` | integer | no |  |
| `minVramGb` | integer | no |  |
| `constraints` | object | no |  |
| `recommendedVramGb` | integer o null | no |  |
| `inference` | object o null | no |  |
| `registryId` | string o null | no |  |
| `latestCudaTag` | boolean | no |  |

**Richiesta di esempio (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",
})
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (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"
  }
}
```

Stati di errore: `400`, `401`, `403`, `404`, `429`.

### DELETE /templates/{id}

Eliminare un modello, oppure nasconderlo quando dei server vi fanno ancora riferimento

**Scope richiesto:** `full` · **Ruolo del creatore:** `admin`

**Parametri**

| Nome | In | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- | --- |
| `id` | path | string | sì |  |

**Richiesta di esempio (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")
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (200)

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

Stati di errore: `401`, `403`, `404`, `429`.

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

Creare un link di condivisione per un modello della tua organizzazione

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.

**Scope richiesto:** `full` · **Permesso:** `templates.manage`

**Parametri**

| Nome | In | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- | --- |
| `id` | path | string | sì |  |

**Corpo della richiesta**

| Nome | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `displayName` | string o null | no |  |
| `includeStartScript` | boolean | no |  |
| `expiresInDays` | integer o null | no |  |

**Richiesta di esempio (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")
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (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"
  }
}
```

Stati di errore: `400`, `401`, `403`, `404`, `409`, `429`.

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

Revocare i link di condivisione di un modello

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

**Scope richiesto:** `full` · **Permesso:** `templates.manage`

**Parametri**

| Nome | In | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- | --- |
| `id` | path | string | sì |  |

**Richiesta di esempio (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")
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (200)

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

Stati di errore: `401`, `403`, `404`, `429`.

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

Link di condivisione di un template

**Scope richiesto:** `full` · **Permesso:** `templates.manage`

**Parametri**

| Nome | In | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- | --- |
| `id` | path | string | sì |  |

**Richiesta di esempio (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")
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (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"
    }
  ]
}
```

Stati di errore: `401`, `403`, `404`, `429`.

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

Copiare un modello della tua organizzazione

**Scope richiesto:** `full` · **Permesso:** `templates.manage`

**Parametri**

| Nome | In | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- | --- |
| `id` | path | string | sì |  |

**Richiesta di esempio (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")
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (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"
  }
}
```

Stati di errore: `401`, `403`, `404`, `409`, `429`.

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

Cronologia delle revisioni di un modello, dalla più recente

Secret values are never included.

**Scope richiesto:** `read`

**Parametri**

| Nome | In | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- | --- |
| `id` | path | string | sì |  |

**Richiesta di esempio (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")
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (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
      }
    }
  ]
}
```

Stati di errore: `401`, `403`, `404`, `429`.

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

Ripristinare una revisione precedente come nuova

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

**Scope richiesto:** `full` · **Permesso:** `templates.manage`

**Parametri**

| Nome | In | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- | --- |
| `id` | path | string | sì |  |
| `rev` | path | string | sì |  |

**Richiesta di esempio (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")
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (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
}
```

Stati di errore: `401`, `403`, `404`, `429`.

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

Esportare un template come file portatile

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

**Scope richiesto:** `full` · **Permesso:** `templates.manage`

**Parametri**

| Nome | In | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- | --- |
| `id` | path | string | sì |  |

**Richiesta di esempio (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")
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (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
  }
}
```

Stati di errore: `401`, `403`, `404`, `409`, `429`.

### POST /templates/import

Creare un template da un file esportato

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

**Scope richiesto:** `full` · **Permesso:** `templates.manage` · **Ripetibile in sicurezza con:** `Idempotency-Key`

**Corpo della richiesta**

| Nome | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `json` | string | sì |  |

**Richiesta di esempio (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")
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (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"
  }
}
```

Stati di errore: `400`, `401`, `403`, `409`, `429`.

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

Copiare un template condiviso nella tua organizzazione

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

**Scope richiesto:** `full` · **Permesso:** `templates.manage` · **Ripetibile in sicurezza con:** `Idempotency-Key`

**Parametri**

| Nome | In | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- | --- |
| `token` | path | string | sì |  |

**Richiesta di esempio (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")
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (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"
  }
}
```

Stati di errore: `401`, `403`, `404`, `409`, `429`.

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

Segnalare un modello condiviso al nostro staff (al massimo 10 all'ora per organizzazione)

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.

**Scope richiesto:** `servers` · **Ripetibile in sicurezza con:** `Idempotency-Key`

**Parametri**

| Nome | In | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- | --- |
| `token` | path | string | sì |  |

**Corpo della richiesta**

| Nome | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `details` | string | no |  |
| `reason` | `malware` \| `illegal` \| `secrets` \| `other` | sì |  |

**Richiesta di esempio (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")
```

**Strumento da riga di comando:** `apidly templates` ([Riferimento CLI](/docs/cli))

**Risposta di esempio** (201)

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

Stati di errore: `400`, `401`, `403`, `404`, `429`.
