## Get the domain

`GET /v1/infra/servers/:id/domain`

Returns the domain attached to the server. Use the call both to re-read the DNS records and to wait for the certificate after verification.

Who can make the call — [Access](/docs/infra/domain#access). The purpose of the records and the difference between `host` and `name` — [DNS records](/docs/infra/domain#dns-records).

## Parameters

| Parameter | In | Type | Required | Description |
|----------|---|-----|:-----:|----------|
| `id` | path | string (UUID) | yes | Server ID. Source — the `id` field from the [server list](/docs/infra/servers/list) |

## Examples

### curl — personal key

```bash
curl -H "X-Api-Key: YOUR_API_KEY" \
  https://vibecode.bitrix24.com/v1/infra/servers/SERVER_ID/domain
```

### curl — OAuth application

```bash
curl -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  https://vibecode.bitrix24.com/v1/infra/servers/SERVER_ID/domain
```

### JavaScript — personal key

```javascript
const res = await fetch(
  `https://vibecode.bitrix24.com/v1/infra/servers/${serverId}/domain`,
  { headers: { 'X-Api-Key': 'YOUR_API_KEY' } }
)
const body = await res.json()
if (res.status === 404 && body.error.code === 'NO_DOMAIN') {
  console.log('No domain is attached to the server')
} else {
  const { domain } = body.data
  console.log(`${domain.fqdn}: ${domain.status}, certificate: ${domain.certIssued}`)
}
```

### JavaScript — OAuth application

```javascript
const res = await fetch(
  `https://vibecode.bitrix24.com/v1/infra/servers/${serverId}/domain`,
  {
    headers: {
      'X-Api-Key': 'YOUR_APP_KEY',
      'Authorization': 'Bearer USER_SESSION_TOKEN',
    },
  }
)
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | Always `true` on success |
| `data.domain.id` | string (UUID) | Domain attachment ID |
| `data.domain.fqdn` | string | The attached name in lowercase |
| `data.domain.isApex` | boolean | `true` — the zone's apex domain, `false` — a subdomain |
| `data.domain.status` | string | Domain status. Values — [Domain statuses](/docs/infra/domain#domain-statuses) |
| `data.domain.source` | string | Domain origin. `"BYO"` — the domain is yours and you connected it |
| `data.domain.dnsMode` | string | Who manages the DNS records. `"USER_DNS"` — you, at your DNS provider |
| `data.domain.verifiedAt` | string (ISO 8601) \| null | Time of the successful verification after which the domain became `ACTIVE`. `null` until a verification succeeds |
| `data.domain.lastVerifiedAt` | string (ISO 8601) \| null | Time of the last record verification, including a failed one. `null` until a verification has been run |
| `data.domain.createdAt` | string (ISO 8601) | Time of attachment |
| `data.domain.certIssued` | boolean | Whether the certificate for `https` has been issued. Always `false` outside the `ACTIVE` status |
| `data.instructions` | array | The domain's DNS records — the same ones the attach call returned. An empty array if the Bitrix24 account's region no longer supports custom domains |
| `data.instructions[].type` | string | Record type: `"TXT"`, `"CNAME"` or `"A"` |
| `data.instructions[].host` | string | Full record name |
| `data.instructions[].zone` | string | The zone the record is created in |
| `data.instructions[].name` | string | Record name relative to `zone` — enter it in the "name" field of the DNS provider's panel. For the zone itself — `"@"` |
| `data.instructions[].value` | string | Record value |

## Response example

The domain has passed verification; the certificate has not been issued yet:

```json
{
  "success": true,
  "data": {
    "domain": {
      "id": "bea9db66-411b-432e-a365-283a74f5714f",
      "fqdn": "app.example.com",
      "isApex": false,
      "status": "ACTIVE",
      "source": "BYO",
      "dnsMode": "USER_DNS",
      "verifiedAt": "2026-10-05T12:53:02.655Z",
      "lastVerifiedAt": "2026-10-05T12:53:02.653Z",
      "createdAt": "2026-10-05T12:53:02.616Z",
      "certIssued": false
    },
    "instructions": [
      {
        "type": "TXT",
        "host": "_vibecode-challenge.app.example.com",
        "zone": "example.com",
        "name": "_vibecode-challenge.app",
        "value": "vibe-verify=f36ac31f213d1e3630c75f000b6631f5"
      },
      {
        "type": "CNAME",
        "host": "app.example.com",
        "zone": "example.com",
        "name": "app",
        "value": "lb.bitrix24.site"
      }
    ]
  }
}
```

## Error response example

404 — the server is found, but no domain is attached to it:

```json
{
  "success": false,
  "error": {
    "code": "NO_DOMAIN",
    "message": "No domain attached"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 404 | `NO_DOMAIN` | The calling key manages the server, but no domain is attached to the server |
| 404 | `SERVER_NOT_FOUND` | No server with this `id` exists, or it is managed by a key other than the one making the call |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 401 | `INVALID_API_KEY` | The key is not recognized: no such string exists on the platform |
| 429 | `RATE_LIMITED` | Exceeded the limit of 60 requests per minute on this endpoint. The exact value arrives in the `x-ratelimit-limit` header (the cap is divided across replicas) |
| 503 | `user_self_deletion_pending` | The key owner requested deletion of their account on the portal. Access is restored once the deletion is cancelled |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

- **The read itself checks the certificate.** While the domain is in the `ACTIVE` status and `certIssued` is `false`, every call opens a probe TLS connection to the domain name and therefore responds up to 4 seconds slower. Once the certificate is found, `certIssued` becomes `true`, and subsequent reads run without this delay.
- **The certificate is awaited again after recovery.** A domain that returns to `ACTIVE` through a repeated [verification](./verify.md) from the `FAILED` or `SUSPENDED` status does not get `certIssued: true` immediately: the previous flag is reset, and the read waits for the certificate once more.
- **The records are needed after activation too.** The platform periodically re-checks both records of an active domain, so do not delete them at the DNS provider after the domain moves to `ACTIVE`.

## See also

- [Attach a domain](./attach.md)
- [Verify the domain](./verify.md)
- [Detach a domain](./detach.md)
- [Custom domain](/docs/infra/domain)
- [List servers](/docs/infra/servers/list)
