X-Phala-Version header, and the server returns a response structure matching that version. The SDK provides compile-time type safety — TypeScript automatically infers the correct response types based on the version you select.
Supported Versions
| Version | Status | Description |
|---|---|---|
2026-01-21 | Default (current) | Three-layer user response, restructured CVM info, workspace-aware |
2025-10-28 | Legacy | Flat user response, legacy CVM structure |
Selecting a Version
At Client Creation
Switching Versions at Runtime
Use.withVersion() to create a new client with a different API version without re-authenticating:
How It Works
When you create a client with a version, the SDK:- Sends the
X-Phala-Versionheader with every request - Validates responses against the version-specific Zod schema
- Returns TypeScript types matching the selected version
Version-Specific Response Types
The SDK uses conditional types to map API versions to response types:| Endpoint | 2026-01-21 | 2025-10-28 |
|---|---|---|
| Get current user | CurrentUserV20260121 | CurrentUserV20251028 |
| List CVMs | PaginatedCvmInfosV20260121 | PaginatedCvmInfosV20251028 |
| Get CVM info | CvmInfoDetailV20260121 | CvmDetailV20251028 |
| List apps | DstackAppListResponseV20260121 | DstackAppListResponseV20251028 |
| Get app info | DstackAppWithCvmResponseV20260121 | DstackAppWithCvmResponseV20251028 |
| Get app CVMs | CvmInfoV20260121[] | CvmInfoV20251028[] |
Using with Standalone Functions
Version-aware typing also works with standalone action functions:Key Differences Between Versions
User Response
2026-01-21 — Three-layer structure:
2025-10-28 — Flat structure:
CVM Info
2026-01-21 — Nested resource objects, workspace-aware:
2025-10-28 — Flat fields, legacy naming:
Migration Guide
To migrate from2025-10-28 to 2026-01-21:
-
Update client creation (or omit
versionto use the default): -
Update user response access:
-
Update CVM info access:
Related
- SDK Overview — getting started with the SDK
- Schema Reference — full schema definitions per version

