---
title: Append Trusted Preview Hosts
description: Appends host patterns without replacing existing hosts. Returns 422 if any normalized pattern already exists or the resulting list exceeds 100 hosts. The entire request succeeds or fails together.
docs_index: /docs/llms.txt
lastUpdated: 2026-10-22
badge: "PATCH"
---

> For an index of all documentation, see [/docs/llms.txt](/docs/llms.txt).

Appends host patterns without replacing existing hosts. Returns 422 if any normalized pattern already exists or the resulting list exceeds 100 hosts. The entire request succeeds or fails together.

#### `PATCH /v2/settings/preview-hosts`

## Hostname matching

| Pattern               | Matches                                                                          |
| --------------------- | -------------------------------------------------------------------------------- |
| `preview.example.com` | Only that exact hostname.                                                        |
| `*.example.com`       | Exactly one subdomain level, such as `app.example.com`; not `a.b.example.com`.   |
| `**.example.com`      | One or more subdomain levels, including `app.example.com` and `a.b.example.com`. |

Neither wildcard includes `example.com` itself. Add the root domain as a separate pattern when needed. Wildcards must appear as `*.` or `**.` at the beginning, followed by at least two fixed hostname labels.

Use hostnames only, without a scheme, port, path, user information, query, or fragment. Patterns are normalized to lowercase, and at most 100 can be configured. See [exact hosts and wildcards](/docs/api/v2/guides/accessing-previews#exact-hosts-and-wildcards) for examples and [updating patterns](/docs/api/v2/guides/accessing-previews#update-trusted-hosts) for mutation behavior.

Adds patterns without replacing existing entries. Comparison uses exact normalized patterns: `APP.example.com` duplicates `app.example.com`, but `app.example.com` is distinct from `*.example.com`. Returns `422` for an existing pattern, repeated patterns in the request, an empty list, or a resulting list over 100 entries. The entire request fails without applying any additions.

## Usage

```typescript
import { v0 } from 'v0'

const result = await v0.settings.appendPreviewHosts({
  hosts: ['*.example.com'],
})

console.log(result)
```

```bash
curl -X PATCH "https://api.v0.dev/v2/settings/preview-hosts"   -H "Authorization: Bearer $V0_API_KEY"   -H "Content-Type: application/json"   -d '{"hosts":["*.example.com"]}'
```

## API Signature

### Request

#### Request Body

- `hosts: string[]` Distinct hostname patterns to append. Provide hostnames only, without scheme, port, path, userinfo, query, or fragment. \*.example.com matches one subdomain label; \*\*.example.com matches one or more. Neither includes the apex. Patterns are canonicalized before comparison.
  - **Minimum items:** 1
  - **Maximum items:** 100

### Response

- `hosts: string[]` Canonicalized hostname patterns trusted to embed previews. Exact hosts match only themselves; \*.example.com matches exactly one subdomain label; \*\*.example.com matches one or more subdomain labels. Wildcards do not include the apex, so list example.com separately when it should also be trusted.

---

For a semantic overview of all documentation, see [/docs/sitemap.md](/docs/sitemap.md)

For an index of all available documentation, see [/docs/llms.txt](/docs/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/docs/agents.md](/docs/agents.md)