# API-referens: Mallar

Mallar: alla åtgärder i API v1 med scope, parametrar, exempel i curl, JavaScript och Python samt svar. Autentisering, fel, paginering, gränser och idempotens finns i [översikten över API-referensen](/docs/api-reference); se även [SDK:erna](/docs/sdks) och [kommandoraden](/docs/cli).

> Prova med din nyckel: skapa en API-nyckel i konsolen, kör `export APIDLY_API_KEY=...` i terminalen och klistra in ett curl-exempel nedan. Exempelvärdena är illustrativa. Det finns inget fält för att ange en nyckel på den här sidan.

Beskrivningarna av operationer och fält kommer från API-definitionen och är på engelska.

| Åtgärd | Nödvändigt scope | Sammanfattning |
| --- | --- | --- |
| `GET /templates` | `read` | Offentliga mallar och din organisations egna |
| `POST /templates` | `full` | Skapa en organisationsmall |
| `GET /templates/{id}` | `read` | En mall |
| `PATCH /templates/{id}` | `full` | Uppdatera en av din organisations mallar |
| `DELETE /templates/{id}` | `full` | Ta bort en mall, eller dölj den när servrar fortfarande refererar till den |
| `POST /templates/{id}/share` | `full` | Skapa en delningslänk för en av din organisations mallar |
| `DELETE /templates/{id}/share` | `full` | Återkalla delningslänkar för en mall |
| `GET /templates/{id}/share` | `full` | Delningslänkar för en mall |
| `POST /templates/{id}/duplicate` | `full` | Kopiera en av din organisations mallar |
| `GET /templates/{id}/revisions` | `read` | Revisionshistorik för en mall, nyaste först |
| `POST /templates/{id}/revisions/{rev}/restore` | `full` | Återställ en äldre revision som en ny |
| `GET /templates/{id}/export` | `full` | Exportera en mall som en flyttbar fil |
| `POST /templates/import` | `full` | Skapa en mall från en exporterad fil |
| `POST /template-shares/{token}/import` | `full` | Kopiera en delad mall till din organisation |
| `POST /template-shares/{token}/report` | `servers` | Anmäl en delad mall till vår personal (högst 10 i timmen per organisation) |

### GET /templates

Offentliga mallar och din organisations egna

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.

**Nödvändigt scope:** `read`

**Parametrar**

| Namn | I | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | nej |  |
| `cursor` | query | string | nej |  |
| `q` | query | string | nej |  |
| `category` | query | `base` \| `llm` \| `image` \| `notebook` \| `training` \| `custom` | nej |  |
| `source` | query | `builtin` \| `own` | nej |  |
| `vramGb` | query | integer | nej |  |

