---
title: "Provision DStack app"
method: POST
path: "/api/v1/cvms/provision"
tags: ["CVMs"]
---

# Provision DStack app

`POST /api/v1/cvms/provision`

Validates Docker Compose configuration and caches it for 14 days. Returns compose_hash and KMS info for on-chain registration before creation.

## Request body

- ProvisionDstackAppRequestV2 — Request for provisioning a DStack app with automatic resource matching. Most fields are optional and will be automatically determined by the resource matching logic in preflight_dstack_app. Only compose_file and name are required.
  - `compose_file` AppComposeV2, required
    - `allowed_envs` string[]
    - `bash_script` string, nullable
    - `default_gateway_domain` string, nullable
    - `docker_compose_file` string, nullable
    - `init_script` string, nullable
    - `kms_enabled` boolean
    - `local_key_provider_enabled` boolean
    - `manifest_version` integer
    - `name` string, required
    - `no_instance_id` boolean
    - `pre_launch_script` string, nullable
    - `public_logs` boolean
    - `public_sysinfo` boolean
    - `public_tcbinfo` boolean
    - `runner` string
    - `gateway_enabled` boolean
    - `features` string[]
    - `salt` string, nullable
    - `secure_time` boolean
    - `storage_fs` union
      - 'ext4'
      - 'zfs'
    - `tproxy_enabled` boolean
  - `name` string, required — CVM name (used as hostname): 5-63 chars, must start with letter, can contain letters/numbers/hyphens
  - `instance_type` string, nullable
  - `vcpu` integer, nullable
  - `memory` integer, nullable
  - `disk_size` integer, nullable
  - `image` string, nullable
  - `prefer_dev` boolean, nullable — Prefer dev OS image (True) or non-dev OS image (False). When None, auto-selects based on image name or defaults to dev.
  - `teepod_id` integer, nullable
  - `region` string, nullable
  - `listed` boolean
  - `kms_id` string, nullable
  - `kms` 'phala' | 'ethereum' | 'base' | 'legacy'
  - `nonce` integer, nullable — Optional nonce for deterministic app_id generation. When provided, app_id must also be provided. System will verify: app_id == get_create_address(team_wallet, nonce)
  - `app_id` string, nullable — Optional app_id for manual specification. Required when nonce is provided. Only works with PHALA KMS.
  - `env_keys` string[]
  - `ports` PortMapping[], nullable
    - `protocol` string, required
    - `host_port` integer, required
    - `vm_port` integer, required
    - `host_address` string, nullable
  - `encrypted_env` string, nullable
  - `user_config` string, nullable
  - `hugepages` boolean
  - `pin_numa` boolean
  - `gpus` GpuConfig
    - `gpus` GpuSpec[], required
      - `slot` string, required
      - `product_id` string, nullable
    - `attach_mode` union
      - 'listed' | 'all'
      - string
  - `kms_urls` string[]
  - `gateway_urls` string[]
  - `experimental_vpc_server_app_id` string, nullable

## Response `200`

Provision data with compose_hash for creation

- unknown

## Other responses

- `400` — Invalid Docker Compose configuration
- `401` — Authentication required
- `422` — Validation error

---

[API](https://skmtc.net/phala/apis/phala-cloud-api.md) · [All operations](https://skmtc.net/phala/apis/phala-cloud-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/phala/phala-cloud-api/versions/83c6ae62e860/schema)
