{
 "openapi": "3.1.0",
 "info": {
  "title": "Gyro Public API",
  "version": "2.30.0",
  "summary": "Manage Gyro cloud servers, SSH keys and billing programmatically.",
  "x-summary-tr": "Gyro bulut sunucularınızı, SSH anahtarlarınızı ve faturalarınızı programla yönetin.",
  "contact": {
   "name": "Gyro Hosting",
   "url": "https://www.gyrohosting.com"
  },
  "license": {
   "name": "Proprietary",
   "identifier": "LicenseRef-Gyro-API-Terms"
  }
 },
 "servers": [
  {
   "url": "https://www.gyrohosting.com/api/v1/client",
   "description": "Production"
  }
 ],
 "paths": {
  "/cloud/keys": {
   "post": {
    "tags": [
     "API keys"
    ],
    "operationId": "createApiKey",
    "summary": "Create a sub-account key (token returned once)",
    "x-summary-tr": "Alt hesap anahtarı oluştur (token bir kez döner)",
    "x-scope": "keys",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ApiKeyInput"
       },
       "example": {
        "name": "ci-reboot-only",
        "scopes": [
         "cloud_read",
         "cloud_write"
        ],
        "services": [
         47466
        ],
        "actions": [
         "reboot",
         "poweron"
        ],
        "ips": [
         "203.0.113.10"
        ],
        "rate_limit": 30
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "allOf": [
            {
             "$ref": "#/components/schemas/ApiKey"
            },
            {
             "type": "object",
             "properties": {
              "token": {
               "type": "string"
              }
             }
            }
           ]
          }
         }
        }
       }
      }
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Validation"
     }
    }
   }
  }
 },
 "components": {
  "responses": {
   "Validation": {
    "description": "Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "Forbidden": {
    "description": "Key lacks the scope, IP not allowed, or feature disabled",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   }
  },
  "schemas": {
   "Error": {
    "type": "object",
    "required": [
     "error"
    ],
    "properties": {
     "error": {
      "type": "object",
      "required": [
       "code",
       "message"
      ],
      "properties": {
       "code": {
        "type": "string",
        "example": "server_not_found"
       },
       "message": {
        "type": "string"
       },
       "details": {
        "type": "object",
        "additionalProperties": true,
        "description": "Extra data. Limit refusals add the LimitHint fields (`limit_exceeded: true`, `limit_key`, `limit`, `current`, `how_to_increase`, `support_ticket`, `hint`): account limits are raised with a support ticket. Validation errors (length, format) never carry the limit hint.",
        "x-description-tr": "Ek veri. Sınır retlerinde LimitHint alanları gelir: hesap sınırları destek talebiyle artırılır. Doğrulama hataları (uzunluk, biçim) sınır ipucu taşımaz."
       }
      }
     }
    }
   },
   "ApiKey": {
    "type": "object",
    "properties": {
     "id": {
      "type": "integer"
     },
     "name": {
      "type": "string"
     },
     "token_prefix": {
      "type": "string"
     },
     "customer_id": {
      "type": [
       "integer",
       "null"
      ]
     },
     "scopes": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "services": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "integer"
      }
     },
     "actions": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "string"
      }
     },
     "ips": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "rate_limit": {
      "type": [
       "integer",
       "null"
      ]
     },
     "status": {
      "type": "string",
      "enum": [
       "active",
       "revoked"
      ]
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "last_used_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "ApiKeyInput": {
    "type": "object",
    "required": [
     "name"
    ],
    "properties": {
     "name": {
      "type": "string",
      "maxLength": 48
     },
     "scopes": {
      "type": "array",
      "items": {
       "type": "string",
       "enum": [
        "cloud_read",
        "cloud_write",
        "cloud_order",
        "cloud_delete",
        "services_read",
        "services_write",
        "webhooks"
       ]
      },
      "default": [
       "cloud_read"
      ]
     },
     "services": {
      "type": "array",
      "items": {
       "type": "integer"
      },
      "description": "Optional service allow list"
     },
     "actions": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Optional action allow list: server actions (reboot) or tool:action / tool:* / method:name"
     },
     "ips": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "rate_limit": {
      "type": "integer",
      "description": "Requests per minute (<= your own limit; 0 = default)"
     }
    }
   }
  }
 },
 "security": [
  {
   "bearerAuth": []
  }
 ]
}