# Tài liệu tham chiếu API: Danh mục

Danh mục: mọi thao tác của API v1 kèm scope cần có, tham số, ví dụ bằng curl, JavaScript và Python, cùng phản hồi. Xác thực, lỗi, phân trang, giới hạn tốc độ và tính idempotent nằm trong [tổng quan tài liệu API](/docs/api-reference); xem thêm [SDK](/docs/sdks) và [dòng lệnh](/docs/cli).

> Thử với khóa của bạn: tạo khóa API trong bảng điều khiển, chạy `export APIDLY_API_KEY=...` trong terminal rồi dán một ví dụ curl bên dưới. Giá trị trong ví dụ chỉ mang tính minh họa. Trang này không có ô nhập khóa.

Mô tả của các thao tác và trường lấy từ định nghĩa API và giữ nguyên tiếng Anh.

| Thao tác | Scope cần có | Tóm tắt |
| --- | --- | --- |
| `GET /plans` | `read` | Gói dịch vụ kèm giá và tình trạng sẵn có |
| `GET /gpus` | `read` | Các mẫu GPU với giá thấp nhất và tình trạng sẵn có tốt nhất |
| `GET /benchmarks` | `read` | Hiệu năng đo được theo lớp GPU |
| `GET /regions` | `read` | Các khu vực nơi máy chủ của bạn chạy |
| `GET /quickstart` | `read` | Mẫu và gói mà Bắt đầu nhanh sẽ chọn cho một mục tiêu |
| `GET /plans/{id}/history` | `read` | Lịch sử giá và tình trạng sẵn có 30 ngày của một gói |
| `GET /plan-filters` | `read` | Bộ lọc gói đã lưu của tổ chức |
| `POST /plan-filters` | `servers` | Lưu bộ lọc gói dưới một tên |
| `DELETE /plan-filters/{id}` | `servers` | Xóa bộ lọc gói đã lưu |
| `GET /plan-watches` | `read` | Các gói mà thành viên sở hữu khóa đang theo dõi |
| `POST /plan-watches` | `servers` | Nhận một email khi gói chưa có sẵn quay lại |
| `DELETE /plan-watches/{planId}` | `servers` | Thôi theo dõi một gói |

### GET /plans

Gói dịch vụ kèm giá và tình trạng sẵn có

Filters and sort run on the server with the pricing page's rules. `minVramGb` is the memory of each GPU. `minRamGb`, `minVcpus`, `region` and `hosting` keep plans whose machines can meet them (pass the same values as `constraints` when you request the server). `maxPriceUsd` is per hour, for the cheapest option matching `region` and `hosting`. `sort`: `recommended` (default), `price` (cheapest first), `perf` (highest Apidly performance index first), `perf_per_dollar` (index per USD per hour), `vram`; ties break by price, then id, so a `cursor` is stable as long as you repeat the same filters and sort. `maxVramGb`, `minGpus`, `maxGpus` and `minDiskGb` bound the memory of each GPU, the GPU count and the plan's disk. `query` sets the same filters as one line of `KEY OP VALUE` terms that must all hold, for example `vram>=24 gpus>=2 price<1.5 region=eu sort=perf_per_dollar` (quote a value with spaces: `gpu="rtx 4090"`). Keys and operators: `gpu =` (text), `gpus` and `vram` (`= >= <= > <`), `ram`, `cpu`, `disk` (`>= >`), `price` (`<= <`, USD per hour), `perf >=` (Apidly performance index), `region =`, `hosting =`, `availability =`, `sort =`. Whole-number keys read `>` as the next number. The query is combined with the other parameters; a filter given both ways with different values, an unknown key, a wrong operator or a bad value answers 400 `invalid_query` with the reason.

**Scope cần có:** `read`

