Skip to main content
The @phala/cloud SDK uses Zod schemas for runtime validation of all API responses. API version 2026-06-23 is the default. Its CVM and app endpoints use the V20260522 schemas, while its KMS endpoints use the contract-centric schemas documented on the KMS page.

Schema Validation

By default, every action validates the API response against the version-specific Zod schema. You can customize this:

Version 2026-01-21

CurrentUserV20260121

Three-layer user response with separate user, workspace, and credits objects.

CvmInfoV20260121

Compact CVM info returned in list endpoints.

CvmInfoDetailV20260121

Extended CVM info returned by single-CVM endpoints. The logs object contains the log URLs described below.

CvmLogUrlsV20260121

The serial, stdout, and stderr fields are complete presigned URLs for the corresponding CVM logs. Phala Cloud signs them for the requesting user. Each signature is valid for 5 minutes and is checked only when the connection opens. A stream lasts at most 1 hour. If a request returns 401 (ERR-17-002 or ERR-17-003), fetch fresh URLs with a CVM detail request and retry. Do not modify the signature parameters. See Fetch Logs over HTTP for query parameters, reconnect behavior, and errors.
A container log URL is {container_log_base}/{container_name}?{auth_query}. All log fields are null when the requester cannot read logs. The container fields are also null when public_logs is false (container requests are rejected with ERR-17-006) or the CVM has no vm_uuid. Node logs are not affected by public_logs. Clients should accept auth_query being omitted or null. In the legacy 2025-10-28 response, syslog_endpoint is a complete presigned serial log URL, not a URL base.

PaginatedCvmInfosV20260121

Paginated list of CVMs.

Nested Objects

CvmResourceInfoV20260121

CvmOsInfoV20260121

CvmKmsInfoV20260121

CvmProgressInfoV20260121

CvmGatewayInfoV20260121

NodeRef

WorkspaceRef

UserRef

Version 2025-10-28 (Legacy)

CurrentUserV20251028

Flat user response.

KmsInfoLegacy

Legacy KMS information. Used in CvmInfoV20251028 and CvmDetailV20251028.

CvmInfoV20251028

Legacy CVM info with nested hosted VM object.

CvmDetailV20251028

Legacy CVM detail for single-CVM endpoints.

PaginatedCvmInfosV20251028

Importing Schemas

All Zod schemas are exported from @phala/cloud:
Use them for custom validation or to build derivative schemas: