---
title: "Billing — API reference"
description: "Invoices and account balance (read-only with the recommended scopes)."
url: https://www.gyrohosting.com/developers/en/api/billing.html
language: en
openapi: https://www.gyrohosting.com/developers/openapi.json
api_version: 2.30.0
---

# Billing

Invoices and account balance (read-only with the recommended scopes).

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


## GET /invoices

**List invoices** · operationId `listInvoices` · scope `Invoices/GetInvoices` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/listInvoices.json




### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `status` | query | string | unpaid, paid, cancelled, refund |
| `page` | query | integer |  |
| `limit` | query | integer |  |

### Responses

- **200**: Invoices
- **401**: Missing, invalid or revoked key

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/invoices' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro invoice list
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/invoices", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/invoices", {
  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}`);
```


## GET /invoices/{id}

**Get an invoice** · operationId `getInvoice` · scope `Invoices/GetInvoice` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/getInvoice.json




### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer |  |

### Responses

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

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/invoices/12345' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro invoice get 12345
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/invoices/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/invoices/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}`);
```


## GET /balance

**Account balance** · operationId `getBalance` · scope `Balance/GetBalance` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/getBalance.json




### Responses

- **200**: Balance
- **401**: Missing, invalid or revoked key

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/balance' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro balance
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/balance", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/balance", {
  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}`);
```


## GET /balance/transactions

**Balance ledger** · operationId `listBalanceTransactions` · scope `Balance/GetBalanceTransactions` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/listBalanceTransactions.json




### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `page` | query | integer |  |
| `limit` | query | integer |  |

### Responses

