# Domain

> Your platform's addresses and how to use your own domain: the CNAME record, activation, the certificate and the statuses.

Every account has a Cademí address. It can also have its own domain, such as courses.yourbrand.com, so students come in under your brand. In **Settings > Domain** you see the account's addresses, register your own domain and activate the certificate.

## The idea in one minute

Three pieces make your own domain work:

- The **main address** is the address the platform takes the student to.
- The **CNAME record** is what you create at your DNS provider. It points your domain to Cademí.
- The **certificate** is the browser padlock (https). Cademí requests the certificate after it checks the CNAME.

**The most important rule:** your own domain only becomes the main address when its status is **Active**. Until then, students stay on the Cademí address.

## The platform addresses

The **Platform addresses** section shows the three addresses the platform opens on:

| Address | What it is |
|---|---|
| **Platform key** | The standard address, created on its own when the platform is created. It always works |
| **Subdomain** | A shorter address on Cademí, optional. Contact support to set or change it |
| **Custom Domain** | Your domain, once registered, with its current status beside it |

The Cademí addresses always work. Whoever comes in through them is taken to the main address. The main one is the highest priority among those that exist, in this order: **Custom Domain** (only while it is **Active**), then **Subdomain**, then **Platform key**.

The flow below shows which address is the main one and what happens to whoever comes in through another:

```mermaid
flowchart TD
    accTitle: Which address is the main one
    accDescr: When a student opens a platform address, the main one is the Custom Domain if it is Active; otherwise the Subdomain, if there is one; otherwise the Platform key. Whoever came in through the main address sees the platform right away; whoever came in through another address is redirected to the main one.
    acesso["Student opens a platform address"]
    custom{"Custom Domain Active?"}
    sub{"Has a Subdomain?"}
    pc["Main: Custom Domain"]
    ps["Main: Subdomain"]
    pk["Main: Platform key"]
    mesmo{"Came in through the main one?"}
    redir["Redirect to the main one"]
    abre["Platform opens"]
    acesso --> custom
    custom -->|Yes| pc
    custom -->|No| sub
    sub -->|Yes| ps
    sub -->|No| pk
    pc --> mesmo
    ps --> mesmo
    pk --> mesmo
    mesmo -->|Yes| abre
    mesmo -->|No| redir
    redir --> abre
    classDef destaque stroke:#ff005c,stroke-width:2px
    class redir destaque
```

No address stops working: what changes is where the student is taken. A registered domain that has not reached **Active** yet is not the main one.

Your own domain must be a subdomain, such as courses.yourbrand.com or members.yourbrand.com. A root domain (yourbrand.com) is not accepted. Each domain can be in only one account.

## The domain statuses

| Status | What it means |
|---|---|
| **Inactive** | No custom domain registered |
| **Processing** | The domain was saved and awaits activation, or the certificate is being issued |
| **Invalid** | The CNAME record was not found in the DNS |
| **Invalid pointing** | The record exists but does not point to core.cademi.com.br |
| **Verified** | The record is right; the certificate still has to be requested |
| **Active** | Domain working, with a certificate |

From registration to **Active**, the domain goes through these statuses:

```mermaid
stateDiagram-v2
    accTitle: The custom domain statuses
    accDescr: With no domain, the status is Inactive. Saving the domain puts it in Processing, in the queue. Activate now checks the CNAME: with no record, the status is Invalid; with the record pointing elsewhere, Invalid pointing; with the right record, Verified. From either error and from Verified, Activate now checks again. From Verified, the certificate is requested and the status is Processing, with the certificate being issued. With the certificate ready, the status is Active.
    state "Inactive" as Inativo
    state "Processing (queued)" as Fila
    state checa <<choice>>
    state "Invalid" as Invalido
    state "Invalid pointing" as Apontamento
    state "Verified" as Verificado
    state "Processing (certificate)" as Emitindo
    state "Active" as Ativo
    [*] --> Inativo
    Inativo --> Fila: Save now
    Fila --> checa: Activate now
    Invalido --> checa: Activate now
    Apontamento --> checa: Activate now
    checa --> Invalido: CNAME not found
    checa --> Apontamento: Points elsewhere
    checa --> Verificado: CNAME right
    Verificado --> Emitindo: Certificate requested
    Verificado --> checa: Activate now
    Emitindo --> Ativo: Certificate ready
```

