{
 "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/billing/usage": {
   "get": {
    "operationId": "listPrepaidUsage",
    "tags": [
     "Billing"
    ],
    "summary": "Hour-by-hour usage ledger (or daily/monthly totals). Times are Europe/Istanbul.",
    "x-gyro-cli": [
     "billing",
     "usage"
    ],
    "parameters": [
     {
      "name": "from",
      "in": "query",
      "schema": {
       "type": "string",
       "format": "date"
      },
      "description": "first day (default: 1st of this month)"
     },
     {
      "name": "to",
      "in": "query",
      "schema": {
       "type": "string",
       "format": "date"
      },
      "description": "last day (default: today); at most 400 days"
     },
     {
      "name": "service_id",
      "in": "query",
      "schema": {
       "type": "integer"
      }
     },
     {
      "name": "status",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "ucretli",
        "tavan",
        "kismi",
        "odenmedi",
        "ucretsiz"
       ]
      }
     },
     {
      "name": "granularity",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "hour",
        "day",
        "month"
       ],
       "default": "hour"
      }
     },
     {
      "name": "format",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "json",
        "csv"
       ]
      },
      "description": "csv = base64 file in data.content_base64 (max 5000 rows)"
     },
     {
      "name": "page",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 1
      }
     },
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 100,
       "maximum": 100
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK (meta = total, page, limit, next_page)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "object",
           "properties": {
            "items": {
             "type": "array",
             "items": {
              "oneOf": [
               {
                "$ref": "#/components/schemas/UsageHour"
               },
               {
                "$ref": "#/components/schemas/UsagePeriod"
               }
              ]
             }
            },
            "filters": {
             "type": "object"
            },
            "totals": {
             "type": "array",
             "items": {
              "$ref": "#/components/schemas/MoneyEur"
             }
            },
            "by_service": {
             "type": "array",
             "items": {
              "$ref": "#/components/schemas/ServiceTotal"
             }
            }
           }
          },
          "meta": {
           "type": "object"
          }
         }
        }
       }
      }
     }
    },
    "x-scope": "billing_read",
    "x-provided-by": "GyroKredi",
    "description": "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."
   }
  }
 },
 "components": {
  "schemas": {
   "ServiceTotal": {
    "type": "object",
    "properties": {
     "service_id": {
      "type": "integer"
     },
     "description": {
      "type": "string"
     },
     "hours": {
      "type": "integer"
     },
     "line_items": {
      "type": "integer"
     },
     "amount": {
      "$ref": "#/components/schemas/Money"
     }
    }
   },
   "Money": {
    "type": "object",
    "properties": {
     "amount": {
      "type": "number"
     },
     "currency": {
      "type": [
       "string",
       "null"
      ],
      "example": "TRY"
     }
    }
   },
   "MoneyEur": {
    "allOf": [
     {
      "$ref": "#/components/schemas/Money"
     },
     {
      "type": "object",
      "properties": {
       "amount_eur": {
        "type": "number"
       }
      }
     }
    ]
   },
   "UsagePeriod": {
    "type": "object",
    "properties": {
     "period": {
      "type": "string"
     },
     "hours": {
      "type": "integer"
     },
     "amount": {
      "$ref": "#/components/schemas/Money"
     },
     "amount_eur": {
      "type": "number"
     }
    }
   },
   "UsageHour": {
    "type": "object",
    "properties": {
     "hour": {
      "type": "string",
      "format": "date-time"
     },
     "service_id": {
      "type": "integer"
     },
     "item": {
      "type": "string"
     },
     "description": {
      "type": "string"
     },
     "status": {
      "type": "string",
      "enum": [
       "ucretli",
       "tavan",
       "kismi",
       "odenmedi",
       "ucretsiz"
      ]
     },
     "power": {
      "type": "string",
      "nullable": true,
      "enum": [
       "calisiyor",
       "kapali",
       "bilinmiyor"
      ]
     },
     "quantity": {
      "type": "object",
      "nullable": true,
      "properties": {
       "used": {
        "type": "number"
       },
       "free": {
        "type": "number"
       },
       "unit": {
        "type": "string"
       }
      }
     },
     "unit_price_eur": {
      "type": "number"
     },
     "eur_rate": {
      "type": "number"
     },
     "unit_price": {
      "$ref": "#/components/schemas/Money"
     },
     "amount": {
      "$ref": "#/components/schemas/Money"
     },
     "amount_eur": {
      "type": "number"
     }
    }
   }
  }
 },
 "security": [
  {
   "bearerAuth": []
  }
 ]
}