- **200**: Ledger entries
- **401**: Missing, invalid or revoked key

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/balance/transactions' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro balance transaction list
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/balance/transactions", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/balance/transactions", {
  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/invoices/{id}/pay

**Pay an invoice from the account balance** · operationId `payInvoiceFromBalance` · scope `billing_pay` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/payInvoiceFromBalance.json

Balance only (never a card). Requires `"confirm": true` and an `Idempotency-Key` header.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer |  |
| `Idempotency-Key` (required) | header | string | Unique per logical request (e.g. a UUID). Replays within 24 hours return the stored answer. |

### Request body

| Field | Type | Description |
|---|---|---|
| `confirm` (required) | boolean = true |  |

### Responses

- **200**: Paid
- **400**: Malformed request (e.g. missing Idempotency-Key)
- **402**: Account balance does not cover the order (`insufficient_balance`)
- **404**: Not found — also returned for objects owned by someone else
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/invoices/12345/pay' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"confirm": true}'
```
```bash
gyro invoice pay 12345 --help    # all flags
```
```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/invoices/12345/pay", headers=h, json={"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/invoices/12345/pay", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({"confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## GET /cloud/invoices/{id}/pdf

**Invoice PDF (base64 in JSON)** · operationId `getInvoicePdf` · scope `billing_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/getInvoicePdf.json




### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer |  |

### Responses

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

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/invoices/12345/pdf' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro invoice pdf get 12345
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/invoices/12345/pdf", 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/invoices/12345/pdf", {
  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/balance/top-up

**Create a balance top-up invoice and get its payment link** · operationId `balanceTopUp` · scope `billing_pay` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/balanceTopUp.json




### Request body

| Field | Type | Description |
|---|---|---|
| `amount` (required) | number |  |

### Responses

- **201**: Invoice + pay_url
- **403**: Key lacks the scope, IP not allowed, or feature disabled
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/balance/top-up' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"amount": 1.0}'
```
```bash
gyro balance top-up --help    # all flags
```
```python
import os, uuid, requests

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


## POST /invoices/{id}/pay

**Pay invoice (path: {id})** · operationId `corePayInvoice` · scope `Invoices/PayInvoice` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/corePayInvoice.json

Pay invoice (path: {id}). Invoices of the calling account.

**Spends money / creates an invoice.** Money rules apply (AK-40): `"confirm": true` in the body, an `Idempotency-Key` header, account balance only (no stored card), daily limit of paid API operations per account (default 50, operator can override per account/reseller, resets 00:00 Europe/Istanbul); violations answer 422 with `[confirm_required]`, `[idempotency_key_required]`, `[balance_only]` or `[daily_limit]` in the message. 

Core WISECP client endpoint (Turkish reference: https://dev.wisecp.com/tr/fatura-odeme-api).


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer |  |
| `Idempotency-Key` (required) | header | string |  |

### Request body

| Field | Type | Description |
|---|---|---|
| `payment` (required) | object | paymentÖdeme kaynağı. |
| `method` (required) | string | Ödeme yolu: hesap bakiyesi ya da kayıtlı kart. |
| `card_id` | integer | Çekilecek kartın numarası. Verilmezse hesabın varsayılan kartı çekilir. |

### Responses

- **200**: Success
- **401**: Missing, invalid or revoked key
- **403**: Key lacks the scope, IP not allowed, or feature disabled
- **404**: not_found
- **422**: balance_not_allowed, card_expired, card_not_chargeable, insufficient_balance, invoice_not_payable, no_stored_card, payment_method_invalid, subscription_collects

### Examples

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/invoices/12345/pay' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"payment": {}, "method": "string", "card_id": 1}'
```
```bash
gyro core invoice pay 12345 --help    # all flags
```
```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/invoices/12345/pay", headers=h, json={"payment": {}, "method": "string", "card_id": 1}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/invoices/12345/pay", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({"payment": {}, "method": "string", "card_id": 1}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## POST /invoices/{id}/coupon

**Apply invoice coupon (path: {id})** · operationId `coreApplyInvoiceCoupon` · scope `Invoices/ApplyInvoiceCoupon` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/coreApplyInvoiceCoupon.json

Apply invoice coupon (path: {id}). Invoices of the calling account.

Core WISECP client endpoint (Turkish reference: https://dev.wisecp.com/tr/fatura-odeme-api).


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer |  |

### Request body

| Field | Type | Description |
|---|---|---|
| `code` (required) | string | Kupon kodu. |

### Responses

- **200**: Success
- **401**: Missing, invalid or revoked key
- **403**: Key lacks the scope, IP not allowed, or feature disabled
- **404**: not_found
- **422**: coupon_code_required, coupon_invalid, coupon_not_invoice, coupon_rejected, coupon_scope, coupon_used, invoice_not_payable

### Examples

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/invoices/12345/coupon' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"code": "string"}'
```
```bash
gyro invoice coupon 12345 --help    # all flags
```
```python
import os, uuid, requests

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


## PATCH /balance/settings

**Update balance settings** · operationId `coreUpdateBalanceSettings` · scope `Balance/UpdateBalanceSettings` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/coreUpdateBalanceSettings.json

Update balance settings. 

Core WISECP client endpoint (Turkish reference: https://dev.wisecp.com/tr/hesap-bakiyesi-api).


### Request body

| Field | Type | Description |
|---|---|---|
| `auto_pay_from_balance` | boolean | Yenilemeler cüzdandan tahsil edilsin mi. Bu değiştiğinde açık yenileme faturaları yeni tercihe göre yeniden ele alınır. |
| `backup_card_id` | integer | Cüzdan yetmediğinde çekilecek kart. Sıfır göndermek kart zincirini tümüyle kaldırır. |
| `alert` | object | Uyarı bloğu. Açık ve eşik alanlarını taşır; açarken pozitif bir eşik gerekir. |
| `alert_recipients` | string | Uyarıyı alacak fatura adresi numaraları. Liste yerine geçer; hesabın sahibi burada yer almaz, her zaman alır. |

### Responses

- **200**: Success
- **401**: Missing, invalid or revoked key
- **403**: Key lacks the scope, IP not allowed, or feature disabled
- **404**: not_found
- **422**: alert_invalid, auto_pay_invalid, card_expired, nothing_to_update

### Examples

```bash
curl -s -X PATCH 'https://www.gyrohosting.com/api/v1/client/balance/settings' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"auto_pay_from_balance": true, "backup_card_id": 1, "alert": {}, "alert_recipients": "string"}'
```
```bash
gyro balance setting update --help    # all flags
```
```python
import os, uuid, requests

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


## GET /cloud/billing/balance