Both **Processing** statuses look the same on screen. In the first, the button is **Activate now**. In the second, it is **Verify certificate**. If the certificate comes out ready on activation, the domain goes straight to **Active**. **Redefine Domain** goes back to **Inactive** from any status.

## Step by step

### Register the domain

1. In the dashboard, open **Settings > Domain**.
2. In **Custom Domain**, type the subdomain students will use. For example: courses.yourbrand.com.
3. Click **Save now**.

The status becomes **Processing**. The screen shows the **Activate now** button.

### Create the record at your DNS provider

The DNS provider is where your domain was registered or is hosted.

1. Open your DNS provider's panel.
2. Create the record the **DNS setup** section shows: **Type** CNAME, name equal to the subdomain (courses) and **Points to** core.cademi.com.br.
3. To get the target right, use the screen's copy button.
4. Wait for DNS propagation.

Propagation depends on your provider. It can take minutes to hours.

**Heads up: this is where most mistakes happen.** Marcos uses Cloudflare and creates the CNAME with the orange cloud (proxy) on. The check does not find the CNAME, and the status ends up as **Invalid pointing**. To avoid this, turn off your provider's proxy or CDN on that record. The check looks for a plain CNAME record pointing to core.cademi.com.br.

### Activate the domain

1. Go back to the dashboard and click **Activate now**.
2. Confirm with **Continue**.

The platform checks the CNAME and requests the SSL certificate. If the record is right, the message is "CNAME verified! The SSL certificate is being issued and will be activated shortly." The status stays **Processing**.

### Check the certificate

While the certificate is being issued, the screen shows the **Verify certificate** button.

1. Click **Verify certificate**.

When the certificate is ready, the status becomes **Active** and the message is "Domain activated successfully!". If the certificate comes out ready on activation, the status goes straight to **Active**.

### If the check fails

The message says why, and the status shows the diagnosis:

- **Invalid**: the record was not found. The DNS has not propagated yet, or the record was created under another name.
- **Invalid pointing**: the record points somewhere else.

Fix it at the provider, wait for propagation and click **Activate now** again.

## What changes with the domain active

- The emails Cademí sends to students use your domain: the access link and the one-click sign-in button.
- Whoever comes in through the Cademí addresses is taken to your domain. Old links keep working.
- The deliveries' **Postback URL** stays on the Cademí address ([Deliveries](https://help.cademi.cloud/en/vendas/entregas.md)). Changing or resetting the domain does not affect the sales coming in from the gateways.

## Reset

With a domain registered, the **Redefine Domain** button clears the registration. The status goes back to **Inactive**. The student area goes back to the Cademí domain, and access through the custom domain stops. You cannot undo this action. To use the domain again, register it once more and repeat the activation.

## Good to know

- **The record must be a plain CNAME.** The check looks, in the DNS, for a CNAME record pointing to core.cademi.com.br. If your provider has a proxy or CDN on the record (Cloudflare's orange cloud, for example), turn it off on that record. With the proxy on, the check does not find the CNAME and the status ends up as **Invalid pointing**.
- **Subdomain only.** For yourbrand.com to lead to the platform, set up at your provider a redirect from the root domain to the registered subdomain.
- **Domain already in use.** A domain registered in another Cademí account cannot be saved or activated in this one. The message is "The provided domain is already in use".
- **Certificate stuck in Processing.** Click **Verify certificate** again after a few minutes. If it stays that way, check at your provider whether a rule prevents certificates for the domain. Then contact support.
- **Clone.** A clone is created without the source account's domain and can register its own.

## Frequently asked questions

**Can I use my main domain, without a subdomain?** No. The platform only accepts subdomains, such as courses.yourbrand.com. At your provider, point the root domain to the registered subdomain.

**I created the CNAME and got Invalid.** The DNS has not propagated yet, or the record's name is not the one you registered. Check the name, wait and click **Activate now** again.

**I use Cloudflare and the status is Invalid pointing.** The proxy is on for the record. Turn off the orange cloud on that record and click **Activate now** again.

**I registered the domain and students are still on the Cademí address.** The domain only becomes the main one at the **Active** status. Check the status and finish the activation.

**I am switching domains. Do I lose anything?** No. Reset the current domain and register the new one. The Cademí addresses keep working in the meantime, and deliveries do not depend on your own domain.
