---
title: "Sunucular — API başvurusu"
description: "Sahip olduğunuz bulut sunucular. Oluşturma, hesap bakiyesinden ödenen bir sipariştir."
url: https://www.gyrohosting.com/developers/tr/api/servers.html
language: tr
openapi: https://www.gyrohosting.com/developers/openapi.json
api_version: 2.30.0
---

# Sunucular

Sahip olduğunuz bulut sunucular. Oluşturma, hesap bakiyesinden ödenen bir sipariştir.

Base URL: `https://www.gyrohosting.com/api/v1/client` · OpenAPI: https://www.gyrohosting.com/developers/openapi.json


## GET /cloud/servers

**Bulut sunucuları listele** · operationId `listServers` · scope `cloud_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/listServers.json




### Parametreler

| Alan | in | Tür | Açıklama |
|---|---|---|---|
| `status` | query | string (active, waiting, inprocess, suspended, cancelled) |  |
| `page` | query | integer |  |
| `limit` | query | integer |  |

### Yanıtlar

- **200**: Servers (without live state)
- **401**: Missing, invalid or revoked key

### Örnekler

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/servers' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro server list
```
```hcl
# kaynak gyro_server: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/server
# Pick a product by plan + region (see gyro_products / gyro_locations) ...
resource "gyro_server" "web" {
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "debian-12"
  hostname      = "web-1.example.com"
  ssh_key_ids   = [tonumber(gyro_ssh_key.laptop.id)]
  power_state   = "running"
  confirm_order = true # creating a server is a paid order from your account balance
}

# ... or by product id from the catalog, e.g. the first product in stock in Helsinki.
data "gyro_products" "helsinki" {
  region         = "eu-fi-1"
  available_only = true
}

resource "gyro_server" "db" {
  product_id    = data.gyro_products.helsinki.products[0].id
  image         = "ubuntu-24.04"
  confirm_order = true
}

output "web_ipv4" {
  value = gyro_server.web.ipv4
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/servers", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/servers", {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## POST /cloud/servers

**Bulut sunucu oluştur (sipariş)** · operationId `createServer` · scope `cloud_order` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/createServer.json

Sipariş oluşturur ve **hesap bakiyenizden** öder (kayıtlı karttan asla çekmez).
Güvenlik kuralları:
* önce `"dry_run": true` ile fiyat teklifi alın; hiçbir şey oluşturulmaz;
* gerçek sipariş için `"confirm": true` **ve** `Idempotency-Key` başlığı zorunludur — aynı anahtar ve
  gövdeyle tekrar denemek ikinci sipariş yerine ilk yanıtı döndürür (`Idempotency-Replayed: true`);
* yönetici hesap başına sunucu sınırı koyabilir (`409 server_limit`).
Kurulum eşzamansızdır (genellikle bir dakikadan kısa): `status` `active` ve `live.power_state`
`running` olana kadar `GET /cloud/servers/{id}` ile sorgulayın.


**Toplu (2.21.0):** `quantity` tek siparişte (tek fatura) N sunucu oluşturur, her biri ayrı hizmettir; `name` (`{n}` ile) ve `tags` adlandırır. `app` her birine tek tık uygulama kurar.


### Parametreler

| Alan | in | Tür | Açıklama |
|---|---|---|---|
| `Idempotency-Key` (zorunlu) | header | string | Unique per logical request (e.g. a UUID). Replays within 24 hours return the stored answer. |

### İstek gövdesi

| Alan | Tür | Açıklama |
|---|---|---|
| `product_id` | integer | From GET /cloud/products (or give plan + region) |
| `plan` | string | Plan name from GET /cloud/products |
| `region` | string | Region from GET /cloud/locations |
| `server_type` | string | Deprecated alias of plan |
| `location` | string | Deprecated alias of region |
| `cycle` | string (monthly, quarterly, semiannually, annually) |  |
| `image` | string |  |
| `ssh_keys` | array<integer> | Ids from /cloud/ssh-keys. Global regions: one key, installed at creation. tr-ist-1: up to 10 keys, installed for root at creation through cloud-init (`ssh_keys` on GET /cloud/servers/{id} lists their fingerprints and key ids). |
| `hostname` | string |  In a batch `{n}` is replaced with 1..N (e.g. `web-{n}.example.com`); without `{n}` `-1`, `-2`... is appended. |
| `user_data` | string | cloud-init user data: `#cloud-config` or a `#!` script, max 32 KiB. Accepted in every region (tr-ist-1 since 2.14.0). Ignored when a one-click application is chosen on the product. |
| `dry_run` | boolean |  |
| `confirm` | boolean | Must be true to place a paid order |
| `end_customer_id` | integer | Reseller main key: assign the new server to this end-customer |
| `project_id` | integer | Optional project for the new service(s) (0 = default project). Checked before the order: unknown id = 404 `project_not_found` (GyroAPI order endpoints) or 422 `checkout_blocked` with `[project_not_found]` (POST /orders). |
| `quantity` | integer | Create N identical servers in ONE order (default 1). Upper limit per request: 25 by default (operator setting / per-account override; 422 invalid_quantity above it). The server cap and the prepaid 24-hour balance rule count all N. |
| `name` | string | Service name (nickname, shown in the panel, console and API as `nickname`). `{n}` is replaced with 1..N in a batch; without `{n}` a batch appends `-1`, `-2`... |
| `tags` | array<any> | Labels for every new server (max 10, 24 characters each). |
| `app` | string | One-click app id from GET /cloud/apps, installed when the server is up (products that offer apps). Not with `user_data`. |
| `app_domain` | string | Domain of the app (its A record must point to the new server); quantity 1 only. |

