{
 "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/containers/{id}/pipelines/{pipeline}/runs": {
   "post": {
    "tags": [
     "Containers"
    ],
    "operationId": "pipeline_run",
    "summary": "Start a run",
    "x-summary-tr": "Çalıştırma başlat",
    "x-scope": "services_write",
    "description": "`ref`: branch (`main`), tag (`tag:v1.2.0`) or full ref; `sha`: optional 40 character commit. Without both the first branch of the rule builds. Queued runs start when the environment's parallel build limit allows.  With `upload_id` the uploaded archive is built (gyro-pipeline.yml is not read for archives).",
    "x-description-tr": "`ref`: dal (`main`), etiket (`tag:v1.2.0`) ya da tam ref; `sha`: isteğe bağlı 40 karakter commit. İkisi yoksa kuraldaki ilk dal derlenir.  `upload_id` verilirse yüklenen arşiv derlenir (arşivlerde gyro-pipeline.yml okunmaz).",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "Service id"
     },
     {
      "name": "pipeline",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Pipeline id (p + 8)"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "object",
           "properties": {
            "run": {
             "$ref": "#/components/schemas/ContainerPipelineRun"
            }
           }
          }
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Validation"
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "ref": {
          "type": "string",
          "example": "main"
         },
         "sha": {
          "type": "string"
         },
         "confirm": {
          "type": "boolean"
         },
         "upload_id": {
          "type": "string",
          "example": "u3k9x0abc12de",
          "description": "Build an uploaded archive (from POST .../uploads) instead of a git ref",
          "x-description-tr": "Git ref yerine yüklenen arşivi derle (POST .../uploads yanıtındaki kimlik)"
         },
         "archive_name": {
          "type": "string",
          "example": "site.tar.gz",
          "description": "Shown in the run list"
         }
        }
       }
      }
     }
    },
    "x-cli": {
     "command": "container pipeline run",
     "confirm": false
    }
   }
  }
 },
 "components": {
  "responses": {
   "Validation": {
    "description": "Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "Conflict": {
    "description": "State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "NotFound": {
    "description": "Not found — also returned for objects owned by someone else",
    "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."
       }
      }
     }
    }
   },
   "ContainerPipelineRun": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "example": "rt0gbqcbw5r1"
     },
     "pipeline": {
      "type": "string"
     },
     "n": {
      "type": "integer",
      "description": "run number of the pipeline"
     },
     "trigger": {
      "type": "string",
      "enum": [
       "push",
       "tag",
       "manual",
       "api",
       "redeploy",
       "archive"
      ]
     },
     "ref": {
      "type": "string",
      "example": "refs/heads/main"
     },
     "sha": {
      "type": "string"
     },
     "short_sha": {
      "type": "string"
     },
     "message": {
      "type": "string"
     },
     "author": {
      "type": "string"
     },
     "state": {
      "type": "string",
      "enum": [
       "queued",
       "preparing",
       "building",
       "awaiting_approval",
       "deploying",
       "verifying",
       "succeeded",
       "failed",
       "cancelled",
       "rolled_back",
       "skipped",
       "expired"
      ]
     },
     "step": {
      "type": "string",
      "enum": [
       "prepare",
       "queued_node",
       "starting",
       "clone",
       "steps",
       "build",
       "approval",
       "deploy",
       "verify"
      ]
     },
     "error": {
      "type": "string",
      "description": "repo_auth, repo_not_found, repo_unreachable, repo_blocked, ref_not_found, target_missing, clone_failed, commands_failed, build_failed, build_target_not_found (detail = the stage name), invalid_build_target, push_failed, timeout, out_of_memory, no_capacity, build_image_pull, deploy_unhealthy, deploy_timeout, deploy_failed, minutes_exhausted, pipeline_file_invalid, cancelled, rejected, approval_expired, internal, archive_invalid (detail says why: links, ../ paths, device files, > 20 000 files, > 2 GB unpacked, damaged), archive_download, upload_not_found, archive_format, archive_too_large, host_key_unconfirmed, host_key_mismatch, deploy_key_missing"
     },
     "image": {
      "type": "string",
      "example": "registry.ist.gyrohosting.com/ab12cd/web:1a2b3c4"
     },
     "digest": {
      "type": "string"
     },
     "deployed": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "service": {
         "type": "string"
        },
        "from_revision": {
         "type": "integer"
        },
        "to_revision": {
         "type": "integer"
        },
        "state": {
         "type": "string",
         "enum": [
          "pending",
          "running",
          "failing",
          "rolled_back",
          "missing"
         ]
        },
        "problem": {
         "type": "string"
        }
       }
      }
     },
     "build_seconds": {
      "type": "integer"
     },
     "billed_minutes": {
      "type": "integer"
     },
     "duration_seconds": {
      "type": "integer"
     },
     "created": {
      "type": "string",
      "format": "date-time"
     },
     "started": {
      "type": "string",
      "format": "date-time"
     },
     "finished": {
      "type": "string",
      "format": "date-time"
     },
     "deadline": {
      "type": "string",
      "format": "date-time",
      "description": "approval / health wait deadline"
     },
     "from_run": {
      "type": "string",
      "description": "redeploy: source run"
     },
     "archive": {
      "type": "string",
      "description": "upload id (archive runs)"
     },
     "archive_name": {
      "type": "string"
     },
     "archive_size": {
      "type": "integer"
     },
     "archive_format": {
      "type": "string",
      "enum": [
       "tar.gz",
       "zip"
      ]
     },
     "image_tag": {
      "type": "string",
      "description": "<sha7> for commits, arc-<upload> for archives"
     }
    }
   }
  }
 },
 "security": [
  {
   "bearerAuth": []
  }
 ]
}