{"openapi":"3.1.0","info":{"title":"Krova Cloud API","version":"1.0.0","description":"Programmatic access to Krova Cloud. Authenticate with the X-API-KEY header, the same key as an Authorization: Bearer token, or an OAuth 2.0 access token. Keys are scoped per Space and inherit the permissions of the membership that created them; an OAuth token is bound to the Space its holder chose. Mutating POST / DELETE endpoints are rate-limited to 10 requests per 60 seconds per client IP.","termsOfService":"https://krova.cloud/terms","contact":{"name":"Krova Cloud Support","email":"support@krova.cloud","url":"https://krova.cloud/contact"},"x-logo":{"url":"https://krova.cloud/logo.png","altText":"Krova Cloud"}},"externalDocs":{"description":"Krova Cloud documentation","url":"https://krova.cloud/docs"},"servers":[{"url":"https://krova.cloud/api/v1","description":"Production"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"OAuth2":["api"]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY"},"BearerAuth":{"type":"http","scheme":"bearer","description":"An API key (kro_...) or an OAuth access token, sent as Authorization: Bearer <token>. Sending X-API-KEY as well makes the API ignore this header."},"OAuth2":{"type":"oauth2","description":"OAuth 2.0 authorization code with PKCE (S256). Clients identify themselves with a Client ID Metadata Document URL. Each grant is bound to one space the person picks at sign-in. Server metadata: /.well-known/oauth-authorization-server.","flows":{"authorizationCode":{"authorizationUrl":"https://krova.cloud/api/auth/oauth2/authorize","tokenUrl":"https://krova.cloud/api/auth/oauth2/token","refreshUrl":"https://krova.cloud/api/auth/oauth2/token","scopes":{"api":"Act in the chosen space with the approving member's permissions","offline_access":"Receive a refresh token"}}}}},"schemas":{"Space":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"tier":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","tier","createdAt"]},"CubeSshInfo":{"type":"object","properties":{"host":{"type":"string","nullable":true},"port":{"type":"integer"},"user":{"type":"string"},"hostKeys":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"key":{"type":"string"}},"required":["type","key"]}}},"required":["host","port","user","hostKeys"]},"Cube":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"state":{"type":"string","enum":["pending","booting","running","stopped","stopping","resizing","error","deleted"]},"publicIpv4":{"type":"string","nullable":true},"resources":{"type":"object","properties":{"vcpu":{"type":"integer"},"ramGb":{"type":"number"},"diskGb":{"type":"integer"}},"required":["vcpu","ramGb","diskGb"]},"image":{"type":"string"},"sshUser":{"type":"string"},"costPerHour":{"type":"number"},"serverDomain":{"type":"string","nullable":true,"description":"The hostname of the server currently hosting this Cube (e.g. `mango.krova.cloud`), shared by every Cube on that server. This is NOT the Cube's own SSH target — use `host` from GET .../ssh for that, which is the Cube's own stable hostname and survives migration to another server. Null when the Cube has no server assigned. Only present on the single-Cube GET; list and create responses omit it."},"terminationProtection":{"type":"boolean","description":"Per-cube opt-in flag. When true, customer-initiated destroy paths return 409 with `error.code = \"termination_protected\"`. Power-off, wake, restart, restore, network-reset, and snapshot ops are NOT termination and remain allowed. Default false."},"terminationProtectionChangedAt":{"type":"string","format":"date-time","nullable":true,"description":"ISO8601 timestamp of the most recent toggle of `terminationProtection`. Null when the flag has never been turned on."},"terminationProtectionChangedBy":{"type":"string","nullable":true,"description":"Identifies the actor that last toggled the flag: `\"user:<id>\"` for a customer, `\"admin:<id>\"` for an operator, `\"system:<job-name>\"` for a worker-driven write. Null when the flag has never been turned on."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","state","publicIpv4","resources","image","sshUser","costPerHour","terminationProtection","terminationProtectionChangedAt","terminationProtectionChangedBy","createdAt","updatedAt"]},"Pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["page","limit","total","totalPages"]},"Region":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]},"Image":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"version":{"type":"string"},"description":{"type":"string"},"defaultUser":{"type":"string"}},"required":["id","name","version","description","defaultUser"]},"PricingTier":{"type":"object","properties":{"minVcpus":{"type":"integer"},"maxVcpus":{"type":"integer","nullable":true},"multiplier":{"type":"number"},"label":{"type":"string"}},"required":["minVcpus","maxVcpus","multiplier","label"]},"DnsRecord":{"type":"object","properties":{"id":{"type":"string","enum":["ownership","routing","certificate"]},"type":{"type":"string","enum":["CNAME","TXT","A"]},"host":{"type":"string"},"value":{"type":"string"},"purpose":{"type":"string","enum":["ownership","routing","certificate"]},"note":{"type":"string","nullable":true},"mustBeGrey":{"type":"boolean"},"proxyOk":{"type":"boolean"}},"required":["id","type","host","value","purpose","mustBeGrey","proxyOk"]},"DnsRecordStatus":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["CNAME","TXT","A"]},"host":{"type":"string"},"value":{"type":"string"},"purpose":{"type":"string"},"note":{"type":"string","nullable":true},"mustBeGrey":{"type":"boolean"},"proxyOk":{"type":"boolean"},"state":{"type":"string","enum":["found","missing","mismatch","unknown"]},"detail":{"type":"string"},"observed":{"type":"array","nullable":true,"items":{"type":"string"}}},"required":["id","type","host","value","purpose","state","detail"]},"Domain":{"type":"object","properties":{"id":{"type":"string"},"cubeId":{"type":"string"},"domain":{"type":"string"},"port":{"type":"integer","nullable":true},"status":{"type":"string"},"ingressStatus":{"type":"string","nullable":true},"securityHeadersMode":{"type":"string","enum":["enforced","app_managed"]},"responseHeaderTimeoutSecs":{"type":"integer"},"responseHeaderOverrides":{"type":"object","nullable":true,"description":"Header rewrites: `set` adds/overwrites, `remove` deletes. Null clears all.","properties":{"set":{"type":"object","additionalProperties":{"type":"string"}},"remove":{"type":"array","items":{"type":"string"}}}},"requestHeaderOverrides":{"type":"object","nullable":true,"description":"Header rewrites: `set` adds/overwrites, `remove` deletes. Null clears all.","properties":{"set":{"type":"object","additionalProperties":{"type":"string"}},"remove":{"type":"array","items":{"type":"string"}}}},"maxRequestBodyMb":{"type":"integer","nullable":true},"responseCompression":{"type":"boolean"},"ipAllowList":{"type":"array","nullable":true,"items":{"type":"string"}},"ipDenyList":{"type":"array","nullable":true,"items":{"type":"string"}},"basicAuthUser":{"type":"string","nullable":true},"basicAuthEnabled":{"type":"boolean"},"corsConfig":{"type":"object","nullable":true},"originScheme":{"type":"string","enum":["http","https"]},"proxyProtocol":{"type":"string","nullable":true,"enum":["v1","v2"]},"isWildcard":{"type":"boolean"},"wildcardCertState":{"type":"string","nullable":true,"enum":["pending_delegation","issuing","ready","failed"]},"acmeDelegationTarget":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","cubeId","domain","port","status","ingressStatus","securityHeadersMode","responseHeaderTimeoutSecs","responseHeaderOverrides","requestHeaderOverrides","maxRequestBodyMb","responseCompression","ipAllowList","ipDenyList","basicAuthUser","basicAuthEnabled","corsConfig","originScheme","proxyProtocol","isWildcard","wildcardCertState","acmeDelegationTarget","createdAt","updatedAt"]},"TcpMapping":{"type":"object","properties":{"id":{"type":"string"},"cubeId":{"type":"string"},"cubePort":{"type":"integer"},"host":{"type":"string","nullable":true,"description":"Where to connect for this mapping: `host:hostPort`. The Cube's own stable hostname, which survives migration to another server, falling back to the server's public IP when the Cube has no DNS record yet. Identical to `host` from GET .../ssh, and the same value for every mapping on a Cube. Null only when the Cube has no server assigned, in which case there is nowhere to connect. Do NOT use `serverDomain` from the Cube object — that is the current physical host and changes when the Cube moves."},"hostPort":{"type":"integer"},"label":{"type":"string","nullable":true},"status":{"type":"string"},"isSsh":{"type":"boolean"},"udpEnabled":{"type":"boolean","description":"Whether this mapping also forwards UDP on the same host port. True means TCP and UDP; false means TCP only. Always false for the platform SSH mapping."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"whitelistedIps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"cidr":{"type":"string"}},"required":["id","cidr"]}}},"required":["id","cubeId","cubePort","hostPort","label","status","isSsh","udpEnabled","createdAt","updatedAt","whitelistedIps"]},"Snapshot":{"type":"object","properties":{"id":{"type":"string"},"cubeId":{"type":"string"},"name":{"type":"string"},"sizeBytes":{"type":"integer","nullable":true},"status":{"type":"string"},"kind":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","cubeId","name","sizeBytes","status","kind","createdAt"]},"Backup":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["pending","creating","complete","failed"]},"originalCubeId":{"type":"string"},"originalCubeName":{"type":"string"},"sizeBytes":{"type":"integer","nullable":true},"diskSizeGb":{"type":"integer"},"config":{"type":"object","description":"The Cube configuration captured with the backup, used by redeploy. A shared copy carries no domains.","properties":{"vcpus":{"type":"number","nullable":true},"ramMb":{"type":"integer","nullable":true},"diskLimitGb":{"type":"integer","nullable":true},"imageId":{"type":"string","nullable":true},"regionId":{"type":"string","nullable":true},"regionName":{"type":"string","nullable":true},"domains":{"type":"array","items":{"type":"object","properties":{"domain":{"type":"string"},"port":{"type":"integer"}},"required":["domain","port"]}},"tcpPorts":{"type":"array","items":{"type":"object","properties":{"cubePort":{"type":"integer"},"label":{"type":"string","nullable":true}},"required":["cubePort","label"]}}},"required":["vcpus","ramMb","diskLimitGb","imageId","regionId","regionName","domains","tcpPorts"]},"sharedFromBackupId":{"type":"string","nullable":true,"description":"Set on a shared copy: the backup it was shared from, which may since have been deleted. Null for a backup this space made itself."},"redeployedCubeId":{"type":"string","nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","status","originalCubeId","originalCubeName","sizeBytes","diskSizeGb","config","sharedFromBackupId","redeployedCubeId","completedAt","createdAt"]},"BackupShare":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","accepted","declined","canceled","expired"]},"backupId":{"type":"string","description":"The SOURCE backup being shared."},"backupName":{"type":"string"},"sourceSpaceId":{"type":"string"},"destinationSpaceId":{"type":"string"},"counterpartySpaceName":{"type":"string","description":"The other space in this share: the destination on an outgoing share, the source on an incoming one."},"copyBackupId":{"type":"string","nullable":true,"description":"The destination space's own copy, once the share is accepted."},"expiresAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","status","backupId","backupName","sourceSpaceId","destinationSpaceId","counterpartySpaceName","copyBackupId","expiresAt","createdAt"]},"Webhook":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","description":"A Krova webhook event name (see the webhooks docs for the full list)."}},"enabled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","url","events","enabled","createdAt","updatedAt"]},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string"},"event":{"type":"string"},"status":{"type":"string","enum":["pending","delivered","failed"]},"attempts":{"type":"integer"},"lastAttemptAt":{"type":"string","format":"date-time","nullable":true},"responseStatus":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","event","status","attempts","lastAttemptAt","responseStatus","createdAt"]},"Error":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}},"responses":{"BadRequest":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"Authenticated but lacks the required permission","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"Rate limit exceeded (10 mutations / 60s)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/regions":{"get":{"summary":"List regions with available capacity","security":[],"tags":["Public"],"responses":{"200":{"description":"Region list","content":{"application/json":{"schema":{"type":"object","properties":{"regions":{"type":"array","items":{"$ref":"#/components/schemas/Region"}}},"required":["regions"]}}}}}}},"/images":{"get":{"summary":"List available OS images","security":[],"tags":["Public"],"responses":{"200":{"description":"Image list","content":{"application/json":{"schema":{"type":"object","properties":{"images":{"type":"array","items":{"$ref":"#/components/schemas/Image"}}},"required":["images"]}}}}}}},"/pricing":{"get":{"summary":"Per-resource hourly rates and volume pricing tiers","security":[],"tags":["Public"],"responses":{"200":{"description":"Pricing data","content":{"application/json":{"schema":{"type":"object","properties":{"currency":{"type":"string"},"rates":{"type":"object","properties":{"vcpuPerHour":{"type":"number"},"ramGbPerHour":{"type":"number"},"diskGbPerHour":{"type":"number"}},"required":["vcpuPerHour","ramGbPerHour","diskGbPerHour"]},"tiers":{"type":"array","items":{"$ref":"#/components/schemas/PricingTier"}},"note":{"type":"string"}},"required":["currency","rates","tiers","note"]}}}}}}},"/auth/cli/start":{"post":{"summary":"Begin a CLI device-authorization login (RFC 8628)","description":"Public, unauthenticated. Mints a device code (returned once) and a short human user code, and returns the verification URIs the user opens in a browser to approve. The CLI then polls /auth/cli/poll. Rate-limited per client IP.","security":[],"tags":["CLI Auth"],"responses":{"200":{"description":"Device-authorization request created","content":{"application/json":{"schema":{"type":"object","required":["deviceCode","userCode","verificationUri","verificationUriComplete","interval","expiresIn"],"properties":{"deviceCode":{"type":"string","description":"High-entropy code the CLI keeps secret and presents on each poll. Only its hash is stored server-side."},"userCode":{"type":"string","description":"Short human-readable code (KROVA-XXXX-XXXX) the user confirms in the browser."},"verificationUri":{"type":"string","format":"uri","description":"Browser URL where the user approves."},"verificationUriComplete":{"type":"string","format":"uri","description":"verificationUri with the user code pre-filled."},"interval":{"type":"integer","description":"Seconds to wait between polls."},"expiresIn":{"type":"integer","description":"Seconds until the device code expires (~600)."}}}}}},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"description":"Could not allocate a login code; retry"}}}},"/auth/cli/poll":{"post":{"summary":"Poll for CLI device-authorization approval (RFC 8628)","description":"Public, unauthenticated. The CLI submits its deviceCode until the user approves or denies. On approval a real API key is minted ONCE, scoped to the approved Space and the approving user's membership, and returned a single time. Rate-limited per client IP.","security":[],"tags":["CLI Auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["deviceCode"],"properties":{"deviceCode":{"type":"string","description":"The device code from /auth/cli/start."}}}}}},"responses":{"200":{"description":"Approved — API key minted (returned once)","content":{"application/json":{"schema":{"type":"object","required":["apiKey","spaceId"],"properties":{"apiKey":{"type":"string","description":"The full API key. Shown once and never returned again — store it securely."},"spaceId":{"type":"string","description":"The Space the key is scoped to."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"description":"The user denied the login request"},"410":{"description":"The device code expired, was already consumed, or is unknown"},"428":{"description":"Authorization still pending — keep polling at the given interval"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/space":{"get":{"summary":"Resolve the space this API key is scoped to","description":"Returns the single space the API key belongs to. Lets a client auto-resolve the space id from the key alone (no spaceId in the URL).","tags":["Spaces"],"responses":{"200":{"description":"The key's space","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Space"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/spaces/{spaceId}/cubes":{"get":{"summary":"List Cubes in a Space","tags":["Cubes"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated Cube list","content":{"application/json":{"schema":{"type":"object","properties":{"cubes":{"type":"array","items":{"$ref":"#/components/schemas/Cube"}},"pagination":{"$ref":"#/components/schemas/Pagination"}},"required":["cubes","pagination"]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"summary":"Create a Cube","tags":["Cubes"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional unique key (max 255 chars). Replays return the original response and add header Idempotency-Replayed: true. Scoped per space; expires after 24h.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","image","resources","sshPublicKey"],"properties":{"name":{"type":"string"},"image":{"type":"string"},"resources":{"type":"object","required":["vcpu","ramGb","diskGb"],"properties":{"vcpu":{"type":"number"},"ramGb":{"type":"number"},"diskGb":{"type":"number"}}},"sshPublicKey":{"type":"string","description":"SSH public key written to the Cube login user's authorized_keys at boot (~/.ssh/authorized_keys for the ubuntu or debian user; /root/.ssh/authorized_keys on Cubes created before the default-user change). GET /cubes/{cubeId}/ssh reports the login user for a given Cube. Must start with ssh-ed25519, ssh-rsa, ecdsa-sha2-*, ssh-dss, or sk-*@openssh.com."},"region":{"type":"string","description":"Region slug from /v1/regions (optional)."},"userData":{"type":"string","description":"cloud-init script (max 16 KB, optional)."},"terminationProtection":{"type":"boolean","default":false,"description":"Create the Cube with termination protection already on, so it is never briefly deletable between create and a follow-up PATCH. Optional; anything other than a boolean is rejected with 400."}}}}}},"responses":{"201":{"description":"Cube created","content":{"application/json":{"schema":{"type":"object","properties":{"cube":{"$ref":"#/components/schemas/Cube"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/cubes/{cubeId}":{"get":{"summary":"Get a Cube","tags":["Cubes"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Cube","content":{"application/json":{"schema":{"type":"object","properties":{"cube":{"$ref":"#/components/schemas/Cube"}},"required":["cube"]}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"summary":"Update a Cube (toggle termination protection)","description":"Idempotent. Termination protection is the only PATCHable field today: sending the value it already has returns the Cube unchanged and writes no audit row. Omitting it is a 400 rather than a no-op, so a typo in the field name cannot look like success. Rename and resize are not part of the public API.","tags":["Cubes"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["terminationProtection"],"properties":{"terminationProtection":{"type":"boolean","description":"Turn protection on or off. Turning it on stamps `terminationProtectionChangedAt` and `terminationProtectionChangedBy`; turning it off clears both."}}}}}},"responses":{"200":{"description":"The updated Cube","content":{"application/json":{"schema":{"type":"object","properties":{"cube":{"$ref":"#/components/schemas/Cube"}},"required":["cube"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"summary":"Delete a Cube (asynchronous)","tags":["Cubes"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deletion enqueued","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The Cube has termination protection on. Turn it off with PATCH before deleting. Power-off, wake, restart, restore, network-reset and snapshot operations are not termination and are never blocked by this.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["termination_protected"]},"message":{"type":"string"},"cube":{"type":"object","properties":{"id":{"type":"string"},"terminationProtectionChangedAt":{"type":"string","format":"date-time","nullable":true},"terminationProtectionChangedBy":{"type":"string","nullable":true}}}}}}}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/cubes/{cubeId}/power-off":{"post":{"summary":"Power off a running Cube","tags":["Cubes"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Power off enqueued"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/cubes/{cubeId}/wake":{"post":{"summary":"Start a stopped Cube","tags":["Cubes"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Start enqueued"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/cubes/{cubeId}/restart":{"post":{"summary":"Restart a running Cube","description":"Cold-restarts the Cube: the hypervisor process is stopped and relaunched, so the Cube boots against the host's current kernel. This is how a Cube picks up a refreshed guest kernel after a platform image update — a `reboot` issued inside the Cube cannot do it, because the kernel is supplied externally by the host. Disk state is preserved; only the kernel changes. Cube must be `running` (a stopped Cube already picks up the latest kernel when started). Concurrent restarts of the same Cube are rejected with 409 rather than queued twice.","tags":["Cubes"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Restart enqueued"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Cube is not running, or a restart is already in progress"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/cubes/{cubeId}/ssh-port":{"put":{"summary":"Change a Cube's SSH port","description":"Sets the port INSIDE the Cube that SSH is forwarded to — NOT the host port you connect to. The host port is allocated by Krova and is unchanged by this call. Pointing this at a port nothing is listening on inside the Cube will make SSH unreachable; the default is 22. The change is applied atomically (the old port mapping is replaced).","tags":["Cubes"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["cubePort"],"properties":{"cubePort":{"type":"integer","minimum":1,"maximum":65535,"description":"The port inside the Cube that sshd listens on (default 22). This is the Cube side of the mapping, not the host port."}}}}}},"responses":{"200":{"description":"SSH port updated"},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Refused because the change conflicts with the Cube's current state, for example the port is already in use or the mapping is already being removed. One such conflict is temporary: in the last stretch of a move of the Cube to another server the change is refused with the error \"This cube is being moved to another server. Try again in a minute.\" Nothing was changed then, and the same request is accepted once the move ends."},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/cubes/{cubeId}/ssh":{"get":{"summary":"Get a Cube's SSH connection info","description":"Host (server public IPv4), host SSH port, login user, and the Cube's captured SSH host public keys. **Use `user` rather than assuming a username** — it is `ubuntu` or `debian` on Cubes created from images that ship a default user, and `root` on Cubes created before that change or imported from a rootfs without one. `hostKeys` is empty only until the reachability cron makes its first capture; clients fall back to trust-on-first-use until then, and pin strictly afterwards.","tags":["Cubes"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"SSH connection info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CubeSshInfo"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/spaces/{spaceId}/cubes/{cubeId}/domains":{"get":{"summary":"List custom domains attached to a Cube","tags":["Domains"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Domain list","content":{"application/json":{"schema":{"type":"object","properties":{"domains":{"type":"array","items":{"$ref":"#/components/schemas/Domain"}}},"required":["domains"]}}}}}},"post":{"summary":"Attach a custom domain to a Cube","description":"Attaches a domain and optionally configures any per-domain proxy settings at the same time. Settings can also be changed later via PATCH.","tags":["Domains"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional unique key (max 255 chars). Replays return the original response and add header Idempotency-Replayed: true. Scoped per space; expires after 24h.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["domain","port"],"properties":{"domain":{"type":"string","description":"The hostname to attach, e.g. app.example.com"},"port":{"type":"integer","minimum":1,"maximum":65535,"description":"Cube port the domain proxies to."},"securityHeadersMode":{"type":"string","enum":["enforced","app_managed"],"description":"enforced = proxy sets platform security headers (HSTS, X-Frame-Options, …); app_managed = the app's own headers pass through. Default enforced."},"responseHeaderTimeoutSecs":{"type":"integer","minimum":10,"maximum":3600,"description":"Seconds the app may take to send response headers (streaming unaffected). Default 60."},"responseHeaderOverrides":{"type":"object","nullable":true,"description":"Header rewrites: `set` adds/overwrites, `remove` deletes. Null clears all.","properties":{"set":{"type":"object","additionalProperties":{"type":"string"}},"remove":{"type":"array","items":{"type":"string"}}}},"requestHeaderOverrides":{"type":"object","nullable":true,"description":"Header rewrites: `set` adds/overwrites, `remove` deletes. Null clears all.","properties":{"set":{"type":"object","additionalProperties":{"type":"string"}},"remove":{"type":"array","items":{"type":"string"}}}},"maxRequestBodyMb":{"type":"integer","nullable":true,"minimum":1,"maximum":10240,"description":"Max request body size (MB). Null = unlimited (default)."},"corsConfig":{"type":"object","nullable":true,"description":"Per-domain CORS policy, applied at the edge. Null (default) = CORS disabled and no Access-Control-* header is emitted anywhere. When set, the proxy answers OPTIONS preflight itself (204, the cube is never involved) and adds the headers to normal AND error responses, so a cross-origin request to a failing or stopped cube is never CORS-masked.","required":["allowedOrigins"],"properties":{"allowedOrigins":{"type":"array","maxItems":20,"items":{"type":"string"},"description":"Exact scheme://host[:port] origins (no path, query or trailing slash), or the single-element wildcard [\"*\"]. \"*\" and allowCredentials are mutually exclusive."},"allowedMethods":{"type":"array","maxItems":30,"items":{"type":"string"},"description":"Allowed methods. Omitted = GET, POST, PUT, PATCH, DELETE, OPTIONS."},"allowedHeaders":{"type":"array","maxItems":30,"items":{"type":"string"},"description":"Allowed request headers. Omitted/empty = echo the preflight's Access-Control-Request-Headers."},"exposedHeaders":{"type":"array","maxItems":30,"items":{"type":"string"},"description":"Response headers exposed to JS. Omitted/empty = none."},"allowCredentials":{"type":"boolean","description":"Send Access-Control-Allow-Credentials: true. Rejected together with the \"*\" origin."},"maxAgeSeconds":{"type":"integer","minimum":0,"maximum":86400,"description":"Preflight cache TTL. Default 600; 86400 is Chromium's hard cap."}}},"originScheme":{"type":"string","enum":["http","https"],"description":"Scheme the edge speaks to the CUBE on the backend hop. http (default) = cleartext. https = the cube terminates TLS itself (a control panel holding its own certificate, or an app listening on HTTPS) and answers plain HTTP with a redirect, so it cannot be reached over cleartext at all. Visitors are on HTTPS either way. The dial port is derived: https on the default port 80 connects on 443; a deliberate custom port is honored exactly. Applied as saved: if the cube does not serve this hostname over HTTPS, requests to the domain fail until you set it back to http."},"proxyProtocol":{"type":"string","nullable":true,"enum":["v1","v2"],"description":"Send a PROXY protocol header (v1 text or v2 binary) at the start of every connection to the cube, so the app reads the visitor's address from the connection itself, as on a plain VPS. Null (default) = off. The app must accept PROXY protocol on this port, or every request to the domain fails; it is applied as saved. Every domain on the same cube port must use the same setting: a save that would mix them is refused with 409 unless confirmMixedProxyProtocol is true."},"confirmMixedProxyProtocol":{"type":"boolean","description":"Accept a save that leaves domains on the same cube port with different proxyProtocol settings (for an app that handles both on one port, or mid-migration). Not stored."},"responseCompression":{"type":"boolean","description":"Edge gzip/zstd compression. Default false (domains behind a CDN are already compressed there)."},"ipAllowList":{"type":"array","nullable":true,"maxItems":50,"items":{"type":"string"},"description":"Visitor IP/CIDR allow-list (v4+v6). Non-empty ⇒ only these reach the app. Null/empty = open."},"ipDenyList":{"type":"array","nullable":true,"maxItems":50,"items":{"type":"string"},"description":"Visitor IP/CIDR deny-list (v4+v6) → 403. Null/empty = none."},"basicAuthUser":{"type":"string","nullable":true,"description":"HTTP Basic Auth username. Null/empty clears Basic Auth. Setting it requires basicAuthPassword."},"basicAuthPassword":{"type":"string","writeOnly":true,"description":"Plaintext Basic Auth password — bcrypt-hashed server-side, never stored or returned. Required when setting basicAuthUser."}}}}}},"responses":{"201":{"description":"Domain attached","content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"$ref":"#/components/schemas/Domain"},"records":{"type":"array","items":{"$ref":"#/components/schemas/DnsRecord"}}},"required":["domain","records"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"409":{"description":"Refused. Among other reasons (the domain is in use or is being removed; or, temporarily, the Cube is in the last stretch of a move to another server, refused with the error \"This cube is being moved to another server. Try again in a minute.\" and accepted once the move ends): the save would leave domains on the same cube port with different proxyProtocol settings. Then `errorMeta.code` is `proxy_protocol_port_mismatch`, with `errorMeta.port` and `errorMeta.domains` naming the other domains. Change them together, or resend with confirmMixedProxyProtocol: true."},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}/records":{"get":{"summary":"DNS records this domain needs, with their live status","description":"Every record required for the domain to work, each checked against live DNS. Poll this after publishing them.\n\n`state` is per record: `found`, `missing` (not published yet — the expected state before you add it, never an error), `mismatch` (something else is there), or `unknown` (we could not check — never a statement about your DNS). `summary.complete` is true only when every record is `found`.\n\nA wildcard needs three records; an exact host needs one. Each call performs live DNS lookups and is rate limited.","tags":["Domains"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}},{"name":"mappingId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Required records with live status","content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string"},"isWildcard":{"type":"boolean"},"records":{"type":"array","items":{"$ref":"#/components/schemas/DnsRecordStatus"}},"summary":{"type":"object","properties":{"found":{"type":"integer"},"total":{"type":"integer"},"complete":{"type":"boolean"}},"required":["found","total","complete"]},"checkedAt":{"type":"string","format":"date-time"}},"required":["domain","isWildcard","records","summary","checkedAt"]}}}},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/cubes/{cubeId}/domains/{mappingId}":{"patch":{"summary":"Update a custom domain's proxy settings","description":"Partial update — only the fields you send change; omitted fields are left as-is. The Basic Auth password is write-only and bcrypt-hashed server-side.","tags":["Domains"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}},{"name":"mappingId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"securityHeadersMode":{"type":"string","enum":["enforced","app_managed"],"description":"enforced = proxy sets platform security headers (HSTS, X-Frame-Options, …); app_managed = the app's own headers pass through. Default enforced."},"responseHeaderTimeoutSecs":{"type":"integer","minimum":10,"maximum":3600,"description":"Seconds the app may take to send response headers (streaming unaffected). Default 60."},"responseHeaderOverrides":{"type":"object","nullable":true,"description":"Header rewrites: `set` adds/overwrites, `remove` deletes. Null clears all.","properties":{"set":{"type":"object","additionalProperties":{"type":"string"}},"remove":{"type":"array","items":{"type":"string"}}}},"requestHeaderOverrides":{"type":"object","nullable":true,"description":"Header rewrites: `set` adds/overwrites, `remove` deletes. Null clears all.","properties":{"set":{"type":"object","additionalProperties":{"type":"string"}},"remove":{"type":"array","items":{"type":"string"}}}},"maxRequestBodyMb":{"type":"integer","nullable":true,"minimum":1,"maximum":10240,"description":"Max request body size (MB). Null = unlimited (default)."},"corsConfig":{"type":"object","nullable":true,"description":"Per-domain CORS policy, applied at the edge. Null (default) = CORS disabled and no Access-Control-* header is emitted anywhere. When set, the proxy answers OPTIONS preflight itself (204, the cube is never involved) and adds the headers to normal AND error responses, so a cross-origin request to a failing or stopped cube is never CORS-masked.","required":["allowedOrigins"],"properties":{"allowedOrigins":{"type":"array","maxItems":20,"items":{"type":"string"},"description":"Exact scheme://host[:port] origins (no path, query or trailing slash), or the single-element wildcard [\"*\"]. \"*\" and allowCredentials are mutually exclusive."},"allowedMethods":{"type":"array","maxItems":30,"items":{"type":"string"},"description":"Allowed methods. Omitted = GET, POST, PUT, PATCH, DELETE, OPTIONS."},"allowedHeaders":{"type":"array","maxItems":30,"items":{"type":"string"},"description":"Allowed request headers. Omitted/empty = echo the preflight's Access-Control-Request-Headers."},"exposedHeaders":{"type":"array","maxItems":30,"items":{"type":"string"},"description":"Response headers exposed to JS. Omitted/empty = none."},"allowCredentials":{"type":"boolean","description":"Send Access-Control-Allow-Credentials: true. Rejected together with the \"*\" origin."},"maxAgeSeconds":{"type":"integer","minimum":0,"maximum":86400,"description":"Preflight cache TTL. Default 600; 86400 is Chromium's hard cap."}}},"originScheme":{"type":"string","enum":["http","https"],"description":"Scheme the edge speaks to the CUBE on the backend hop. http (default) = cleartext. https = the cube terminates TLS itself (a control panel holding its own certificate, or an app listening on HTTPS) and answers plain HTTP with a redirect, so it cannot be reached over cleartext at all. Visitors are on HTTPS either way. The dial port is derived: https on the default port 80 connects on 443; a deliberate custom port is honored exactly. Applied as saved: if the cube does not serve this hostname over HTTPS, requests to the domain fail until you set it back to http."},"proxyProtocol":{"type":"string","nullable":true,"enum":["v1","v2"],"description":"Send a PROXY protocol header (v1 text or v2 binary) at the start of every connection to the cube, so the app reads the visitor's address from the connection itself, as on a plain VPS. Null (default) = off. The app must accept PROXY protocol on this port, or every request to the domain fails; it is applied as saved. Every domain on the same cube port must use the same setting: a save that would mix them is refused with 409 unless confirmMixedProxyProtocol is true."},"confirmMixedProxyProtocol":{"type":"boolean","description":"Accept a save that leaves domains on the same cube port with different proxyProtocol settings (for an app that handles both on one port, or mid-migration). Not stored."},"responseCompression":{"type":"boolean","description":"Edge gzip/zstd compression. Default false (domains behind a CDN are already compressed there)."},"ipAllowList":{"type":"array","nullable":true,"maxItems":50,"items":{"type":"string"},"description":"Visitor IP/CIDR allow-list (v4+v6). Non-empty ⇒ only these reach the app. Null/empty = open."},"ipDenyList":{"type":"array","nullable":true,"maxItems":50,"items":{"type":"string"},"description":"Visitor IP/CIDR deny-list (v4+v6) → 403. Null/empty = none."},"basicAuthUser":{"type":"string","nullable":true,"description":"HTTP Basic Auth username. Null/empty clears Basic Auth. Setting it requires basicAuthPassword."},"basicAuthPassword":{"type":"string","writeOnly":true,"description":"Plaintext Basic Auth password — bcrypt-hashed server-side, never stored or returned. Required when setting basicAuthUser."}}}}}},"responses":{"200":{"description":"Settings updated","content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"$ref":"#/components/schemas/Domain"}},"required":["domain"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Refused. Among other reasons (the domain is in use or is being removed; or, temporarily, the Cube is in the last stretch of a move to another server, refused with the error \"This cube is being moved to another server. Try again in a minute.\" and accepted once the move ends): the save would leave domains on the same cube port with different proxyProtocol settings. Then `errorMeta.code` is `proxy_protocol_port_mismatch`, with `errorMeta.port` and `errorMeta.domains` naming the other domains. Change them together, or resend with confirmMixedProxyProtocol: true."},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"summary":"Detach a custom domain","tags":["Domains"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}},{"name":"mappingId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Detached","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Refused because the change conflicts with the Cube's current state, for example the port is already in use or the mapping is already being removed. One such conflict is temporary: in the last stretch of a move of the Cube to another server the change is refused with the error \"This cube is being moved to another server. Try again in a minute.\" Nothing was changed then, and the same request is accepted once the move ends."}}}},"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings":{"get":{"summary":"List TCP port forwards for a Cube","tags":["TCP mappings"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"TCP mapping list","content":{"application/json":{"schema":{"type":"object","properties":{"tcpMappings":{"type":"array","items":{"$ref":"#/components/schemas/TcpMapping"}}},"required":["tcpMappings"]}}}}}},"post":{"summary":"Create a TCP port forward","tags":["TCP mappings"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional unique key (max 255 chars). Replays return the original response and add header Idempotency-Replayed: true. Scoped per space; expires after 24h.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["cubePort"],"properties":{"cubePort":{"type":"integer"},"label":{"type":"string","maxLength":100,"description":"Optional human label for the mapping."},"whitelistedIps":{"type":"array","items":{"type":"string"},"description":"IPs/CIDRs allowed to reach the published port. Omit or send an empty array to leave the port open to the internet."},"whitelistIps":{"type":"array","items":{"type":"string"},"deprecated":true,"description":"DEPRECATED alias for `whitelistedIps`, accepted for backwards compatibility. `whitelistedIps` wins if both are sent. Use `whitelistedIps` in new code."},"udpEnabled":{"type":"boolean","default":true,"description":"Also forward UDP on this port. Defaults to true. Always false for the platform SSH mapping. The allowlist, if you send one, applies to both protocols."}}}}}},"responses":{"201":{"description":"Mapping created","content":{"application/json":{"schema":{"type":"object","properties":{"tcpMapping":{"$ref":"#/components/schemas/TcpMapping"}},"required":["tcpMapping"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"409":{"description":"Refused because the change conflicts with the Cube's current state, for example the port is already in use or the mapping is already being removed. One such conflict is temporary: in the last stretch of a move of the Cube to another server the change is refused with the error \"This cube is being moved to another server. Try again in a minute.\" Nothing was changed then, and the same request is accepted once the move ends."},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/cubes/{cubeId}/tcp-mappings/{mappingId}":{"delete":{"summary":"Delete a TCP port forward","tags":["TCP mappings"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}},{"name":"mappingId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Refused because the change conflicts with the Cube's current state, for example the port is already in use or the mapping is already being removed. One such conflict is temporary: in the last stretch of a move of the Cube to another server the change is refused with the error \"This cube is being moved to another server. Try again in a minute.\" Nothing was changed then, and the same request is accepted once the move ends."}}}},"/spaces/{spaceId}/cubes/{cubeId}/snapshots":{"get":{"summary":"List snapshots for a Cube","tags":["Snapshots"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Snapshot list","content":{"application/json":{"schema":{"type":"object","properties":{"snapshots":{"type":"array","items":{"$ref":"#/components/schemas/Snapshot"}}},"required":["snapshots"]}}}}}},"post":{"summary":"Create a snapshot","tags":["Snapshots"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional unique key (max 255 chars). Replays return the original response and add header Idempotency-Replayed: true. Scoped per space; expires after 24h.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"Snapshot enqueued","content":{"application/json":{"schema":{"type":"object","properties":{"snapshot":{"$ref":"#/components/schemas/Snapshot"}},"required":["snapshot"]}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/cubes/{cubeId}/snapshots/{snapshotId}":{"delete":{"summary":"Delete a snapshot","tags":["Snapshots"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}},{"name":"snapshotId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/spaces/{spaceId}/cubes/{cubeId}/restore":{"post":{"summary":"Restore a Cube from a snapshot","tags":["Snapshots"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"cubeId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["snapshotId"],"properties":{"snapshotId":{"type":"string"}}}}}},"responses":{"200":{"description":"Restore enqueued","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/spaces/{spaceId}/backups/{backupId}/download":{"get":{"summary":"Generate a presigned download URL for a backup .cube archive","tags":["Backups"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"backupId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Presigned URL valid for 15 minutes","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"filename":{"type":"string"},"sizeBytes":{"type":"integer","nullable":true},"expiresAt":{"type":"string","format":"date-time"}}}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Backup is not in 'complete' status"}}}},"/spaces/{spaceId}/backups":{"get":{"summary":"List the space's backups, newest first (shared copies included)","tags":["Backups"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Backups","content":{"application/json":{"schema":{"type":"object","properties":{"backups":{"type":"array","items":{"$ref":"#/components/schemas/Backup"}}},"required":["backups"]}}}},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/spaces/{spaceId}/backups/{backupId}":{"get":{"summary":"Get one backup","tags":["Backups"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"backupId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The backup","content":{"application/json":{"schema":{"type":"object","properties":{"backup":{"$ref":"#/components/schemas/Backup"}},"required":["backup"]}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/spaces/{spaceId}/backups/{backupId}/shares":{"post":{"summary":"Offer a copy of this backup to another space","description":"Requires `backup.manage`. Creates a pending share request that the destination space accepts within 48 hours: its owner, or a member there with `backup.manage`, in the dashboard or with an API key of their own. On acceptance the destination gets its own copy of the backup and pays backup storage for it from that moment; this space's backup is unchanged. A request made with an API key never completes immediately, even when the key's user owns both spaces.","tags":["Backups"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"backupId","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional unique key (max 255 chars). Replays return the original response and add header Idempotency-Replayed: true. Scoped per space; expires after 24h.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["destinationSpaceId"],"properties":{"destinationSpaceId":{"type":"string"}}}}}},"responses":{"201":{"description":"Share requested","content":{"application/json":{"schema":{"type":"object","properties":{"share":{"$ref":"#/components/schemas/BackupShare"}},"required":["share"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The backup is not complete, is being deleted, is already in that space, or already has a pending share request for it"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/backup-shares":{"get":{"summary":"List pending backup shares into and out of this space","tags":["Backups"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"`incoming` asks this space to accept a copy; `outgoing` was offered by this space","content":{"application/json":{"schema":{"type":"object","properties":{"incoming":{"type":"array","items":{"$ref":"#/components/schemas/BackupShare"}},"outgoing":{"type":"array","items":{"$ref":"#/components/schemas/BackupShare"}}},"required":["incoming","outgoing"]}}}},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/spaces/{spaceId}/backup-shares/{shareId}/accept":{"post":{"summary":"Accept a backup share offered to this space","description":"Requires an API key of this space's owner, or of a member with `backup.manage`. Creates this space's own copy of the backup, billed for storage from now. Refused with 422 when the space cannot take it (no card, unverified owner, open abuse notice, no credit, or no backup allowance left on its plan).","tags":["Backups"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"shareId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The share and the new copy","content":{"application/json":{"schema":{"type":"object","properties":{"share":{"$ref":"#/components/schemas/BackupShare"},"backup":{"$ref":"#/components/schemas/Backup"}},"required":["share","backup"]}}}},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"description":"The request is no longer pending, has expired, or this space already has a copy"},"422":{"description":"This space cannot take the copy right now"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/backup-shares/{shareId}/decline":{"post":{"summary":"Decline a backup share offered to this space","description":"Requires an API key of this space's owner, or of a member with `backup.manage`.","tags":["Backups"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"shareId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Declined","content":{"application/json":{"schema":{"type":"object","properties":{"share":{"$ref":"#/components/schemas/BackupShare"}},"required":["share"]}}}},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"description":"The request is no longer pending"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/backup-shares/{shareId}/cancel":{"post":{"summary":"Withdraw a pending backup share offered by this space","description":"Allowed for an API key of this space's owner, of a member with `backup.manage`, or of the member who raised the request.","tags":["Backups"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"shareId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Canceled","content":{"application/json":{"schema":{"type":"object","properties":{"share":{"$ref":"#/components/schemas/BackupShare"}},"required":["share"]}}}},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"description":"The request is no longer pending"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/cubes/imports":{"post":{"summary":"Initiate a .cube archive import (browser-side multipart upload)","tags":["Imports"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","fileSizeBytes"],"properties":{"name":{"type":"string","maxLength":64},"fileSizeBytes":{"type":"integer","minimum":1048576},"sshKeyMode":{"type":"string","enum":["replace","keep"],"default":"replace","description":"What to do with SSH access on the imported rootfs. `replace` (default) writes `sshPublicKey` to the login user's authorized_keys and requires `sshPublicKey` to be set. `keep` leaves the image's own authorized_keys and sshd configuration completely untouched — nothing is written — so you must already hold a private key that the image accepts, or you will not be able to log in."},"sshPublicKey":{"type":"string","nullable":true,"description":"Public key to install when `sshKeyMode` is `replace`. Written to the login user's `~/.ssh/authorized_keys` — which user that is comes from the imported rootfs itself, so an image without a Krova default user keeps logging in as root. Ignored when `sshKeyMode` is `keep`."},"region":{"type":"string","nullable":true},"vcpusOverride":{"type":"integer","nullable":true},"ramMbOverride":{"type":"integer","nullable":true},"diskGbOverride":{"type":"integer","nullable":true},"userData":{"type":"string","nullable":true},"expectedConfig":{"type":"object","nullable":true,"properties":{"vcpus":{"type":"integer"},"ramMb":{"type":"integer"},"diskLimitGb":{"type":"integer"}}}}}}}},"responses":{"201":{"description":"Import initiated; returns presigned part URLs","content":{"application/json":{"schema":{"type":"object","properties":{"importId":{"type":"string"},"uploadId":{"type":"string"},"key":{"type":"string"},"chunkSizeBytes":{"type":"integer"},"parts":{"type":"array","items":{"type":"object","properties":{"partNumber":{"type":"integer"},"url":{"type":"string"}}}},"expiresAt":{"type":"string","format":"date-time"}}}}}},"400":{"description":"Invalid input"},"403":{"description":"Plan limit exceeded"},"503":{"description":"No active storage backend"}}}},"/spaces/{spaceId}/cubes/imports/{importId}":{"get":{"summary":"Get the current state of an import","tags":["Imports"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"importId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Current import state","content":{"application/json":{"schema":{"type":"object","properties":{"import":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["uploading","finalizing","provisioning","complete","failed","expired"]},"cubeId":{"type":"string","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"completedAt":{"type":"string","nullable":true}}}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"summary":"Cancel an in-flight upload (only allowed in 'uploading' state)","tags":["Imports"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"importId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Cancelled","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Cannot cancel an import past the 'uploading' state"}}}},"/spaces/{spaceId}/cubes/imports/{importId}/complete":{"post":{"summary":"Finalize a .cube import: complete multipart upload + create cube row + enqueue provisioning","tags":["Imports"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"importId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["parts","config"],"properties":{"parts":{"type":"array","items":{"type":"object","required":["partNumber","etag"],"properties":{"partNumber":{"type":"integer"},"etag":{"type":"string"}}}},"config":{"type":"object","required":["vcpus","ramMb","diskLimitGb","imageId"],"properties":{"vcpus":{"type":"integer"},"ramMb":{"type":"integer"},"diskLimitGb":{"type":"integer"},"imageId":{"type":"string"},"userData":{"type":"string","nullable":true}}}}}}}},"responses":{"200":{"description":"Provisioning enqueued","content":{"application/json":{"schema":{"type":"object","properties":{"importId":{"type":"string"},"cubeId":{"type":"string"},"status":{"type":"string","enum":["provisioning"]}}}}}},"400":{"description":"Invalid input"},"403":{"description":"Plan limit exceeded"},"409":{"description":"Import not in 'uploading' state"},"502":{"description":"S3 finalization failed"},"503":{"description":"Storage backend unavailable"}}}},"/spaces/{spaceId}/webhooks":{"get":{"summary":"List webhook endpoints","tags":["Webhooks"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Webhook list"}}},"post":{"summary":"Create a webhook endpoint (signing secret returned once)","tags":["Webhooks"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url","events"],"properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","enum":["cube.created","cube.running","cube.stopped","cube.error","cube.deleted","cube.cold_restarted","cube.transfer.started","cube.transfer.completed","cube.transfer.failed","cube.resize.started","cube.resize.completed","cube.resize.failed","resource.alert.memory","resource.alert.cpu","resource.alert.disk","domain.alert.error_4xx","domain.alert.error_5xx","cube.space_transferred","cube.space_transfer.requested","cube.space_transfer.accepted","cube.space_transfer.declined","cube.space_transfer.cancelled","cube.space_transfer.expired","snapshot.created","snapshot.restored","snapshot.deleted","snapshot.pinned","snapshot.promoted_to_backup","snapshot.exported","backup.created","backup.deleted","backup.redeployed","backup.share.requested","backup.share.accepted","backup.share.declined","backup.share.canceled","backup.share.expired","domain.added","domain.active","domain.removed","tcp_mapping.added","tcp_mapping.removed","tcp_mapping.updated","hosting.provisioned","hosting.suspended","hosting.unsuspended","hosting.deleted","hosting.plan_changed","hosting.renewed","hosting.cancellation_scheduled","hosting.suspended_for_non_payment","hosting.deleted_after_recovery","member.invited","member.joined","member.removed","member.role_changed"]}}}}}}},"responses":{"201":{"description":"Webhook created (response includes secret)"},"400":{"$ref":"#/components/responses/BadRequest"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/webhooks/{endpointId}":{"get":{"summary":"Get a webhook (no secret)","tags":["Webhooks"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"endpointId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Webhook"}}},"delete":{"summary":"Delete a webhook (cascades deliveries)","tags":["Webhooks"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"endpointId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/spaces/{spaceId}/webhooks/{endpointId}/deliveries":{"get":{"summary":"Last 30 days of webhook delivery history (max 100)","tags":["Webhooks"],"parameters":[{"name":"spaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"endpointId","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}],"responses":{"200":{"description":"Delivery list"}}}}},"tags":[{"name":"Public","description":"No authentication required"},{"name":"CLI Auth","description":"OAuth 2.0 Device Authorization Grant (RFC 8628) for `krova login` — no API key required"},{"name":"Spaces","description":"Resolve the space an API key is scoped to"},{"name":"Cubes","description":"Create, list, manage Cubes"},{"name":"Domains"},{"name":"TCP mappings"},{"name":"Snapshots"},{"name":"Backups","description":"Portable .cube archives — list backups, download one as a single file, and share a copy with another space"},{"name":"Imports","description":"Customer-uploaded .cube archives — browser-direct multipart upload to S3, then provisioning"},{"name":"Webhooks","description":"Outbound HTTP callbacks for Cube events"}]}