### Yanıtlar

- **200**: Dry-run quote (nothing created)
- **202**: Order placed and paid; the server is being provisioned
- **400**: Malformed request (e.g. missing Idempotency-Key)
- **401**: Missing, invalid or revoked key
- **402**: Account balance does not cover the order (`insufficient_balance`)
- **403**: Key lacks the scope, IP not allowed, or feature disabled
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: confirm_required | limit_exceeded (new-account limit of the prepaid cloud; details = LimitHint, raise it with a support ticket) | validation errors

### Örnekler

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/servers' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"product_id": 723, "cycle": "monthly", "image": "debian-12", "ssh_keys": [12], "hostname": "web-1.example.com", "confirm": true}'
```
```bash
gyro server create --help    # tüm seçenekler
```
```hcl
# kaynak gyro_server: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/server
# Pick a product by plan + region (see gyro_products / gyro_locations) ...
resource "gyro_server" "web" {
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "debian-12"
  hostname      = "web-1.example.com"
  ssh_key_ids   = [tonumber(gyro_ssh_key.laptop.id)]
  power_state   = "running"
  confirm_order = true # creating a server is a paid order from your account balance
}

# ... or by product id from the catalog, e.g. the first product in stock in Helsinki.
data "gyro_products" "helsinki" {
  region         = "eu-fi-1"
  available_only = true
}

resource "gyro_server" "db" {
  product_id    = data.gyro_products.helsinki.products[0].id
  image         = "ubuntu-24.04"
  confirm_order = true
}

