{
 "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/templates/{id}/servers": {
   "post": {
    "tags": [
     "Templates"
    ],
    "operationId": "createServerFromTemplate",
    "summary": "New server from a template",
    "x-summary-tr": "Şablondan yeni sunucu",
    "x-scope": "cloud_order",
    "x-cli": {
     "command": "template deploy",
     "money": true
    },
    "description": "A normal prepaid tr-ist-1 order (24-hour balance rule, account limits) installed from the template. `product_id` (or `plan`) from GET /cloud/products?region=tr-ist-1; its disk must be at least the template `min_disk_gb`. Send `\"confirm\": true` and an `Idempotency-Key` header (`dry_run` for a quote).",
    "x-description-tr": "Şablondan kurulan normal ön ödemeli tr-ist-1 siparişi (24 saat bakiye kuralı, hesap sınırları). `product_id` (ya da `plan`) GET /cloud/products?region=tr-ist-1'den; diski şablonun `min_disk_gb` değerinden küçük olamaz. `\"confirm\": true` ve `Idempotency-Key` başlığı gerekir (teklif için `dry_run`).",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "Template id"
     }
    ],
    "responses": {
     "202": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/CreateServerResult"
          }
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "description": "template_limit, template_not_ready, busy",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "422": {
      "description": "confirm_required | limit_exceeded (new-account limit of the prepaid cloud; details = LimitHint, raise it with a support ticket) | validation errors",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "product_id": {
          "type": "integer"
         },
         "plan": {
          "type": "string"
         },
         "hostname": {
          "type": "string"
         },
         "ssh_keys": {
          "type": "array",
          "items": {
           "type": "integer"
          }
         },
         "user_data": {
          "type": "string"
         },
         "confirm": {
          "type": "boolean"
         },
         "dry_run": {
          "type": "boolean"
         },
         "project_id": {
          "type": "integer",
          "minimum": 0,
          "description": "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)."
         }
        },
        "required": []
       }
      }
     }
    }
   }
  }
 },
 "components": {
  "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."
       }
      }
     }
    }
   },
   "CreateServerResult": {
    "type": "object",
    "properties": {
     "server": {
      "$ref": "#/components/schemas/Server"
     },
     "order": {
      "type": "object",
      "properties": {
       "id": {
        "type": "integer"
       },
       "number": {
        "type": "string"
       },
       "status": {
        "type": "string"
       },
       "total": {
        "$ref": "#/components/schemas/Money"
       }
      }
     },
     "payment": {
      "type": "object",
      "properties": {
       "method": {
        "type": "string",
        "const": "balance"
       },
       "status": {
        "type": "string",
        "enum": [
         "paid",
         "failed",
         "unpaid"
        ]
       },
       "error": {
        "type": "string"
       }
      }
     },
     "invoice": {
      "$ref": "#/components/schemas/Invoice"
     },
     "end_customer_id": {
      "type": [
       "integer",
       "null"
      ]
     },
     "servers": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Server"
      },
      "description": "All servers of the order (2.21.0); `server` = the first one."
     },
     "quantity": {
      "type": "integer"
     }
    }
   },
   "Server": {
    "type": "object",
    "properties": {
     "id": {
      "type": "integer",
      "example": 47466
     },
     "name": {
      "type": "string",
      "description": "Product name"
     },
     "hostname": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "type": "string",
      "enum": [
       "waiting",
       "inprocess",
       "active",
       "suspended",
       "cancelled"
      ],
      "description": "Billing / service status"
     },
     "product_id": {
      "type": "integer"
     },
     "plan": {
      "type": [
       "string",
       "null"
      ],
      "example": "standart-2-4"
     },
     "region": {
      "type": [
       "string",
       "null"
      ],
      "example": "eu-de-1"
     },
     "server_type": {
      "type": [
       "string",
       "null"
      ],
      "deprecated": true,
      "description": "Legacy type code (use plan)"
     },
     "location": {
      "type": [
       "string",
       "null"
      ],
      "deprecated": true,
      "description": "Legacy location code (use region)"
     },
     "ipv4": {
      "type": [
       "string",
       "null"
      ]
     },
     "ipv6": {
      "type": [
       "string",
       "null"
      ],
      "description": "IPv6 network (/64)"
     },
     "provisioned": {
      "type": "boolean",
      "description": "true once the machine exists"
     },
     "cycle": {
      "type": "string",
      "example": "monthly"
     },
     "price": {
      "$ref": "#/components/schemas/Money"
     },
     "auto_renew": {
      "type": "boolean"
     },
     "created_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "due_date": {
      "type": [
       "string",
       "null"
      ],
      "format": "date"
     },
     "cancellation": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "pending",
       "approved",
       null
      ]
     },
     "customer_id": {
      "type": [
       "integer",
       "null"
      ],
      "description": "Reseller end-customer (main key only)"
     },
     "product_line": {
      "type": "string",
      "enum": [
       "cloud_server",
       "vds"
      ]
     },
     "billing": {
      "type": "string",
      "enum": [
       "invoice",
       "prepaid"
      ],
      "description": "prepaid: `cycle` is `hourly`, `price.amount` is the hourly EUR price, `due_date` is null."
     }
    }
   },
   "Money": {
    "type": "object",
    "properties": {
     "amount": {
      "type": "number"
     },
     "currency": {
      "type": [
       "string",
       "null"
      ],
      "example": "TRY"
     }
    }
   },
   "Invoice": {
    "type": "object",
    "additionalProperties": true,
    "properties": {
     "invoice_id": {
      "type": "integer"
     },
     "number": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "state": {
      "type": "string",
      "enum": [
       "paid",
       "unpaid",
       "overdue",
       "refunded",
       "cancelled",
       "waiting"
      ]
     },
     "total": {
      "$ref": "#/components/schemas/Money"
     },
     "created_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date"
     },
     "paid_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date"
     },
     "due_date": {
      "type": [
       "string",
       "null"
      ],
      "format": "date"
     }
    }
   }
  },
  "responses": {
   "NotFound": {
    "description": "Not found — also returned for objects owned by someone else",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   }
  }
 },
 "security": [
  {
   "bearerAuth": []
  }
 ]
}