**Tham số**

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | không |  |
| `cursor` | query | string | không |  |
| `gpu` | query | string | không |  |
| `minVramGb` | query | number | không |  |
| `maxVramGb` | query | number | không |  |
| `minGpus` | query | integer | không |  |
| `maxGpus` | query | integer | không |  |
| `minDiskGb` | query | number | không |  |
| `minRamGb` | query | number | không |  |
| `minVcpus` | query | number | không |  |
| `region` | query | `na` \| `eu` \| `ap` \| `other` | không |  |
| `hosting` | query | `datacenter` \| `independent` \| `any` | không |  |
| `maxPriceUsd` | query | string | không |  |
| `minPerfIndex` | query | number | không | Minimum Apidly performance index (one GPU of the reference model = 100); plans without an index never pass. |
| `minPerfScore` | query | number | không | Deprecated name of `minPerfIndex` (same scale), read until 2027-05-31. Send `minPerfIndex`. |
| `availability` | query | `available` \| `limited` \| `unavailable` | không |  |
| `sort` | query | `recommended` \| `price` \| `perf` \| `perf_per_dollar` \| `vram` | không |  |
| `query` | query | string | không |  |

**Ví dụ yêu cầu (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

```python
client.plans.list()
```

**Công cụ dòng lệnh:** `apidly init`, `apidly plans`, `apidly export`, `apidly plan`, `apidly apply` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (200)

```json
{
  "plans": [
    {
      "id": "example",
      "slug": "example",
      "name": "example",
      "gpuModel": "example",
      "gpuCount": 1,
      "vramGb": 1,
      "vcpus": 1,
      "ramGb": 1,
      "diskGb": 1,
      "hourlyPriceMicros": "1000000",
      "hourlyPriceUsd": "1.000000",
      "storageHourlyMicrosPerGb": "1000000",
      "storageHourlyUsdPerGb": "1.000000",
      "monthlyPriceMicros": "1000000",
      "monthlyPriceUsd": "1.000000",
      "tier": "standard",
      "featured": false,
      "sort": 1,
      "availability": "available",
      "priceSyncedAt": "2026-11-21T10:00:00.000Z",
      "variants": [
        []
      ],
      "fx": [
        1
      ],
      "performanceIndex": 1,
      "perf": 1,
      "endsSoon": 1,
      "earliestEndAt": "2026-11-21T10:00:00.000Z",
      "interruptibleHourlyPriceMicros": "1000000",
      "interruptibleHourlyPriceUsd": "1.000000"
    }
  ],
  "nextCursor": "example"
}
```

Trạng thái lỗi: `401`, `403`, `429`.

### GET /gpus

Các mẫu GPU với giá thấp nhất và tình trạng sẵn có tốt nhất

**Scope cần có:** `read`

**Tham số**

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | không |  |
| `cursor` | query | string | không |  |

**Ví dụ yêu cầu (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

```python
client.gpus.list()
```

**Công cụ dòng lệnh:** `apidly gpus` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (200)

```json
{
  "gpus": [
    {
      "gpuModel": "example",
      "vramGb": 1,
      "fromHourlyPriceMicros": "1000000",
      "fromHourlyPriceUsd": "1.000000",
      "availability": "available",
      "gpuCounts": [
        1
      ],
      "plans": 1
    }
  ],
  "nextCursor": "example"
}
```

Trạng thái lỗi: `401`, `403`, `429`.

### GET /benchmarks

Hiệu năng đo được theo lớp GPU

Figures we measured ourselves with a fixed, synthetic suite (FP16 and FP32 matrix multiply, ResNet-50 inference, a small transformer forward pass, VRAM copy bandwidth): the median over the runs of each class, with each run's value in `samples`. Results vary between machines; classes we have not measured are absent. `perDollar` uses our current price. Filter with `gpu` (exact model name).

**Scope cần có:** `read`

**Tham số**

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | không |  |
| `cursor` | query | string | không |  |
| `gpu` | query | string | không |  |

**Ví dụ yêu cầu (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

```python
client.benchmarks.list()
```

**Công cụ dòng lệnh:** `apidly benchmarks` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (200)

```json
{
  "benchmarks": [
    {
      "gpuModel": "example",
      "gpuCount": 1,
      "runs": 1,
      "measuredAt": "2026-11-21T10:00:00.000Z",
      "source": "example",
      "metrics": [
        {
          "id": null,
          "benchmark": null,
          "metric": null,
          "unit": null,
          "median": null,
          "runs": null,
          "samples": null,
          "perDollar": null
        }
      ]
    }
  ],
  "nextCursor": "example"
}
```

Trạng thái lỗi: `401`, `403`, `429`.

### GET /regions

Các khu vực nơi máy chủ của bạn chạy

Plans are not pinned to a region; a server is placed on the best matching machine at launch.

**Scope cần có:** `read`

**Tham số**

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | không |  |
| `cursor` | query | string | không |  |

**Ví dụ yêu cầu (curl)**

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

**JavaScript (SDK)**

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

**Python (SDK)**

```python
client.regions.list()
```

**Công cụ dòng lệnh:** `apidly regions` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (200)

```json
{
  "regions": [
    {
      "region": "South Korea",
      "regionCode": "KR",
      "continent": "asia",
      "servers": 1
    }
  ],
  "nextCursor": "example"
}
```

Trạng thái lỗi: `401`, `403`, `429`.

### GET /quickstart

Mẫu và gói mà Bắt đầu nhanh sẽ chọn cho một mục tiêu

Same rules as the console's Quick start: the goal's first template in the catalogue that has an in-stock plan, then the cheapest in-stock plan that meets its GPU memory and hardware needs (single GPU first, the recommended memory when it is offered at a sensible price). `maxHourlyUsd` keeps only plans whose price per running hour (compute and the template's disk) is within it; when none fits, the cheapest fit is returned with `budget: "over"`. `hours` adds `totalMicros`, the running cost for that long. `status`: `ok`, `no_capacity` (the template exists but nothing in stock fits; `template` is set) or `no_template`. Without `goal` the answer is the goal menu: `status: "choose_goal"` and `goalOptions`, each goal with its English title, template and all-in price per running hour. `stoppedHourlyMicros` is what the disk keeps costing while the server is stopped. Nothing is reserved or launched.

**Scope cần có:** `read`

**Tham số**

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `goal` | query | `chat` \| `images` \| `train` \| `notebook` \| `transcribe` \| `api` \| `server` | không |  |
| `maxHourlyUsd` | query | string | không |  |
| `hours` | query | number | không |  |

**Ví dụ yêu cầu (curl)**

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

**Công cụ dòng lệnh:** `apidly up` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (200)

```json
{
  "goal": "example",
  "defaults": {
    "sshKeyIds": [
      "example"
    ],
    "autoStopHours": 1,
    "region": "example"
  },
  "goals": [
    "example"
  ],
  "status": "ok",
  "goalOptions": [
    {
      "id": "example",
      "title": "example",
      "description": "example",
      "status": "ok",
      "template": {
        "slug": "example",
        "name": "example"
      },
      "fromHourlyMicros": "1000000",
      "fromHourlyUsd": "1.000000"
    }
  ],
  "template": {
    "id": "example",
    "slug": "example",
    "name": "example",
    "launchMode": "example",
    "use": "page"
  },
  "plan": {
    "id": "example",
    "slug": "example",
    "name": "example",
    "gpuModel": "example",
    "gpuCount": 1,
    "vramGb": 1,
    "vcpus": 1,
    "ramGb": 1,
    "diskGb": 1,
    "hourlyPriceMicros": "1000000",
    "hourlyPriceUsd": "1.000000",
    "storageHourlyMicrosPerGb": "1000000",
    "storageHourlyUsdPerGb": "1.000000",
    "monthlyPriceMicros": "1000000",
    "monthlyPriceUsd": "1.000000",
    "tier": "standard",
    "featured": false,
    "sort": 1,
    "availability": "available",
    "priceSyncedAt": "2026-11-21T10:00:00.000Z",
    "variants": [
      []
    ],
    "fx": [
      1
    ],
    "performanceIndex": 1,
    "perf": 1,
    "endsSoon": 1,
    "earliestEndAt": "2026-11-21T10:00:00.000Z",
    "interruptibleHourlyPriceMicros": "1000000",
    "interruptibleHourlyPriceUsd": "1.000000"
  },
  "diskGb": 1,
  "reason": {
    "code": "anyGpu",
    "haveGb": 1,
    "needGb": 1,
    "spareGb": 1,
    "recommendedGb": 1
  },
  "budget": "within",
  "hourlyMicros": "1000000",
  "hourlyUsd": "1.000000",
  "stoppedHourlyMicros": "1000000",
  "stoppedHourlyUsd": "1.000000",
  "hours": 1,
  "totalMicros": "1000000",
  "totalUsd": "1.000000",
  "faster": {
    "plan": {
      "id": "example",
      "slug": "example",
      "name": "example",
      "gpuModel": "example",
      "gpuCount": 1,
      "vramGb": 1,
      "vcpus": 1,
      "ramGb": 1,
      "diskGb": 1,
      "hourlyPriceMicros": "1000000",
      "hourlyPriceUsd": "1.000000",
      "storageHourlyMicrosPerGb": "1000000",
      "storageHourlyUsdPerGb": "1.000000",
      "monthlyPriceMicros": "1000000",
      "monthlyPriceUsd": "1.000000",
      "tier": "standard",
      "featured": false,
      "sort": 1,
      "availability": "available",
      "priceSyncedAt": "2026-11-21T10:00:00.000Z",
      "variants": [
        []
      ],
      "fx": [
        1
      ],
      "performanceIndex": 1,
      "perf": 1,
      "endsSoon": 1,
      "earliestEndAt": "2026-11-21T10:00:00.000Z",
      "interruptibleHourlyPriceMicros": "1000000",
      "interruptibleHourlyPriceUsd": "1.000000"
    },
    "hourlyMicros": "1000000",
    "hourlyUsd": "1.000000"
  }
}
```

Trạng thái lỗi: `400`, `401`, `403`, `429`.

### GET /plans/{id}/history

Lịch sử giá và tình trạng sẵn có 30 ngày của một gói

**Scope cần có:** `read`

**Tham số**

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `id` | path | string | có |  |

**Ví dụ yêu cầu (curl)**

```bash
curl "https://apidly.com/api/v1/plans/pln_example/history" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.plans.history("pln_example");
```

**Python (SDK)**

```python
client.plans.history("pln_example")
```

**Công cụ dòng lệnh:** `apidly plans` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (200)

```json
{
  "planId": "id_example",
  "days": [
    {
      "day": "example",
      "priceMicros": "1000000",
      "priceUsd": "1.000000",
      "availability": "available"
    }
  ],
  "minMicros": "1000000",
  "minUsd": "1.000000",
  "maxMicros": "1000000",
  "maxUsd": "1.000000",
  "observedDays": 1
}
```

Trạng thái lỗi: `401`, `403`, `404`, `429`.

### GET /plan-filters

Bộ lọc gói đã lưu của tổ chức

The deploy wizard's saved searches (at most 10 per organization, shared by its members), newest first.

**Scope cần có:** `read` · **Quyền:** `servers.view`

**Ví dụ yêu cầu (curl)**

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

**JavaScript (SDK)**

```js
await apidly.planFilters.list();
```

**Python (SDK)**

```python
client.plan_filters.list()
```

**Công cụ dòng lệnh:** `apidly filters` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (200)

```json
{
  "presets": [
    {
      "id": "example",
      "name": "example",
      "filters": {
        "core": {
          "key": null
        },
        "hw": {
          "key": null
        }
      },
      "createdAt": "2026-11-21T10:00:00.000Z"
    }
  ]
}
```

Trạng thái lỗi: `401`, `403`, `429`.

### POST /plan-filters

Lưu bộ lọc gói dưới một tên

409 `limit_reached` at 10 saved filters, 409 `name_taken` when the name (ignoring case) is in use.

**Scope cần có:** `servers` · **Quyền:** `servers.deploy` · **Có thể thử lại an toàn với:** `Idempotency-Key`

**Nội dung yêu cầu**

| Tên | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- |
| `name` | string | có |  |
| `filters` | object | không |  |

**Ví dụ yêu cầu (curl)**

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

**JavaScript (SDK)**

```js
await apidly.planFilters.create({
  name: "example"
});
```

**Python (SDK)**

```python
client.plan_filters.create(name="example", filters={
    "core": {
        "availableOnly": True,
        "gpus": 0,
        "maxPrice": 0,
    },
    "hw": {
        "cores": 0,
        "cpu": "",
        "cuda": 0,
    },
})
```

**Công cụ dòng lệnh:** `apidly filters` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (201)

```json
{
  "preset": {
    "id": "example",
    "name": "example",
    "filters": {
      "core": {
        "key": null
      },
      "hw": {
        "key": null
      }
    },
    "createdAt": "2026-11-21T10:00:00.000Z"
  }
}
```

Trạng thái lỗi: `400`, `401`, `403`, `409`, `429`.

### DELETE /plan-filters/{id}

Xóa bộ lọc gói đã lưu

Needs the same `servers` scope as saving one.

**Scope cần có:** `servers` · **Quyền:** `servers.deploy`

**Tham số**

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `id` | path | string | có |  |

**Ví dụ yêu cầu (curl)**

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

**JavaScript (SDK)**

```js
await apidly.planFilters.delete("planfilter_example");
```

**Python (SDK)**

```python
client.plan_filters.delete("planfilter_example")
```

**Công cụ dòng lệnh:** `apidly filters` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (200)

```json
{
  "deleted": false,
  "id": "example"
}
```

Trạng thái lỗi: `401`, `403`, `404`, `429`.

### GET /plan-watches

Các gói mà thành viên sở hữu khóa đang theo dõi

**Scope cần có:** `read` · **Quyền:** `servers.view`

**Ví dụ yêu cầu (curl)**

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

**JavaScript (SDK)**

```js
await apidly.plans.listWatches();
```

**Python (SDK)**

```python
client.plans.list_watches()
```

**Công cụ dòng lệnh:** `apidly watch` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (200)

```json
{
  "planIds": [
    "example"
  ]
}
```

Trạng thái lỗi: `401`, `403`, `429`.

### POST /plan-watches

Nhận một email khi gói chưa có sẵn quay lại

Watches a plan that is out of stock for 14 days on behalf of the key's member; one email goes to them when it is available again. `consent: true` is their request for that email. Repeating the call renews the watch. 409 `plan_available` when the plan can be deployed now, 409 `limit_reached` when too many plans are watched.

**Scope cần có:** `servers` · **Quyền:** `servers.view`

**Nội dung yêu cầu**

| Tên | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- |
| `planId` | string | có |  |
| `consent` | `true` | có |  |

**Ví dụ yêu cầu (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/plan-watches" \
  -H "Authorization: Bearer $APIDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"planId":"id_example","consent":true}'
```

**JavaScript (SDK)**

```js
await apidly.plans.watch("id_example");
```

**Python (SDK)**

```python
client.plans.watch(plan_id="id_example")
```

**Công cụ dòng lệnh:** `apidly watch` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (201)

```json
{
  "watch": {
    "planId": "id_example",
    "expiresAt": "2026-11-21T10:00:00.000Z"
  }
}
```

Trạng thái lỗi: `400`, `401`, `403`, `404`, `409`, `429`.

### DELETE /plan-watches/{planId}

Thôi theo dõi một gói

Needs the same `servers` scope as starting the watch.

**Scope cần có:** `servers` · **Quyền:** `servers.view`

**Tham số**

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `planId` | path | string | có |  |

**Ví dụ yêu cầu (curl)**

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

**JavaScript (SDK)**

```js
await apidly.plans.unwatch("planwatche_example");
```

**Python (SDK)**

```python
client.plans.unwatch("planwatche_example")
```

**Công cụ dòng lệnh:** `apidly watch` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (200)

```json
{
  "removed": false,
  "planId": "id_example"
}
```

Trạng thái lỗi: `401`, `403`, `429`.
