# مرجع واجهة API: القوالب

القوالب: جميع عمليات API v1 مع النطاق (scope) المطلوب والمعاملات وأمثلة بلغات curl وJavaScript وPython والاستجابات. المصادقة والأخطاء وتقسيم الصفحات والحدود وتكرار الطلبات الآمن موضحة في [نظرة عامة على مرجع API](/docs/api-reference)؛ راجع أيضًا [حزم SDK](/docs/sdks) و[سطر الأوامر](/docs/cli).

> جرّبه بمفتاحك: أنشئ مفتاح API من وحدة التحكم، ونفّذ `export APIDLY_API_KEY=...` في الطرفية، ثم الصق أي مثال curl أدناه. القيم في الأمثلة توضيحية فقط. لا يوجد في هذه الصفحة حقل لإدخال المفتاح.

أوصاف العمليات والحقول مأخوذة من تعريف API وهي بالإنجليزية.

| العملية | النطاق المطلوب | الملخص |
| --- | --- | --- |
| `GET /templates` | `read` | القوالب العامة وقوالب مؤسستك |
| `POST /templates` | `full` | إنشاء قالب للمؤسسة |
| `GET /templates/{id}` | `read` | قالب واحد |
| `PATCH /templates/{id}` | `full` | تحديث أحد قوالب مؤسستك |
| `DELETE /templates/{id}` | `full` | حذف قالب، أو إخفاؤه عندما لا تزال خوادم تشير إليه |
| `POST /templates/{id}/share` | `full` | إنشاء رابط مشاركة لأحد قوالب مؤسستك |
| `DELETE /templates/{id}/share` | `full` | إلغاء روابط المشاركة الخاصة بقالب |
| `GET /templates/{id}/share` | `full` | روابط مشاركة قالب |
| `POST /templates/{id}/duplicate` | `full` | نسخ أحد قوالب مؤسستك |
| `GET /templates/{id}/revisions` | `read` | سجل مراجعات قالب، الأحدث أولاً |
| `POST /templates/{id}/revisions/{rev}/restore` | `full` | استعادة مراجعة قديمة كمراجعة جديدة |
| `GET /templates/{id}/export` | `full` | تصدير قالب في ملف قابل للنقل |
| `POST /templates/import` | `full` | إنشاء قالب من ملف مُصدَّر |
| `POST /template-shares/{token}/import` | `full` | نسخ قالب مشترك إلى مؤسستك |
| `POST /template-shares/{token}/report` | `servers` | الإبلاغ عن قالب مشترك إلى فريقنا (10 بلاغات في الساعة كحد أقصى لكل مؤسسة) |

### GET /templates

القوالب العامة وقوالب مؤسستك

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

**النطاق المطلوب:** `read`

**المعاملات**