**Exempelförfrågan (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()
```

**Kommandoradsverktyg:** `apidly templates`, `apidly export`, `apidly plan`, `apidly apply` ([CLI-referens](/docs/cli))

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

Felstatus: `401`, `403`, `429`.

### POST /templates

Skapa en organisationsmall

**Nödvändigt scope:** `full` · **Skaparens roll:** `admin` · **Säker att upprepa med:** `Idempotency-Key`

**Förfrågans innehåll**

| Namn | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- |
| `name` | string | ja |  |
| `summary` | string | nej |  |
| `description` | string | nej |  |
| `image` | string | ja |  |
| `tag` | string | nej |  |
| `launchMode` | `ssh` \| `jupyter` \| `app` | ja |  |
| `env` | object | nej |  |
| `secretEnv` | object | nej |  |
| `ports` | array av object | nej |  |
| `startScript` | string | nej | Shell script run on the server after each start (up to 64 KB). Replaces the deprecated `onStart`. |
| `onStart` | string | nej | Deprecated name of `startScript`, read until 2027-05-31. Send `startScript`. |
| `args` | string | nej |  |
| `appPort` | integer eller null | nej |  |
| `defaultDiskGb` | integer | nej |  |
| `minVramGb` | integer | nej |  |
| `constraints` | object | nej |  |
| `recommendedVramGb` | integer eller null | nej |  |
| `inference` | object eller null | nej |  |
| `registryId` | string eller null | nej |  |
| `latestCudaTag` | boolean | nej |  |
| `inheritSecretsFrom` | string | nej |  |

**Exempelförfrågan (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",
})
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

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

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

### GET /templates/{id}

En mall

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

**Nödvändigt scope:** `read`

**Parametrar**

| Namn | I | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- | --- |
| `id` | path | string | ja |  |

**Exempelförfrågan (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")
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

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

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

### PATCH /templates/{id}

Uppdatera en av din organisations mallar

**Nödvändigt scope:** `full` · **Skaparens roll:** `admin`

**Parametrar**

| Namn | I | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- | --- |
| `id` | path | string | ja |  |

**Förfrågans innehåll**

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

**Exempelförfrågan (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",
})
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

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

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

### DELETE /templates/{id}

Ta bort en mall, eller dölj den när servrar fortfarande refererar till den

**Nödvändigt scope:** `full` · **Skaparens roll:** `admin`

**Parametrar**

| Namn | I | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- | --- |
| `id` | path | string | ja |  |

**Exempelförfrågan (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")
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

**Exempelsvar** (200)

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

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

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

Skapa en delningslänk för en av din organisations mallar

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.

**Nödvändigt scope:** `full` · **Behörighet:** `templates.manage`

**Parametrar**

| Namn | I | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- | --- |
| `id` | path | string | ja |  |

**Förfrågans innehåll**

| Namn | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- |
| `displayName` | string eller null | nej |  |
| `includeStartScript` | boolean | nej |  |
| `expiresInDays` | integer eller null | nej |  |

**Exempelförfrågan (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")
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

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

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

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

Återkalla delningslänkar för en mall

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

**Nödvändigt scope:** `full` · **Behörighet:** `templates.manage`

**Parametrar**

| Namn | I | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- | --- |
| `id` | path | string | ja |  |

**Exempelförfrågan (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")
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

**Exempelsvar** (200)

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

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

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

Delningslänkar för en mall

**Nödvändigt scope:** `full` · **Behörighet:** `templates.manage`

**Parametrar**

| Namn | I | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- | --- |
| `id` | path | string | ja |  |

**Exempelförfrågan (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")
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

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

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

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

Kopiera en av din organisations mallar

**Nödvändigt scope:** `full` · **Behörighet:** `templates.manage`

**Parametrar**

| Namn | I | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- | --- |
| `id` | path | string | ja |  |

**Exempelförfrågan (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")
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

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

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

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

Revisionshistorik för en mall, nyaste först

Secret values are never included.

**Nödvändigt scope:** `read`

**Parametrar**

| Namn | I | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- | --- |
| `id` | path | string | ja |  |

**Exempelförfrågan (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")
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

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

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

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

Återställ en äldre revision som en ny

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

**Nödvändigt scope:** `full` · **Behörighet:** `templates.manage`

**Parametrar**

| Namn | I | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- | --- |
| `id` | path | string | ja |  |
| `rev` | path | string | ja |  |

**Exempelförfrågan (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")
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

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

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

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

Exportera en mall som en flyttbar fil

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

**Nödvändigt scope:** `full` · **Behörighet:** `templates.manage`

**Parametrar**

| Namn | I | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- | --- |
| `id` | path | string | ja |  |

**Exempelförfrågan (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")
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

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

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

### POST /templates/import

Skapa en mall från en exporterad fil

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

**Nödvändigt scope:** `full` · **Behörighet:** `templates.manage` · **Säker att upprepa med:** `Idempotency-Key`

**Förfrågans innehåll**

| Namn | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- |
| `json` | string | ja |  |

**Exempelförfrågan (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")
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

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

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

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

Kopiera en delad mall till din organisation

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

**Nödvändigt scope:** `full` · **Behörighet:** `templates.manage` · **Säker att upprepa med:** `Idempotency-Key`

**Parametrar**

| Namn | I | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- | --- |
| `token` | path | string | ja |  |

**Exempelförfrågan (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")
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

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

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

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

Anmäl en delad mall till vår personal (högst 10 i timmen per organisation)

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.

**Nödvändigt scope:** `servers` · **Säker att upprepa med:** `Idempotency-Key`

**Parametrar**

| Namn | I | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- | --- |
| `token` | path | string | ja |  |

**Förfrågans innehåll**

| Namn | Typ | Obligatorisk | Beskrivning |
| --- | --- | --- | --- |
| `details` | string | nej |  |
| `reason` | `malware` \| `illegal` \| `secrets` \| `other` | ja |  |

**Exempelförfrågan (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")
```

**Kommandoradsverktyg:** `apidly templates` ([CLI-referens](/docs/cli))

**Exempelsvar** (201)

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

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