# Domains

Source: https://www.pontive.com/docs/api-reference/platform/domains

Base URL: `https://api.pontive.com/v1` (operations that name another server say so).

## List domains

```http
GET https://api.pontive.com/v1/domains
```

Get a list of domains for an instance

Operation ID: `ListDomains`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `instance_id` | string | yes | Instance ID |
| `page` | integer |  | Page number |
| `limit` | integer |  | Page size (default 25, at most 100) |
| `sort` | string |  | Sort order |
| `search` | string |  | Search |
| `type` | "auth_server" |  | Type |

### Responses

- `200` OK: ListDomainsResponse
- `400` Bad Request: ErrResponse
- `500` Internal Server Error: ErrResponse

## Create domain

```http
POST https://api.pontive.com/v1/domains
```

Register a hostname against an instance. The domain starts pending and carries the DNS challenge that must be published before it can be activated.

Operation ID: `CreateDomain`

### Request body (`application/json`, required): CreateDomainRequest

Domain to create

### Responses

- `201` Created: CreateDomainResponse
- `400` Bad Request: ErrResponse
- `409` Conflict: ErrResponse
- `500` Internal Server Error: ErrResponse

## Delete domain

```http
DELETE https://api.pontive.com/v1/domains/{domain_id}
```

Remove a domain. Refused while any app or service account is still bound to it.

Operation ID: `DeleteDomain`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `domain_id` | string | yes | Domain ID |

### Responses

- `204` No Content
- `400` Bad Request: ErrResponse
- `404` Not Found: ErrResponse
- `500` Internal Server Error: ErrResponse

## Verify domain

```http
POST https://api.pontive.com/v1/domains/{domain_id}/verify
```

Check the DNS TXT challenge for a domain and record the outcome. Does not activate the domain; activation is a separate call and is refused until verification has succeeded.

Operation ID: `VerifyDomain`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `domain_id` | string | yes | Domain ID |

### Responses

- `200` OK: VerifyDomainResponse
- `400` Bad Request: ErrResponse
- `404` Not Found: ErrResponse
- `500` Internal Server Error: ErrResponse

## Schemas

### ListDomainsResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | Domain[] |  | The list of domains |
| `object` | string |  | The object type |
| `pagination` | Pagination |  | The pagination information |

### ErrResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | ErrBody |  |  |

### CreateDomainRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `domain` | string | yes | The hostname, e.g. auth.acme.com |
| `instance_id` | string | yes | The ID of the instance to add the domain to |

### CreateDomainResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `domain` | Domain |  | The created domain. It starts pending, carrying the challenge that must be published before it can be activated. |
| `object` | string |  | The object type |

### VerifyDomainResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `domain` | Domain |  | The created domain. It starts pending, carrying the challenge that must be published before it can be activated. |
| `object` | string |  | The object type |

### Domain

The created domain. It starts pending, carrying the challenge that must be
published before it can be activated.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `created_at` | string (date-time) |  | The time when the domain was created |
| `domain` | string |  | The name of the domain |
| `id` | string |  | The ID of the domain |
| `instance_id` | string |  | The ID of the instance the domain is associated with |
| `ssl` | DomainSSL |  | The SSL information for the domain |
| `status` | string |  | The status of the domain |
| `type` | "auth_server" |  | The type of the domain. Always "auth_server". |
| `updated_at` | string (date-time) |  | The time when the domain was last updated |
| `usage` | DomainUsage |  | The usage information for the domain |
| `verification` | DomainVerification |  | The verification information for the domain |

### Pagination

The pagination information

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | integer |  | The number of items per page |
| `page` | integer |  | The page number |
| `total` | integer |  | The total number of items |
| `total_pages` | integer |  | The number of pages |

### ErrBody

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string |  | Code is a stable machine-readable identifier for this error: the domain code where one exists (e.g. slug_conflict, instance_not_found, confirmation_required), else the spec's generic code (invalid_request, permission_denied, not_found, conflict, internal_error). |
| `doc_url` | string |  | DocURL links to documentation about this error, when available. |
| `message` | string |  | Message is a human-readable description of what went wrong. |
| `object` | string |  | Object is the discriminator; always "error". |
| `param` | string |  | Param names the request parameter this error refers to, when applicable. |
| `type` | string |  | Type is the error's category, from its HTTP status: validation_error, authentication_error, authorization_error, not_found, conflict_error, rate_limit_error or internal_error. |

### DomainSSL

The SSL information for the domain

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `auto_renew` | boolean |  | Whether the SSL certificate is auto-renewed |
| `expires_at` | string (date-time) |  | The time when the SSL certificate expires; null before it is issued |
| `issued_at` | string (date-time) |  | The time when the SSL certificate was issued; null before it is |
| `issuer` | string |  | The issuer of the SSL certificate |

### DomainUsage

The usage information for the domain

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `apps_count` | integer |  | The number of apps using the domain |
| `service_accounts_count` | integer |  | The number of service accounts using the domain |

### DomainVerification

The verification information for the domain

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `challenge` | string |  | The value that must appear as a TXT record at Target. Without this the customer can see which record to create but not what to put in it, so it is required for the verification flow to be completable at all. |
| `last_check_at` | string (date-time) |  | The time when the domain was last checked; null before the first check |
| `last_check_error` | string |  | The error message from the last check |
| `method` | string |  | The method used to verify the domain: "dns_txt" for a customer hostname, "platform" for one the platform itself owns |
| `target` | string |  | The DNS record name the proof is published at, e.g. _pontive-challenge.auth.acme.com |
| `verified_at` | string (date-time) |  | The time when the domain was verified; null until it is |
