# Edit Domain Records using YAML

`PATCH /workspaces/:workspace/domains/:domain_id/yaml`

Update domain records from YAML

**Required Scopes:** `DOMAIN_WRITE`

## URL Parameters

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

## 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 {
  /** The type of the domain */
  type?: "REGISTERED" | "POINTED" | "PRIVATE" | "CLAIMED";
  /** 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;
  pointed_via?: string[];
  /** Whether the domain is set to auto-renew */
  auto_renew?: boolean;
  /** Whether the domain has transfer lock enabled */
  transfer_lock?: boolean;
  /** Whether DNSSEC is enabled for the domain */
  dnssec?: boolean;
  /** The expiration date of the domain registration */
  expiry_date?: string;
}
```

## Request Example

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

## Response Example

**Status:** `200 Domain records updated from YAML`

```json
{
  "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"
}
```

---
Original source: https://buddy.works/docs/api/domains/edit-yaml