**Balance, hourly cost of running prepaid services and estimated time left** · operationId `getPrepaidBalance` · scope `billing_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/getPrepaidBalance.json

Prepaid (hourly, from the account balance) services: Gyro Containers (ECS) and Gyro Cloud Istanbul (tr-ist-1). Times are Europe/Istanbul. Usage is never invoiced: invoices are issued for balance top-ups.


### Responses

- **200**: OK
- **403**: insufficient_scope | subkey_forbidden

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/billing/balance' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro api request GET /cloud/billing/balance
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/billing/balance", 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/billing/balance", {
  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}`);
```


## GET /cloud/billing/usage

**Hour-by-hour usage ledger (or daily/monthly totals). Times are Europe/Istanbul.** · operationId `listPrepaidUsage` · scope `billing_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/listPrepaidUsage.json

Prepaid (hourly, from the account balance) services: Gyro Containers (ECS) and Gyro Cloud Istanbul (tr-ist-1). Times are Europe/Istanbul. Usage is never invoiced: invoices are issued for balance top-ups.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `from` | query | string | first day (default: 1st of this month) |
| `to` | query | string | last day (default: today); at most 400 days |
| `service_id` | query | integer |  |
| `status` | query | string (ucretli, tavan, kismi, odenmedi, ucretsiz) |  |
| `granularity` | query | string (hour, day, month) |  |
| `format` | query | string (json, csv) | csv = base64 file in data.content_base64 (max 5000 rows) |
| `page` | query | integer |  |
| `limit` | query | integer |  |

### Responses

- **200**: OK (meta = total, page, limit, next_page)

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/billing/usage' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro api request GET /cloud/billing/usage
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/billing/usage", 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/billing/usage", {
  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}`);
```


## GET /cloud/billing/statement/{month}

**Monthly usage statement (not an invoice); JSON, PDF or CSV** · operationId `getPrepaidStatement` · scope `billing_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/getPrepaidStatement.json

Prepaid (hourly, from the account balance) services: Gyro Containers (ECS) and Gyro Cloud Istanbul (tr-ist-1). Times are Europe/Istanbul. Usage is never invoiced: invoices are issued for balance top-ups.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `month` (required) | path | string |  |
| `format` | query | string (json, pdf, csv) |  |
| `lang` | query | string (tr, en) |  |

### Responses

- **200**: json: totals/by_service/by_day; pdf|csv: filename, content_type, content_base64
- **422**: invalid_month

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/billing/statement/1' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro api request GET /cloud/billing/statement/1
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/billing/statement/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/billing/statement/1", {
  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/billing/estimate

**Hourly / daily / monthly cost of prepaid plans and serverless containers, and how long the balance lasts** · operationId `estimatePrepaidCost` · scope `billing_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/estimatePrepaidCost.json

Prepaid (hourly, from the account balance) services: Gyro Containers (ECS) and Gyro Cloud Istanbul (tr-ist-1). Times are Europe/Istanbul. Usage is never invoiced: invoices are issued for balance top-ups. Server and dedicated-node plans: hourly = monthly / 672, capped at the monthly price (`capped: true`). Serverless containers (`{"type": "serverless", "cpu_m": 250, "memory_mi": 512, "count": 2, "hours": 730}`): charged by measured use with no monthly cap (`capped: false`), `monthly_cap` = a full month (730 hours) of running time, `total` = `hours` x hourly (`billed_hours` = `hours`). Errors 422: `unknown_plan`, `region_not_prepaid`, `too_many_items`, `invalid_cpu`, `invalid_memory`, `serverless_not_available`.


### Request body

| Field | Type | Description |
|---|---|---|
| `items` | array<object> |  |
| `plan` | string | single-item shortcut |
| `count` | integer |  |
| `cpu_m` | integer | serverless single-item shortcut |
| `memory_mi` | integer |  |
| `hours` | integer |  |
| `type` | string (serverless) |  |

### Responses

- **200**: items[], hourly, daily, monthly_cap, eur_rate, balance, hours_covered, order_requires (first 24 h), can_order
- **422**: unknown_plan | region_not_prepaid | too_many_items | invalid_cpu | invalid_memory | serverless_not_available