| الاسم | الموضع | النوع | مطلوب | الوصف |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | لا |  |
| `cursor` | query | string | لا |  |
| `q` | query | string | لا |  |
| `category` | query | `base` \| `llm` \| `image` \| `notebook` \| `training` \| `custom` | لا |  |
| `source` | query | `builtin` \| `own` | لا |  |
| `vramGb` | query | integer | لا |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates`, `apidly export`, `apidly plan`, `apidly apply` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (200)

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

حالات الخطأ: `401`, `403`, `429`.

### POST /templates

إنشاء قالب للمؤسسة

**النطاق المطلوب:** `full` · **دور المنشئ:** `admin` · **آمن للتكرار باستخدام:** `Idempotency-Key`

**نص الطلب**

| الاسم | النوع | مطلوب | الوصف |
| --- | --- | --- | --- |
| `name` | string | نعم |  |
| `summary` | string | لا |  |
| `description` | string | لا |  |
| `image` | string | نعم |  |
| `tag` | string | لا |  |
| `launchMode` | `ssh` \| `jupyter` \| `app` | نعم |  |
| `env` | object | لا |  |
| `secretEnv` | object | لا |  |
| `ports` | مصفوفة من object | لا |  |
| `startScript` | string | لا | Shell script run on the server after each start (up to 64 KB). Replaces the deprecated `onStart`. |
| `onStart` | string | لا | Deprecated name of `startScript`, read until 2027-05-31. Send `startScript`. |
| `args` | string | لا |  |
| `appPort` | integer أو null | لا |  |
| `defaultDiskGb` | integer | لا |  |
| `minVramGb` | integer | لا |  |
| `constraints` | object | لا |  |
| `recommendedVramGb` | integer أو null | لا |  |
| `inference` | object أو null | لا |  |
| `registryId` | string أو null | لا |  |
| `latestCudaTag` | boolean | لا |  |
| `inheritSecretsFrom` | string | لا |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (201)

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

حالات الخطأ: `400`, `401`, `403`, `409`, `429`.

### GET /templates/{id}

قالب واحد

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

**النطاق المطلوب:** `read`

**المعاملات**

| الاسم | الموضع | النوع | مطلوب | الوصف |
| --- | --- | --- | --- | --- |
| `id` | path | string | نعم |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (200)

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

حالات الخطأ: `401`, `403`, `404`, `429`.

### PATCH /templates/{id}

تحديث أحد قوالب مؤسستك

**النطاق المطلوب:** `full` · **دور المنشئ:** `admin`

**المعاملات**

| الاسم | الموضع | النوع | مطلوب | الوصف |
| --- | --- | --- | --- | --- |
| `id` | path | string | نعم |  |

**نص الطلب**

| الاسم | النوع | مطلوب | الوصف |
| --- | --- | --- | --- |
| `name` | string | لا |  |
| `summary` | string | لا |  |
| `description` | string | لا |  |
| `image` | string | لا |  |
| `tag` | string | لا |  |
| `launchMode` | `ssh` \| `jupyter` \| `app` | لا |  |
| `env` | object | لا |  |
| `secretEnv` | object | لا |  |
| `ports` | مصفوفة من object | لا |  |
| `startScript` | string | لا | Shell script run on the server after each start (up to 64 KB). Replaces the deprecated `onStart`. |
| `onStart` | string | لا | Deprecated name of `startScript`, read until 2027-05-31. Send `startScript`. |
| `args` | string | لا |  |
| `appPort` | integer أو null | لا |  |
| `defaultDiskGb` | integer | لا |  |
| `minVramGb` | integer | لا |  |
| `constraints` | object | لا |  |
| `recommendedVramGb` | integer أو null | لا |  |
| `inference` | object أو null | لا |  |
| `registryId` | string أو null | لا |  |
| `latestCudaTag` | boolean | لا |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (200)

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

حالات الخطأ: `400`, `401`, `403`, `404`, `429`.

### DELETE /templates/{id}

حذف قالب، أو إخفاؤه عندما لا تزال خوادم تشير إليه

**النطاق المطلوب:** `full` · **دور المنشئ:** `admin`

**المعاملات**

| الاسم | الموضع | النوع | مطلوب | الوصف |
| --- | --- | --- | --- | --- |
| `id` | path | string | نعم |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (200)

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

حالات الخطأ: `401`, `403`, `404`, `429`.

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

إنشاء رابط مشاركة لأحد قوالب مؤسستك

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

**النطاق المطلوب:** `full` · **الإذن:** `templates.manage`

**المعاملات**

| الاسم | الموضع | النوع | مطلوب | الوصف |
| --- | --- | --- | --- | --- |
| `id` | path | string | نعم |  |

**نص الطلب**

| الاسم | النوع | مطلوب | الوصف |
| --- | --- | --- | --- |
| `displayName` | string أو null | لا |  |
| `includeStartScript` | boolean | لا |  |
| `expiresInDays` | integer أو null | لا |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (201)

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

حالات الخطأ: `400`, `401`, `403`, `404`, `409`, `429`.

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

إلغاء روابط المشاركة الخاصة بقالب

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

**النطاق المطلوب:** `full` · **الإذن:** `templates.manage`

**المعاملات**

| الاسم | الموضع | النوع | مطلوب | الوصف |
| --- | --- | --- | --- | --- |
| `id` | path | string | نعم |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (200)

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

حالات الخطأ: `401`, `403`, `404`, `429`.

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

روابط مشاركة قالب

**النطاق المطلوب:** `full` · **الإذن:** `templates.manage`

**المعاملات**

| الاسم | الموضع | النوع | مطلوب | الوصف |
| --- | --- | --- | --- | --- |
| `id` | path | string | نعم |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (200)

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

حالات الخطأ: `401`, `403`, `404`, `429`.

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

نسخ أحد قوالب مؤسستك

**النطاق المطلوب:** `full` · **الإذن:** `templates.manage`

**المعاملات**

| الاسم | الموضع | النوع | مطلوب | الوصف |
| --- | --- | --- | --- | --- |
| `id` | path | string | نعم |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (201)

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

حالات الخطأ: `401`, `403`, `404`, `409`, `429`.

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

سجل مراجعات قالب، الأحدث أولاً

Secret values are never included.

**النطاق المطلوب:** `read`

**المعاملات**

| الاسم | الموضع | النوع | مطلوب | الوصف |
| --- | --- | --- | --- | --- |
| `id` | path | string | نعم |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (200)

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

حالات الخطأ: `401`, `403`, `404`, `429`.

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

استعادة مراجعة قديمة كمراجعة جديدة

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

**النطاق المطلوب:** `full` · **الإذن:** `templates.manage`

**المعاملات**

| الاسم | الموضع | النوع | مطلوب | الوصف |
| --- | --- | --- | --- | --- |
| `id` | path | string | نعم |  |
| `rev` | path | string | نعم |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (200)

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

حالات الخطأ: `401`, `403`, `404`, `429`.

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

تصدير قالب في ملف قابل للنقل

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

**النطاق المطلوب:** `full` · **الإذن:** `templates.manage`

**المعاملات**

| الاسم | الموضع | النوع | مطلوب | الوصف |
| --- | --- | --- | --- | --- |
| `id` | path | string | نعم |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (200)

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

حالات الخطأ: `401`, `403`, `404`, `409`, `429`.

### POST /templates/import

إنشاء قالب من ملف مُصدَّر

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

**النطاق المطلوب:** `full` · **الإذن:** `templates.manage` · **آمن للتكرار باستخدام:** `Idempotency-Key`

**نص الطلب**

| الاسم | النوع | مطلوب | الوصف |
| --- | --- | --- | --- |
| `json` | string | نعم |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (201)

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

حالات الخطأ: `400`, `401`, `403`, `409`, `429`.

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

نسخ قالب مشترك إلى مؤسستك

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

**النطاق المطلوب:** `full` · **الإذن:** `templates.manage` · **آمن للتكرار باستخدام:** `Idempotency-Key`

**المعاملات**

| الاسم | الموضع | النوع | مطلوب | الوصف |
| --- | --- | --- | --- | --- |
| `token` | path | string | نعم |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (201)

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

حالات الخطأ: `401`, `403`, `404`, `409`, `429`.

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

الإبلاغ عن قالب مشترك إلى فريقنا (10 بلاغات في الساعة كحد أقصى لكل مؤسسة)

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

**النطاق المطلوب:** `servers` · **آمن للتكرار باستخدام:** `Idempotency-Key`

**المعاملات**

| الاسم | الموضع | النوع | مطلوب | الوصف |
| --- | --- | --- | --- | --- |
| `token` | path | string | نعم |  |

**نص الطلب**

| الاسم | النوع | مطلوب | الوصف |
| --- | --- | --- | --- |
| `details` | string | لا |  |
| `reason` | `malware` \| `illegal` \| `secrets` \| `other` | نعم |  |

**مثال على الطلب (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

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

**أداة سطر الأوامر:** `apidly templates` ([مرجع CLI](/docs/cli))

**مثال على الاستجابة** (201)

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

حالات الخطأ: `400`, `401`, `403`, `404`, `429`.
