# Domains and certificates

Source: https://openpanel.sh/docs/domains

The opnl.app address every public service gets, more names under opnl.app, your own domains, HTTPS, and how to list, add and remove them.

A public service's HTTP ports are reached at domains. Every public service with an HTTP port gets an opnl.app address at once, and you can add more names under opnl.app or your own domains. Each domain belongs to one service and reaches one of its HTTP ports.

Domains are on the console's **Domains** page, and in the [CLI](/docs/cli), the [API](/docs/api) and [MCP](/docs/ai).

## Kinds of domains [#kinds-of-domains]

| Kind | Example | Works | See |
|---|---|---|---|
| **The service's own opnl.app address** | `web-shop-k3x9.opnl.app` | At once, made with the service | [opnl.app addresses](/docs/domains/opnl-app) |
| **Another name under opnl.app** | `shop.opnl.app` | At once, if the name is free | [opnl.app addresses](/docs/domains/opnl-app) |
| **Your own domain** | `app.example.com` | Added and verified by its TXT record today; served with your uploaded certificate or behind Cloudflare once own domains are switched on | [Your own domain](/docs/domains/own-domain) |

Every opnl.app address is served with HTTPS. Your own domain gets its HTTPS from a certificate you upload or from Cloudflare's proxy. See [Certificates](/docs/domains/certificates).

## Before you start [#before-you-start]

The service must be **public** and have at least one **HTTP port**. For example, to make a service named `web` in the project `shop` public on port 3000:

```sh
openpanel services update web --project shop --public --port http:3000
```

The change takes effect at the service's next deploy, but its opnl.app address is made at once. See [Service settings](/docs/projects/settings).

## List a project's domains [#list-a-projects-domains]

<Tabs items={["CLI","API"]}>
<Tab value="CLI">
```sh
openpanel domains --project shop
```

```text
HOST                    SERVICE  KIND    VERIFIED         ID
app.example.com         web      custom  waiting for DNS  01a2332a-dd24-7000-b87b-8cd049c2b73c
web-shop-k3x9.opnl.app  web      opnl    yes              01a2332a-b0a8-7000-bcce-bc3249664255
```
</Tab>

<Tab value="API">
```sh
curl https://openpanel.sh/api/v1/projects/$PROJECT_ID/domains \
  -H "Authorization: Bearer $OPENPANEL_TOKEN"
```

Each domain in `data` has its `host`, `kind` (`opnl` or `custom`), the `port` it reaches, `verifiedAt`, and for your own domain the DNS `records` to add.
</Tab>
</Tabs>

## Add a domain [#add-a-domain]

<Tabs items={["CLI","API"]}>
<Tab value="CLI">
```sh
openpanel domains add shop.opnl.app --project shop --service web
```

For a service with several HTTP ports, choose the one the domain reaches with `--port 8080`. Without it, the domain reaches the service's lowest-numbered HTTP port.
</Tab>

<Tab value="API">
```sh
curl -X POST https://openpanel.sh/api/v1/services/$SERVICE_ID/domains \
  -H "Authorization: Bearer $OPENPANEL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"host": "shop.opnl.app"}'
```

Add `"port": 8080` to choose the HTTP port. The answer is the new domain.
</Tab>
</Tabs>

A name ending in `.opnl.app` becomes an opnl.app address; any other name is your own domain.

## Remove a domain [#remove-a-domain]

<Tabs items={["CLI","API"]}>
<Tab value="CLI">
```sh
openpanel domains remove shop.opnl.app --project shop --yes
```
</Tab>

<Tab value="API">
```sh
curl -X DELETE https://openpanel.sh/api/v1/domains/$DOMAIN_ID \
  -H "Authorization: Bearer $OPENPANEL_TOKEN"
```
</Tab>
</Tabs>

The name stops working at once and is free for anyone to take.

## Who can change domains [#who-can-change-domains]

Adding and removing domains needs **deploy** access to the project; anyone who can see the project sees its domains. See [Roles](/docs/members/roles) and [Per-project access](/docs/members/per-project-access).

## What can go wrong [#what-can-go-wrong]

| Message | What it means |
|---|---|
| "Make the service public before giving it a domain." | The service's address is private or none. |
| "Add an HTTP port to the service first." | The service has only TCP or UDP ports, or none. |
| "Port … is not one of the service's HTTP ports." | `--port` names a port the service does not have as HTTP. |
| "… is already in use." | Another service, in any organization, has this name; for your own domain, another organization proved it first. |
| "… is reserved. Choose another name." | The name is kept back under opnl.app. See [Naming rules](/docs/domains/opnl-app#naming-rules). |
| "Enter a domain name such as app.example.com." | The name is not a valid domain name. |

<Cards>
<Card href="/docs/domains/opnl-app" title="opnl.app addresses" description="The address each public service gets, and the naming rules." />

<Card href="/docs/domains/own-domain" title="Your own domain" description="The DNS records, and what works today." />

<Card href="/docs/domains/cloudflare" title="Domains on Cloudflare" description="Records written, checked and removed by OpenPanel." />

<Card href="/docs/domains/certificates" title="Certificates" description="HTTPS for opnl.app, and an uploaded certificate for your own domain." />

<Card href="/docs/api/domains/add-a-domain-to-a-service" title="API: add a domain" description="The operation in the API reference." />
</Cards>