# Create Service DNS Record

Source: https://coolify.io/docs/api/endpoints/dns/create-service-dns-record

## POST /services/{uuid}/dns

Create Service DNS Record

Create a DNS record at Cloudflare that points a domain of the service to its server. An existing record with the same address is adopted.

**Authentication:** Bearer token (`bearerAuth`)

### Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| uuid | path | yes | string | Service UUID. |

### Request body

`application/json`, required.

Schema `CreateDnsRecordRequest`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| hostname | string | yes | A saved domain of the resource. |
| integration_token_uuid | string | no | Cloudflare token to use. Required when several tokens manage the zone of the hostname. |
| address | string | no | A public address of the server. Default: default_address of the DNS status. |

### Responses

#### 201

DNS record created.

`application/json`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| record | ManagedDnsRecord | no |  |

Schema `ManagedDnsRecord`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| uuid | string | no |  |
| hostname | string | no |  |
| type | string enum "A", "AAAA" | no |  |
| address | string | no | Server IP address that the record points to. |
| owned | boolean | no | Coolify created the record, so it can delete it. |
| integration_token_uuid | string | no |  |

#### 400

Cloudflare rejected the change.

#### 401

Unauthenticated.

`application/json`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | no |  |

#### 403

No write access to the service.

#### 404

Resource not found.

`application/json`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | no |  |

#### 409

Another record uses the hostname. Replace it with the replace endpoint.

`application/json`: DnsRecordConflict

Schema `DnsRecordConflict`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | no |  |
| conflict | object | no |  |

Fields of `conflict`:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| record_id | string | no |  |
| current | string | no |  |
| proposed | string | no |  |

#### 422

Validation error.

`application/json`: object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| message | string | no |  |
| errors | object | no |  |

#### 423

Another DNS change for the hostname is in progress. Try again.
