# Create Private Domains from YAML

`POST /workspaces/:workspace/domains/private/yaml`

Create or update private domains from YAML

**Required Scopes:** `DOMAIN_MANAGE`

## URL Parameters

```typescript
interface URLParameters {
  /** The human-readable ID of the workspace */
  workspace: string; // Example: "my-company"
}
```

## Body Parameters

```typescript
interface BodyParameters {
  /** The Base64-encoded YAML definition of the domain records. The top-level key is the domain name. The apex SOA and NS records are read-only and must stay as returned by the API */
  yaml?: string;
}
```

## Response Body

```typescript
interface ResponseBody {
  /** API endpoint to GET this object */
  url?: string;
  /** Web URL to view this object in Buddy.works */
  html_url?: string;
  domains?: DomainViewIds[];
}
```

## Type Definitions

```typescript
interface DomainViewIds {
  /** API endpoint to GET this object */
  url?: string;
  /** Web URL to view this object in Buddy.works */
  html_url?: string;
  /** The name of the domain */
  name?: string;
  /** The ID of the domain */
  id?: string;
  /** The type of the domain */
  type?: "REGISTERED" | "POINTED" | "PRIVATE" | "CLAIMED";
}

```

## Request Example

```bash
curl -X POST "https://api.buddy.works/workspaces/:workspace/domains/private/yaml" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
  "yaml": "aW50ZXJuYWwubGFuOgogIHJlY29yZHM6CiAgICAnQCc6CiAgICAtIHR5cGU6IFNPQQogICAgICB2YWx1ZXM6IG5zMS5idWRkeS53b3JrcyBob3N0bWFzdGVyLmJ1ZGR5LndvcmtzIDEgMTA4MDAgMzYwMCA2MDQ4MDAgMzYwMAogICAgLSB0eXBlOiBOUwogICAgICB2YWx1ZXM6IG5zMS5idWRkeS53b3JrcwogICAgLSB0eXBlOiBBCiAgICAgIHZhbHVlczogMTAuMC4wLjEwCiAgICBhcGk6CiAgICAtIHR5cGU6IEEKICAgICAgdmFsdWVzOiAxMC4wLjAuMjAKc3RhZ2luZy5sYW46CiAgcmVjb3JkczoKICAgIGRiOgogICAgLSB0eXBlOiBBCiAgICAgIHZhbHVlczogMTAuMC4xLjUKICAgIGNhY2hlOgogICAgLSB0eXBlOiBDTkFNRQogICAgICB2YWx1ZXM6IGRiLnN0YWdpbmcubGFuLgo="
}'
```

## Response Example

**Status:** `200 Private domains created or updated from YAML, in document order`

```json
{
  "url": "https://api.buddy.works/workspaces/my-company/domains",
  "html_url": "https://app.buddy.works/my-company/-/domains",
  "domains": [
    {
      "url": "https://api.buddy.works/workspaces/my-company/domains/jBQ19Qya",
      "html_url": "https://app.buddy.works/my-company/-/domain/jBQ19Qya",
      "id": "jBQ19Qya",
      "name": "internal.lan",
      "type": "PRIVATE"
    },
    {
      "url": "https://api.buddy.works/workspaces/my-company/domains/z2Qb9p03",
      "html_url": "https://app.buddy.works/my-company/-/domain/z2Qb9p03",
      "id": "z2Qb9p03",
      "name": "staging.lan",
      "type": "PRIVATE"
    }
  ]
}
```

---
Original source: https://buddy.works/docs/api/domains/create-private-from-yaml