# Referência da API: Modelos

Modelos: todas as operações da API v1 com escopo, parâmetros, exemplos em curl, JavaScript e Python, e respostas. Autenticação, erros, paginação, limites e idempotência estão na [visão geral da referência da API](/docs/api-reference); veja também os [SDKs](/docs/sdks) e a [linha de comando](/docs/cli).

> Teste com a sua chave: crie uma chave de API no console, execute `export APIDLY_API_KEY=...` no terminal e cole qualquer exemplo de curl abaixo. Os valores dos exemplos são ilustrativos. Esta página não tem campo para digitar uma chave.

As descrições das operações e dos campos vêm da definição da API e estão em inglês.

| Operação | Escopo necessário | Resumo |
| --- | --- | --- |
| `GET /templates` | `read` | Modelos públicos e os da sua organização |
| `POST /templates` | `full` | Criar um modelo da organização |
| `GET /templates/{id}` | `read` | Um modelo |
| `PATCH /templates/{id}` | `full` | Atualizar um modelo da sua organização |
| `DELETE /templates/{id}` | `full` | Excluir um modelo, ou ocultá-lo quando servidores ainda o referenciam |
| `POST /templates/{id}/share` | `full` | Criar um link de compartilhamento para um modelo da sua organização |
| `DELETE /templates/{id}/share` | `full` | Revogar os links de compartilhamento de um modelo |
| `GET /templates/{id}/share` | `full` | Links de compartilhamento de um template |
| `POST /templates/{id}/duplicate` | `full` | Copiar um modelo da sua organização |
| `GET /templates/{id}/revisions` | `read` | Histórico de revisões de um modelo, da mais recente à mais antiga |
| `POST /templates/{id}/revisions/{rev}/restore` | `full` | Restaurar uma revisão antiga como uma nova |
| `GET /templates/{id}/export` | `full` | Exportar um template como arquivo portátil |
| `POST /templates/import` | `full` | Criar um template a partir de um arquivo exportado |
| `POST /template-shares/{token}/import` | `full` | Copiar um template compartilhado para sua organização |
| `POST /template-shares/{token}/report` | `servers` | Denunciar um modelo compartilhado à nossa equipe (no máximo 10 por hora por organização) |

### GET /templates

Modelos públicos e os da sua organização

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.

**Escopo necessário:** `read`

**Parâmetros**

| Nome | Em | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | não |  |
| `cursor` | query | string | não |  |
| `q` | query | string | não |  |
| `category` | query | `base` \| `llm` \| `image` \| `notebook` \| `training` \| `custom` | não |  |
| `source` | query | `builtin` \| `own` | não |  |
| `vramGb` | query | integer | não |  |

**Exemplo de requisição (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()
```

**Ferramenta de linha de comando:** `apidly templates`, `apidly export`, `apidly plan`, `apidly apply` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (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"
}
```

Status de erro: `401`, `403`, `429`.

### POST /templates

Criar um modelo da organização

**Escopo necessário:** `full` · **Papel do criador:** `admin` · **Pode ser repetida com:** `Idempotency-Key`

**Corpo da requisição**

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

**Exemplo de requisição (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",
})
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (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"
  }
}
```

Status de erro: `400`, `401`, `403`, `409`, `429`.

### GET /templates/{id}

Um modelo

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

**Escopo necessário:** `read`

**Parâmetros**

| Nome | Em | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- | --- |
| `id` | path | string | sim |  |

**Exemplo de requisição (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")
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (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"
  }
}
```

Status de erro: `401`, `403`, `404`, `429`.

### PATCH /templates/{id}

Atualizar um modelo da sua organização

**Escopo necessário:** `full` · **Papel do criador:** `admin`

**Parâmetros**

| Nome | Em | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- | --- |
| `id` | path | string | sim |  |

**Corpo da requisição**

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

**Exemplo de requisição (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",
})
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (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"
  }
}
```

Status de erro: `400`, `401`, `403`, `404`, `429`.

### DELETE /templates/{id}

Excluir um modelo, ou ocultá-lo quando servidores ainda o referenciam

**Escopo necessário:** `full` · **Papel do criador:** `admin`

**Parâmetros**

| Nome | Em | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- | --- |
| `id` | path | string | sim |  |

**Exemplo de requisição (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")
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (200)

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

Status de erro: `401`, `403`, `404`, `429`.

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

Criar um link de compartilhamento para um modelo da sua organização

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.

**Escopo necessário:** `full` · **Permissão:** `templates.manage`

**Parâmetros**

| Nome | Em | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- | --- |
| `id` | path | string | sim |  |

**Corpo da requisição**

| Nome | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- |
| `displayName` | string ou null | não |  |
| `includeStartScript` | boolean | não |  |
| `expiresInDays` | integer ou null | não |  |

**Exemplo de requisição (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")
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (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"
  }
}
```