### Examples

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/billing/estimate' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"items": [{"plan": "standart-2-4", "product_id": 1, "region": "tr-ist-1", "count": 1, "type": "serverless", "cpu_m": 250, "memory_mi": 512, "hours": 1}], "plan": "string", "count": 1, "cpu_m": 1, "memory_mi": 1, "hours": 1, "type": "serverless"}'
```
```bash
gyro api request POST /cloud/billing/estimate --data '{"items": [{"plan": "standart-2-4", "product_id": 1, "region": "tr-ist-1", "count": 1, "type": "serverless", "cpu_m": 250, "memory_mi": 512, "hours": 1}], "plan": "string", "count": 1, "cpu_m": 1, "memory_mi": 1, "hours": 1, "type": "serverless"}'
```
```hcl
# data source gyro_prepaid_estimate: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/data-sources/prepaid_estimate
# What would two 0.5 vCPU / 1 GB serverless containers and one Istanbul server cost?
data "gyro_prepaid_estimate" "stack" {
  items = [
    { cpu_m = 500, memory_mi = 1024, count = 2, hours = 730 },
    { plan = "standart-2-4" },
  ]
}

output "monthly" {
  value = "${data.gyro_prepaid_estimate.stack.monthly} ${data.gyro_prepaid_estimate.stack.currency}"
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.post("https://www.gyrohosting.com/api/v1/client/cloud/billing/estimate", headers=h, json={"items": [{"plan": "standart-2-4", "product_id": 1, "region": "tr-ist-1", "count": 1, "type": "serverless", "cpu_m": 250, "memory_mi": 512, "hours": 1}], "plan": "string", "count": 1, "cpu_m": 1, "memory_mi": 1, "hours": 1, "type": "serverless"}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/billing/estimate", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"items": [{"plan": "standart-2-4", "product_id": 1, "region": "tr-ist-1", "count": 1, "type": "serverless", "cpu_m": 250, "memory_mi": 512, "hours": 1}], "plan": "string", "count": 1, "cpu_m": 1, "memory_mi": 1, "hours": 1, "type": "serverless"}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## GET /cloud/billing/topup-url

**Browser link of the balance top-up page (top-ups are invoiced with VAT; usage is not)** · operationId `getPrepaidTopupUrl` · scope `billing_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/getPrepaidTopupUrl.json

Prepaid (hourly, from the account balance) services: Gyro Containers (ECS) and Gyro Cloud Istanbul (tr-ist-1). Times are Europe/Istanbul. Usage is never invoiced: invoices are issued for balance top-ups.


### Responses

- **200**: url, minimum

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/billing/topup-url' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro billing topup-url get
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/billing/topup-url", 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/billing/topup-url", {
  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}`);
```


## GET /cloud/billing/container-sizes

**Serverless container sizes (vCPU / memory pairs) and prices** · operationId `getContainerSizes` · scope `billing_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/getContainerSizes.json

Gyro Containers Serverless bills each running container copy per hour: `cpu_m/1000` x vCPU-hour + `memory_mi/1024` x GB-hour, from the prepaid balance, no monthly cap. Only the `cpu_m` / `memory_mi` pairs listed here are accepted on `POST /cloud/containers/{id}/services` of a serverless environment (422 `invalid_cpu` / `invalid_memory`). 404 `serverless_not_available` when the product is not offered.


### Responses

- **200**: Sizes
- **401**: Missing, invalid or revoked key
- **403**: Key lacks the scope, IP not allowed, or feature disabled
- **404**: Not found — also returned for objects owned by someone else

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/billing/container-sizes' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro container sizes
```
```hcl
# data source gyro_container_sizes: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/data-sources/container_sizes
# Serverless container sizes (vCPU / memory pairs) and prices
data "gyro_container_sizes" "all" {}

output "smallest" {
  value = {
    cpu_m     = data.gyro_container_sizes.all.sizes[0].cpu_m
    memory_mi = data.gyro_container_sizes.all.sizes[0].memory_mi[0]
    eur_hour  = data.gyro_container_sizes.all.sizes[0].hourly_eur_min
  }
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/billing/container-sizes", 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/billing/container-sizes", {
  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}`);
```
