---
title: "Domains CLI"
description: "Use the Freestyle CLI to verify domains and map them to VM ports."
url: "/docs/vms/domains-cli"
---

Use the Domains CLI for domain verification and VM domain mappings.


## Prerequisites

Set your API key:

```bash
export FREESTYLE_API_KEY="your-api-key"
```

Run commands through `npx`:

```bash
npx freestyle domains --help
```


## Verify A Domain

Create a verification request and print the TXT record details:

```bash
npx freestyle domains verify example.com
```

Complete verification by domain:

```bash
npx freestyle domains complete --domain example.com
```

Or complete verification by verification ID:

```bash
npx freestyle domains complete --verification-id <verification-id>
```

List pending verification requests:

```bash
npx freestyle domains verifications
```


## List Verified Domains

```bash
npx freestyle domains list
```

Use JSON output when scripting:

```bash
npx freestyle domains list --json
```


## Map A Domain To A VM

```bash
npx freestyle domains map app.example.com --vm-id <vm-id> --vm-port 3000
```

List mappings:

```bash
npx freestyle domains mappings
```

Filter mappings by domain:

```bash
npx freestyle domains mappings --domain app.example.com
```

Delete a mapping:

```bash
npx freestyle domains unmap app.example.com
```


## Create A VM With A Domain

The VM CLI can attach a domain while creating a VM:

```bash
npx freestyle vm create --domain app.example.com --port 3000
```

For application workflows, use the SDK so your server can verify domains, configure DNS instructions, create VMs, and map domains in one flow.
