# Domains

A web app gets its address in two ways: a name on astris.live, or a hostname you own. Workers and cron apps serve no website, so they have no address.

## An address on astris.live

```
astris domains --app <id>
```

The command gives the app the address `<slug>.astris.live`, with HTTPS. `--slug <slug>` chooses the slug. Without it, Astris uses the app's slug.

A slug is 1 to 63 characters: lowercase letters, digits and hyphens, with no hyphen at the start or the end.

## A hostname you own

Give the app its astris.live address first. Then run:

```
astris domains --app <id> --hostname <host>
```

The command prints the hostname, its status, the CNAME record to set (name, then target) and the TXT record to set (name, then value). Set both records at your DNS provider:

| Record | Name | Value |
| --- | --- | --- |
| CNAME | your hostname | the app's astris.live address |
| TXT | `_astris-verify.<hostname>` | `astris-verify=<token>` |

The hostname starts as `pending` and routes nothing until a check reports it `active`.

## Verify

```
astris domains verify --app <id> --id <domainId>
```

Astris checks the DNS records and prints the status. When the check fails, the reason is on the next line: `no_record`, `wrong_target`, `txt_missing`, `proxied_or_wrong_address` or `dns_error`. Fix the record, then verify again.

## Read and remove

```
astris domains status --app <id> --id <domainId>
astris domains remove --app <id> --id <domainId> --yes
```

`status` prints the hostname, the status and the certificate word: `issued`, `pending`, `failed` or `not_applicable`. `remove` prints `Domain removed.`

## Limits

An app can have 10 hostnames. Over that, the API refuses with [conflict](/docs/errors/conflict) and the reason `hostname_limit`.
