Authentication
Komut satırı araçları için tarayıcıyla giriş (cihaz yetkilendirmesi, gh auth login gibi) ve kullanılan anahtarın oturumu. 1) POST /auth/device/code (anahtarsız) bir user_code ve adres döner; 2) kullanıcı adresi açar, panele giriş yapar, kodu ve isteğin IP/istemci bilgisini kontrol eder, izinleri ve süreyi seçip onaylar; 3) araç her interval saniyede POST /auth/device/token sorgular ve yeni müşteri API anahtarını bir kez alır. Anahtar sıradan bir anahtardır: API Kimlik Bilgileri sayfasında görünür ve iptal edilebilir, izin modeli, para kuralları ve IP kilidi aynıdır. CI'da panelde ya da POST /cloud/keys ile oluşturulan anahtarı kullanmaya devam edin.
#POST/auth/device/code
Tarayıcıyla girişi başlat (cihaz kodu)Kapsam: createDeviceCodeBu işlemin OpenAPI parçası
API anahtarı gerekmez. Sınır: IP başına 10 dakikada 10 kod (429 rate_limited). Kod expires_in saniye geçerlidir. template / scopes onay sayfasındaki izinleri yalnız önceden seçer; karar kullanıcınındır.
İstek gövdesi
| Alan | Tür | Açıklama |
|---|---|---|
client_name | string | |
client_version | string | |
hostname | string | |
os | string | |
template | string (readonly, dns, cloud, containers, storage, billing, full, custom) | |
scopes | array<string> | |
lang | string (tr, en) |
Yanıtlar
| 200 | Code issued — data: DeviceCode |
| 422 | Validation or business rule failure (confirm_required, invalid_image, tool_action_failed ...) |
| 429 | rate_limited |
Örnekler
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/auth/device/code' \
-H "Authorization: Bearer $GYRO_TOKEN" \
-H "Content-Type: application/json" \
-d '{"client_name": "gyro-cli", "client_version": "1.31.0", "hostname": "laptop", "os": "linux/amd64", "template": "readonly", "scopes": ["cloud_read", "services_read"], "lang": "tr"}'gyro api request POST /auth/device/code --data '{"client_name": "gyro-cli", "client_version": "1.31.0", "hostname": "laptop", "os": "linux/amd64", "template": "readonly", "scopes": ["cloud_read", "services_read"], "lang": "tr"}'import os, uuid, requests
h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.post("https://www.gyrohosting.com/api/v1/client/auth/device/code", headers=h, json={"client_name": "gyro-cli", "client_version": "1.31.0", "hostname": "laptop", "os": "linux/amd64", "template": "readonly", "scopes": ["cloud_read", "services_read"], "lang": "tr"}, timeout=60)
r.raise_for_status()
print(r.json()["data"])const res = await fetch("https://www.gyrohosting.com/api/v1/client/auth/device/code", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"client_name": "gyro-cli", "client_version": "1.31.0", "hostname": "laptop", "os": "linux/amd64", "template": "readonly", "scopes": ["cloud_read", "services_read"], "lang": "tr"}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);#POST/auth/device/token
Anahtarı sorgula (cihaz kodu)Kapsam: pollDeviceTokenBu işlemin OpenAPI parçası
API anahtarı gerekmez. Beklerken 400 hataları: authorization_pending (her interval saniyede sormaya devam), slow_down (details.interval yeni aralık), access_denied (tarayıcıda reddedildi ya da hesap artık anahtar alamıyor), expired_token, invalid_grant (bilinmeyen ya da kullanılmış kod). 200 bir kez: yeni anahtar (access_token).
İstek gövdesi
| Alan | Tür | Açıklama |
|---|---|---|
device_code zorunlu | string |
Yanıtlar
| 200 | Approved: the key, once — data: DeviceToken |
| 400 | authorization_pending | slow_down | access_denied | expired_token | invalid_grant |
| 429 | rate_limited |
Örnekler
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/auth/device/token' \
-H "Authorization: Bearer $GYRO_TOKEN" \
-H "Content-Type: application/json" \
-d '{"device_code": "string"}'gyro api request POST /auth/device/token --data '{"device_code": "string"}'import os, uuid, requests
h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.post("https://www.gyrohosting.com/api/v1/client/auth/device/token", headers=h, json={"device_code": "string"}, timeout=60)
r.raise_for_status()
print(r.json()["data"])const res = await fetch("https://www.gyrohosting.com/api/v1/client/auth/device/token", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"device_code": "string"}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);#GET/auth/session
Kullanılan anahtar: hesap, izinler, bitişKapsam: getAuthSessionBu işlemin OpenAPI parçası
Geçerli her anahtar (kapsam gerekmez).
Yanıtlar
| 200 | Session — data: object |
| 401 | Missing, invalid or revoked key |
Örnekler
curl -s 'https://www.gyrohosting.com/api/v1/client/auth/session' \
-H "Authorization: Bearer $GYRO_TOKEN"gyro api request GET /auth/sessionimport os, uuid, requests
h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/auth/session", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])const res = await fetch("https://www.gyrohosting.com/api/v1/client/auth/session", {
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}`);#DELETE/auth/session
Kullanılan anahtarı iptal et (çıkış)Kapsam: deleteAuthSessionBu işlemin OpenAPI parçası
Bu isteği gönderen anahtarı iptal eder (geçerli her anahtar, kapsam gerekmez). API Kimlik Bilgileri sayfasında iptal edilmiş olarak görünür.
Yanıtlar
| 200 | Revoked — data: object |
| 401 | Missing, invalid or revoked key |
Örnekler
curl -s -X DELETE 'https://www.gyrohosting.com/api/v1/client/auth/session' \
-H "Authorization: Bearer $GYRO_TOKEN"gyro api request DELETE /auth/sessionimport os, uuid, requests
h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.delete("https://www.gyrohosting.com/api/v1/client/auth/session", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])const res = await fetch("https://www.gyrohosting.com/api/v1/client/auth/session", {
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}`);