Status de erro: `400`, `401`, `403`, `404`, `409`, `429`.

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

Revogar os links de compartilhamento de um modelo

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

**Escopo necessário:** `full` · **Permissão:** `templates.manage`

**Parâmetros**

| Nome | Em | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- | --- |
| `id` | path | string | sim |  |

**Exemplo de requisição (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")
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (200)

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

Status de erro: `401`, `403`, `404`, `429`.

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

Links de compartilhamento de um template

**Escopo necessário:** `full` · **Permissão:** `templates.manage`

**Parâmetros**

| Nome | Em | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- | --- |
| `id` | path | string | sim |  |

**Exemplo de requisição (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")
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (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"
    }
  ]
}
```

Status de erro: `401`, `403`, `404`, `429`.

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

Copiar um modelo da sua organização

**Escopo necessário:** `full` · **Permissão:** `templates.manage`

**Parâmetros**

| Nome | Em | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- | --- |
| `id` | path | string | sim |  |

**Exemplo de requisição (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")
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (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"
  }
}
```

Status de erro: `401`, `403`, `404`, `409`, `429`.

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

Histórico de revisões de um modelo, da mais recente à mais antiga

Secret values are never included.

**Escopo necessário:** `read`

**Parâmetros**

| Nome | Em | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- | --- |
| `id` | path | string | sim |  |

**Exemplo de requisição (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")
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (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
      }
    }
  ]
}
```

Status de erro: `401`, `403`, `404`, `429`.

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

Restaurar uma revisão antiga como uma nova

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

**Escopo necessário:** `full` · **Permissão:** `templates.manage`

**Parâmetros**

| Nome | Em | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- | --- |
| `id` | path | string | sim |  |
| `rev` | path | string | sim |  |

**Exemplo de requisição (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")
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (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
}
```

Status de erro: `401`, `403`, `404`, `429`.

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

Exportar um template como arquivo portátil

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

**Escopo necessário:** `full` · **Permissão:** `templates.manage`

**Parâmetros**

| Nome | Em | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- | --- |
| `id` | path | string | sim |  |

**Exemplo de requisição (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")
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (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
  }
}
```

Status de erro: `401`, `403`, `404`, `409`, `429`.

### POST /templates/import

Criar um template a partir de um arquivo exportado

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

**Escopo necessário:** `full` · **Permissão:** `templates.manage` · **Pode ser repetida com:** `Idempotency-Key`

**Corpo da requisição**

| Nome | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- |
| `json` | string | sim |  |

**Exemplo de requisição (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")
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (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"
  }
}
```

Status de erro: `400`, `401`, `403`, `409`, `429`.

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

Copiar um template compartilhado para sua organização

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

**Escopo necessário:** `full` · **Permissão:** `templates.manage` · **Pode ser repetida com:** `Idempotency-Key`

**Parâmetros**

| Nome | Em | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- | --- |
| `token` | path | string | sim |  |

**Exemplo de requisição (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")
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (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"
  }
}
```

Status de erro: `401`, `403`, `404`, `409`, `429`.

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

Denunciar um modelo compartilhado à nossa equipe (no máximo 10 por hora por organização)

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.

**Escopo necessário:** `servers` · **Pode ser repetida com:** `Idempotency-Key`

**Parâmetros**

| Nome | Em | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- | --- |
| `token` | path | string | sim |  |

**Corpo da requisição**

| Nome | Tipo | Obrigatório | Descrição |
| --- | --- | --- | --- |
| `details` | string | não |  |
| `reason` | `malware` \| `illegal` \| `secrets` \| `other` | sim |  |

**Exemplo de requisição (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")
```

**Ferramenta de linha de comando:** `apidly templates` ([Referência da CLI](/docs/cli))

**Exemplo de resposta** (201)

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

Status de erro: `400`, `401`, `403`, `404`, `429`.
