> ## Documentation Index
> Fetch the complete documentation index at: https://docs.phala.com/llms.txt
> Use this file to discover all available pages before exploring further.

# api

> Make an authenticated HTTP request to Phala Cloud API.

<Note>
  This command is marked as unstable and may change in future releases.
</Note>

### Command: `phala api`

#### Syntax

```
phala api [options] <endpoint>
```

#### Description

Make an authenticated HTTP request to Phala Cloud API.

#### Arguments

| Argument     | Description       |
| ------------ | ----------------- |
| `<endpoint>` | API endpoint path |

#### Options

| Option                 | Description                                                               |
| ---------------------- | ------------------------------------------------------------------------- |
| `-X, --method <value>` | HTTP method (default: GET)                                                |
| `-f, --query <value>`  | Query parameter: key=value (use key=@file to read from file)              |
| `-F, --field <value>`  | Body field: key=value (string) or key:=value (typed JSON). Supports @file |
| `-H, --header <value>` | HTTP header: key:value                                                    |
| `-d, --data <value>`   | Request body data (cURL-style)                                            |
| `--input <value>`      | Read body from file (use "-" for stdin)                                   |
| `-i, --include`        | Print response headers                                                    |
| `-q, --jq <value>`     | Filter output with jq expression                                          |
| `--silent`             | Don't print response body                                                 |

#### Global Options

| Option                               | Description                                           |
| ------------------------------------ | ----------------------------------------------------- |
| `-h, --help`                         | Show help information for the current command         |
| `-v, --version`                      | Show CLI version                                      |
| `--api-token TOKEN, --api-key TOKEN` | API token for authenticating with Phala Cloud         |
| `-j, --json, --no-json`              | Output in JSON format                                 |
| `--interactive`                      | Enable interactive mode for commands that support it  |
| `--cvm-id <value>`                   | CVM identifier (UUID, app\_id, instance\_id, or name) |
| `--api-version <value>`              | API version to use (e.g. 2025-10-28, 2026-01-21)      |

#### Examples

* List CVMs

```bash theme={"system"}
phala api /cvms
```

* Get CVM by app ID

```bash theme={"system"}
phala api /cvms/app_xxx
```

* Filter with jq

```bash theme={"system"}
phala api /cvms -q '.items[].name'
```

* GET with query params

```bash theme={"system"}
phala api /endpoint -f status=active -f page=2
```

* POST with body fields

```bash theme={"system"}
phala api /endpoint -X POST -F name=foo -F count:=10
```

* POST with cURL-style -d

```bash theme={"system"}
phala api /endpoint -X POST -d '{"foo":"bar"}'
```

* POST from file

```bash theme={"system"}
phala api /endpoint -X POST --input data.json
```

* Query params + body combined

```bash theme={"system"}
phala api /endpoint -X POST -f page=1 -F name=foo
```

* Body field from file

```bash theme={"system"}
phala api /endpoint -X POST -F config:=@settings.json
```

* Show response headers

```bash theme={"system"}
phala api /cvms -i
```