output "web_ipv4" {
  value = gyro_server.web.ipv4
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
h["Idempotency-Key"] = str(uuid.uuid4())
r = requests.post("https://www.gyrohosting.com/api/v1/client/cloud/servers", headers=h, json={"product_id": 723, "cycle": "monthly", "image": "debian-12", "ssh_keys": [12], "hostname": "web-1.example.com", "confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/servers", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({"product_id": 723, "cycle": "monthly", "image": "debian-12", "ssh_keys": [12], "hostname": "web-1.example.com", "confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## GET /cloud/servers/{id}

**Sunucuyu canlı durumuyla getir** · operationId `getServer` · scope `cloud_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/getServer.json

`live` platformdan okunur (15 saniye önbellek) ve sunucu etkin değilken `null` olur.


### Parametreler

| Alan | in | Tür | Açıklama |
|---|---|---|---|
| `id` (zorunlu) | path | integer | Server id (= service id in the client area) |

### Yanıtlar

- **200**: Server
- **404**: Not found — also returned for objects owned by someone else

### Örnekler

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/servers/12345' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro server get 12345
```
```hcl
# kaynak gyro_server: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/server
# Pick a product by plan + region (see gyro_products / gyro_locations) ...
resource "gyro_server" "web" {
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "debian-12"
  hostname      = "web-1.example.com"
  ssh_key_ids   = [tonumber(gyro_ssh_key.laptop.id)]
  power_state   = "running"
  confirm_order = true # creating a server is a paid order from your account balance
}

# ... or by product id from the catalog, e.g. the first product in stock in Helsinki.
data "gyro_products" "helsinki" {
  region         = "eu-fi-1"
  available_only = true
}

resource "gyro_server" "db" {
  product_id    = data.gyro_products.helsinki.products[0].id
  image         = "ubuntu-24.04"
  confirm_order = true
}

output "web_ipv4" {
  value = gyro_server.web.ipv4
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345", {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## PATCH /cloud/servers/{id}

**Sunucu adını değiştir veya otomatik yenilemeyi aç/kapat** · operationId `updateServer` · scope `cloud_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/updateServer.json




### Parametreler

| Alan | in | Tür | Açıklama |
|---|---|---|---|
| `id` (zorunlu) | path | integer | Server id (= service id in the client area) |

### İstek gövdesi

| Alan | Tür | Açıklama |
|---|---|---|
| `hostname` | string | Fully qualified host name (max 63 characters) |
| `auto_renew` | boolean |  |

### Yanıtlar

- **200**: Updated server
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Örnekler

```bash
curl -s -X PATCH 'https://www.gyrohosting.com/api/v1/client/cloud/servers/12345' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"hostname": "web-1.example.com", "auto_renew": true}'
```
```bash
gyro server update | rename 12345 --help    # tüm seçenekler
```
```hcl
# kaynak gyro_server: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/server
# Pick a product by plan + region (see gyro_products / gyro_locations) ...
resource "gyro_server" "web" {
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "debian-12"
  hostname      = "web-1.example.com"
  ssh_key_ids   = [tonumber(gyro_ssh_key.laptop.id)]
  power_state   = "running"
  confirm_order = true # creating a server is a paid order from your account balance
}

# ... or by product id from the catalog, e.g. the first product in stock in Helsinki.
data "gyro_products" "helsinki" {
  region         = "eu-fi-1"
  available_only = true
}

resource "gyro_server" "db" {
  product_id    = data.gyro_products.helsinki.products[0].id
  image         = "ubuntu-24.04"
  confirm_order = true
}

output "web_ipv4" {
  value = gyro_server.web.ipv4
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.patch("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345", headers=h, json={"hostname": "web-1.example.com", "auto_renew": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345", {
  method: "PATCH",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"hostname": "web-1.example.com", "auto_renew": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## DELETE /cloud/servers/{id}

**Sunucuyu sil (iptal)** · operationId `deleteServer` · scope `cloud_delete` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/deleteServer.json

`confirm=true` (sorgu veya gövde) zorunludur. İki biçim:
* varsayılan: **iptal talebi** açar (`status: cancellation_requested`); talep panel otomasyonuyla işlenene kadar (günlük,
  mesai saatleri) sunucu çalışır ve faturalama sürer;
* `immediate=true`: **hemen** iptal eder (`status: cancelling`, yaklaşık bir dakikada `cancelled`) - faturalama durur, sunucu hemen kapanır, bekleme süresi (3 gün) sonunda
  verisiyle silinir. Paneldeki onaylanmış "hemen iptal" ile aynı etki. Yönetici kapatabilir.
Tekrar çağırmak güvenlidir.



### Parametreler

| Alan | in | Tür | Açıklama |
|---|---|---|---|
| `id` (zorunlu) | path | integer | Server id (= service id in the client area) |
| `confirm` (zorunlu) | query | boolean |  |
| `immediate` | query | boolean | true = cancel now instead of filing a request |

### Yanıtlar

- **202**: Cancellation requested (default) or cancelled (immediate)
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Örnekler

```bash
curl -s -X DELETE 'https://www.gyrohosting.com/api/v1/client/cloud/servers/12345' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro server delete 12345
```
```hcl
# kaynak gyro_server: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/server
# Pick a product by plan + region (see gyro_products / gyro_locations) ...
resource "gyro_server" "web" {
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "debian-12"
  hostname      = "web-1.example.com"
  ssh_key_ids   = [tonumber(gyro_ssh_key.laptop.id)]
  power_state   = "running"
  confirm_order = true # creating a server is a paid order from your account balance
}

# ... or by product id from the catalog, e.g. the first product in stock in Helsinki.
data "gyro_products" "helsinki" {
  region         = "eu-fi-1"
  available_only = true
}

resource "gyro_server" "db" {
  product_id    = data.gyro_products.helsinki.products[0].id
  image         = "ubuntu-24.04"
  confirm_order = true
}

output "web_ipv4" {
  value = gyro_server.web.ipv4
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.delete("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345", {
  method: "DELETE",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## GET /cloud/servers/{id}/disks

**Sunucunun ek diskleri** · operationId `listServerDisks` · scope `cloud_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/listServerDisks.json

İki sınıf: `ssd` (hızlı) ve `hdd` (yedek, arşiv, medya için büyük depolama; veritabanı için kullanmayın). Ek diskler GB başına ön ödemeli bakiyeden saatlik ücretlendirilir (`classes.<sınıf>.per_gb_monthly_eur`, aylık / 672); eklendiği saatten silindiği saate kadar, her disk en az `pricing.minimum_hours` saat. Sunucu başına en çok 4 disk ve sınıf başına `classes.<sınıf>.max_gb` GB; boyutlar `step_gb` katları. Yeni disk boştur (sunucu içinde bölümlendirip biçimlendirin ve bağlayın). Yeniden kurulum ek diskleri siler. 


### Parametreler

| Alan | in | Tür | Açıklama |
|---|---|---|---|
| `id` (zorunlu) | path | integer | Server id (tr-ist-1) |

### Yanıtlar

- **200**: OK
- **404**: Not found — also returned for objects owned by someone else
- **409**: not_actionable (suspended / busy / snapshots exist)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)
- **501**: not_supported (not a tr-ist-1 Gyro Compute server)

### Örnekler

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/disks' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro server disk list 12345
```
```hcl
# kaynak gyro_server_disk: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/server_disk
# Fast SSD disk for data (grow in place by raising size_gb; never shrinks)
resource "gyro_server_disk" "data" {
  server_id = gyro_server.web.id
  size_gb   = 100
}

# Large storage (HDD) for backups / archives / media - when the hdd class is on sale
resource "gyro_server_disk" "archive" {
  server_id = gyro_server.web.id
  size_gb   = 500
  class     = "hdd"
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/disks", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/disks", {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## POST /cloud/servers/{id}/disks

**Ek disk ekle** · operationId `addServerDisk` · scope `cloud_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/addServerDisk.json

İki sınıf: `ssd` (hızlı) ve `hdd` (yedek, arşiv, medya için büyük depolama; veritabanı için kullanmayın). Ek diskler GB başına ön ödemeli bakiyeden saatlik ücretlendirilir (`classes.<sınıf>.per_gb_monthly_eur`, aylık / 672); eklendiği saatten silindiği saate kadar, her disk en az `pricing.minimum_hours` saat. Sunucu başına en çok 4 disk ve sınıf başına `classes.<sınıf>.max_gb` GB; boyutlar `step_gb` katları. Yeni disk boştur (sunucu içinde bölümlendirip biçimlendirin ve bağlayın). Yeniden kurulum ek diskleri siler. Yalnız ön ödemeli tr-ist-1 sunucuları; askıdayken eklenemez.


### Parametreler

| Alan | in | Tür | Açıklama |
|---|---|---|---|
| `id` (zorunlu) | path | integer | Server id (tr-ist-1) |

### İstek gövdesi

| Alan | Tür | Açıklama |
|---|---|---|
| `size_gb` (zorunlu) | integer |  |
| `class` | string (ssd, hdd) | ssd (fast) or hdd (large storage; see classes.hdd.on_sale) |

### Yanıtlar

- **201**: OK
- **404**: Not found — also returned for objects owned by someone else
- **409**: not_actionable (suspended / busy / snapshots exist)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)
- **501**: not_supported (not a tr-ist-1 Gyro Compute server)

### Örnekler

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/disks' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"size_gb": 1, "class": "ssd"}'
```
```bash
gyro server disk add 12345 --help    # tüm seçenekler
```
```hcl
# kaynak gyro_server_disk: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/server_disk
# Fast SSD disk for data (grow in place by raising size_gb; never shrinks)
resource "gyro_server_disk" "data" {
  server_id = gyro_server.web.id
  size_gb   = 100
}

# Large storage (HDD) for backups / archives / media - when the hdd class is on sale
resource "gyro_server_disk" "archive" {
  server_id = gyro_server.web.id
  size_gb   = 500
  class     = "hdd"
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.post("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/disks", headers=h, json={"size_gb": 1, "class": "ssd"}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/disks", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"size_gb": 1, "class": "ssd"}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## PUT /cloud/servers/{id}/disks/{disk}

**Ek diski büyüt** · operationId `resizeServerDisk` · scope `cloud_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/resizeServerDisk.json

Diski `size_gb` boyutuna büyütür (küçültmez; snapshot varken olmaz). Sonra sunucu içinde bölümü / dosya sistemini genişletin.


### Parametreler

| Alan | in | Tür | Açıklama |
|---|---|---|---|
| `id` (zorunlu) | path | integer | Server id (tr-ist-1) |
| `disk` (zorunlu) | path | integer | Disk id (from GET /cloud/servers/{id}/disks) |

### İstek gövdesi

| Alan | Tür | Açıklama |
|---|---|---|
| `size_gb` (zorunlu) | integer |  |

### Yanıtlar

- **200**: OK
- **404**: Not found — also returned for objects owned by someone else
- **409**: not_actionable (suspended / busy / snapshots exist)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)
- **501**: not_supported (not a tr-ist-1 Gyro Compute server)

### Örnekler

```bash
curl -s -X PUT 'https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/disks/1' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"size_gb": 1}'
```
```bash
gyro server disk resize 12345 --help    # tüm seçenekler
```
```hcl
# kaynak gyro_server_disk: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/server_disk
# Fast SSD disk for data (grow in place by raising size_gb; never shrinks)
resource "gyro_server_disk" "data" {
  server_id = gyro_server.web.id
  size_gb   = 100
}

# Large storage (HDD) for backups / archives / media - when the hdd class is on sale
resource "gyro_server_disk" "archive" {
  server_id = gyro_server.web.id
  size_gb   = 500
  class     = "hdd"
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.put("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/disks/1", headers=h, json={"size_gb": 1}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/disks/1", {
  method: "PUT",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"size_gb": 1}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## DELETE /cloud/servers/{id}/disks/{disk}

**Ek diski sil (verisiyle)** · operationId `removeServerDisk` · scope `cloud_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/removeServerDisk.json

Diski tüm verisiyle siler (geri alınamaz); ücret içinde bulunulan saatten sonra durur (asgari süre geçerli). `confirm=true` gerekir.


### Parametreler

| Alan | in | Tür | Açıklama |
|---|---|---|---|
| `id` (zorunlu) | path | integer | Server id (tr-ist-1) |
| `disk` (zorunlu) | path | integer | Disk id (from GET /cloud/servers/{id}/disks) |
| `confirm` (zorunlu) | query | boolean |  |

### Yanıtlar

- **200**: OK
- **404**: Not found — also returned for objects owned by someone else
- **409**: not_actionable (suspended / busy / snapshots exist)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)
- **501**: not_supported (not a tr-ist-1 Gyro Compute server)

### Örnekler

```bash
curl -s -X DELETE 'https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/disks/1' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro server disk remove 12345
```
```hcl
# kaynak gyro_server_disk: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/server_disk
# Fast SSD disk for data (grow in place by raising size_gb; never shrinks)
resource "gyro_server_disk" "data" {
  server_id = gyro_server.web.id
  size_gb   = 100
}

# Large storage (HDD) for backups / archives / media - when the hdd class is on sale
resource "gyro_server_disk" "archive" {
  server_id = gyro_server.web.id
  size_gb   = 500
  class     = "hdd"
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.delete("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/disks/1", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/servers/12345/disks/1", {
  method: "DELETE",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```
