# Organization API: Customer Portal: Web address

> The 9 Organization API operations for web address.

Source: https://www.coritan.com/docs/api/reference/organizations/customer-portal/servers-web-address/

Part of [Customer Portal](/docs/api/reference/organizations/customer-portal/).

## Operations

| Method | Path | Summary |
| --- | --- | --- |
| GET | [`/api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address`](#op-get-api-v1-orgs-org-slug-portal-servers-uuid-web-address) | The server's web address and everything a page needs to manage it |
| POST | [`/api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address`](#op-post-api-v1-orgs-org-slug-portal-servers-uuid-web-address) | Turn on the server's web address: a free name with HTTPS in front of one of its ports |
| PATCH | [`/api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address`](#op-patch-api-v1-orgs-org-slug-portal-servers-uuid-web-address) | Change the port the server's web address forwards to |
| DELETE | [`/api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address`](#op-delete-api-v1-orgs-org-slug-portal-servers-uuid-web-address) | Turn off the server's web address |
| GET | [`/api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address/availability`](#op-get-api-v1-orgs-org-slug-portal-servers-uuid-web-address-availability) | Whether a name is free to take for a web address |
| POST | [`/api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address/certificate`](#op-post-api-v1-orgs-org-slug-portal-servers-uuid-web-address-certificate) | Order a certificate again for each name that has none |
| POST | [`/api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address/domains`](#op-post-api-v1-orgs-org-slug-portal-servers-uuid-web-address-domains) | Add a domain of your own to the server's web address |
| DELETE | [`/api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address/domains/{domain_id}`](#op-delete-api-v1-orgs-org-slug-portal-servers-uuid-web-address-domains-domain-id) | Remove one of your own domains from the server's web address |
| POST | [`/api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address/domains/{domain_id}/verify`](#op-post-api-v1-orgs-org-slug-portal-servers-uuid-web-address-domains-domain-id-veri) | Check a pending domain's DNS now |

### The server's web address and everything a page needs to manage it {#op-get-api-v1-orgs-org-slug-portal-servers-uuid-web-address}

`GET /api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address`

The server's web address and everything a page needs to manage it.

Answers ``{offered, web_domain, can_manage, max_domains, suggested_name, ports, web_address, domains}``.
``offered`` says whether a web address can be turned on here. ``ports`` are the server's
ports as ``{port, primary}``. ``web_address`` is null, or the free name as ``{id, name,
hostname, url, port, follows_primary, status, certificate, created_at}`` with ``status``
``active`` or ``suspended``. ``domains`` are the customer's own domains, each ``{id,
hostname, url, status, dns, certificate, created_at}``: ``status`` may also be
``pending``, and ``dns`` is ``{mode, record, error, checked_at}`` where ``mode`` is
``hosted`` (the record is written for you) or ``cname`` (``record`` is the CNAME to
publish). ``certificate.state`` is ``active``, ``pending``, ``failed`` or ``none``.

A web address the server already has is listed when ``offered`` is false. The server's
owner may read it, and so may a sub-user with ``allocation.read``. A domain that has
waited 7 days for its DNS is removed from the list.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Turn on the server's web address: a free name with HTTPS in front of one of its ports {#op-post-api-v1-orgs-org-slug-portal-servers-uuid-web-address}

`POST /api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address`

Turn on the server's web address: a free name with HTTPS in front of one of its ports.

``name`` is the part in front of the web domain. ``port`` is one of the server's ports,
and without it the address follows the primary port, whatever that becomes. Answers 201
with the state, as ``GET`` does. The certificate is ordered at once and
``certificate.state`` says when it is ready.

404 when web addresses are not offered here. 409 when the server already has one, or the
name is taken. 422 for a name that is reserved or has the wrong shape, and for a port
that is not the server's. Only the server's owner may call it (403 for a sub-user).
10 an hour for each server, then 429.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `org_slug` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | The name in front of the web domain: 3 to 28 lowercase letters, numbers and hyphens. |
| `port` | integer or null | no | One of the server's ports, as its port list shows it. Leave it out to follow the primary port. |

#### Responses

| Status | Meaning |
| --- | --- |
| `201` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Change the port the server's web address forwards to {#op-patch-api-v1-orgs-org-slug-portal-servers-uuid-web-address}

`PATCH /api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address`

Change the port the server's web address forwards to.

``port`` is one of the server's ports, or null to follow the primary port. The free name
and every one of the customer's own domains move together. Answers the state.

404 when the server has no web address. 422 for a port that is not the server's, and
for a body without ``port``. Only the server's owner may call it (403 for a sub-user).
30 in ten minutes for each server, then 429.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `org_slug` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `port` | integer or null | yes | One of the server's ports, as its port list shows it, or null to follow the primary port. |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Turn off the server's web address {#op-delete-api-v1-orgs-org-slug-portal-servers-uuid-web-address}

`DELETE /api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address`

Turn off the server's web address.

Removes the free name and every one of the customer's own domains, with their
certificates and the DNS records written for them. The names can be taken again
afterwards, by anyone. Answers 204, also when the server had none. Only the server's
owner may call it (403 for a sub-user). 10 an hour for each server, then 429.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `204` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Whether a name is free to take for a web address {#op-get-api-v1-orgs-org-slug-portal-servers-uuid-web-address-availability}

`GET /api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address/availability`

Whether a name is free to take for a web address.

Answers ``{name, hostname, available, reason}``. ``name`` is the name as it would be
stored and ``hostname`` the full address it would make. ``reason`` is a sentence when
``available`` is false: the name is taken, reserved, or not 3 to 28 lowercase letters,
numbers and hyphens. A name a server gave up stays with that server for 30 days, and
reads as taken to every other. A TCP address takes its name from the same names, so the
answer holds for one too. 404 when neither kind of address is offered here. 60 checks a minute
for each server, then 429 with ``Retry-After``.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuid` | path | string | yes |  |
| `org_slug` | path | string | yes |  |
| `name` | query | string | yes | The name to check, as typed. It is read as the part in front of the web domain: spaces, dots and underscores become hyphens, capitals become lowercase, and the answer carries the result. |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Order a certificate again for each name that has none {#op-post-api-v1-orgs-org-slug-portal-servers-uuid-web-address-certificate}

`POST /api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address/certificate`

Order a certificate again for each name that has none.

Every name of the server whose ``certificate.state`` is ``failed`` or ``none`` gets a
new order. A name whose certificate is ``active`` or ``pending`` is left alone. Answers
the state. Only the server's owner may call it (403 for a sub-user). 6 an hour for each
server, then 429.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Add a domain of your own to the server's web address {#op-post-api-v1-orgs-org-slug-portal-servers-uuid-web-address-domains}

`POST /api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address/domains`

Add a domain of your own to the server's web address.

``hostname`` is a full name such as ``www.example.com``. When the domain's DNS is hosted
here on the same account, the record is written for you and the domain is ``active`` at
once. Otherwise it is ``pending`` and ``dns.record`` is the CNAME to publish at your DNS
host. Call ``verify`` once it is published. Answers 201 with the state.

409 when the server has no web address yet, when the name is in use, and when the
domain's DNS here already has an A, AAAA or CNAME record at the name. 403 when the
server has ``max_domains`` domains. 404 when web addresses are not offered here. 422 for
a name that is not a domain name, a name under a domain that is handed out here, a name
whose DNS another account hosts here, and a domain with no name in front whose DNS is
hosted elsewhere. Only the server's owner may call it (403 for a sub-user). 12 an hour
for each server, shared with removing a domain, then 429.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `org_slug` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `hostname` | string | yes | A full name, such as www.example.com. |

#### Responses

| Status | Meaning |
| --- | --- |
| `201` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Remove one of your own domains from the server's web address {#op-delete-api-v1-orgs-org-slug-portal-servers-uuid-web-address-domains-domain-id}

`DELETE /api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address/domains/{domain_id}`

Remove one of your own domains from the server's web address.

Removes the domain, its certificate and the DNS record written for it. A record you
changed since is left as it is. The free name and the other domains stay. Answers 204.
404 for a domain that is not this server's. Only the server's owner may call it (403 for
a sub-user). 12 an hour for each server, shared with adding a domain, then 429.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `domain_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `204` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Check a pending domain's DNS now {#op-post-api-v1-orgs-org-slug-portal-servers-uuid-web-address-domains-domain-id-veri}

`POST /api/v1/orgs/{org_slug}/portal/servers/{uuid}/web-address/domains/{domain_id}/verify`

Check a pending domain's DNS now.

Looks once for the CNAME that ``dns.record`` names. When it is there the domain becomes
``active`` and its certificate is ordered. When it is not, the domain stays ``pending``
and ``dns.error`` says what was found. Answers the state either way. A domain that is
already active answers the state unchanged.

404 for a domain that is not this server's. 409 when the name went to another server
first. Only the server's owner may call it (403 for a sub-user). 12 in ten minutes for
each server, then 429.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `uuid` | path | string | yes |
| `domain_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |
