---
title: "Turn on a domain"
description: "Starts serving a verified domain, with HTTPS."
canonical_url: https://docs.markdrop.in/api/domains/turn-on-a-domain
last_updated: 2026-10-30
site: "Markdrop Docs"
index: https://docs.markdrop.in/llms.txt
---

# Turn on a domain

`POST https://api.markdrop.in/api/v1/workspaces/{workspace_id}/domains/{domain_id}/attach`

Starts serving a verified domain, with HTTPS.

- **Authentication:** API token required: `Authorization: Bearer mdk_…`.
- **Rate limit:** 20 per minute per IP address.

## Path parameters

- `workspace_id` (string, required): The workspace's id, from the address of its settings page (`markdrop.in/settings/workspaces/<workspace-id>`) or from [List workspaces](https://docs.markdrop.in/api/workspaces/list-workspaces).
- `domain_id` (string, required): The domain's id, from [List domains](https://docs.markdrop.in/api/domains/list-domains).

## Responses

- `200`: OK.
  - `id` (string)
  - `host` (string)
  - `kind` ("app" | "cdn")
  - `status` ("pending" | "verified" | "failed" | "lapsed")
  - `created_at` (string (date-time)): ISO 8601, for example `2026-11-30T12:00:00Z`.
  - `verified_at` (string (date-time) | null): ISO 8601, for example `2026-11-30T12:00:00Z`.
  - `last_checked_at` (string (date-time) | null): ISO 8601, for example `2026-11-30T12:00:00Z`.
  - `last_error` (string | null)
  - `attached` (boolean): Default `false`.
  - `is_primary` (boolean): Default `false`.
  - `dns_record_name` (string | null)
  - `dns_record_type` (string | null): Default `"TXT"`.
  - `dns_record_value` (string | null)
  - `dns_target_name` (string | null)
  - `dns_target_type` (string | null)
  - `dns_target_value` (string | null)
  - `warning` (string | null)
  - `live` (boolean): Default `false`.
  - `routing_ok` (boolean | null)
  - `txt_ok` (boolean | null)
  - `failures` (integer): Default `0`.
  - `first_failed_at` (string (date-time) | null): ISO 8601, for example `2026-11-30T12:00:00Z`.
  - `lapsed_at` (string (date-time) | null): ISO 8601, for example `2026-11-30T12:00:00Z`.
  - `expires_at` (string (date-time) | null): ISO 8601, for example `2026-11-30T12:00:00Z`.
  - `apex_certain` (boolean | null): Default `true`.
  - `dns_routing_options` (array of object)
    - `type` (string)
    - `name` (string)
    - `value` (string)
- `401`: No token, or the token is revoked or mistyped.
- `422`: The request didn't validate. `detail` lists each problem, with where it is (`loc`) and why (`msg`).
- `429`: Too many requests from your IP address. Wait the seconds in `Retry-After`.
- `501`: Domains can't be turned on automatically here. Finish the step by hand.

## Examples

**curl**

```bash
curl -X POST https://api.markdrop.in/api/v1/workspaces/WORKSPACE_ID/domains/DOMAIN_ID/attach \
  -H "Authorization: Bearer $MARKDROP_TOKEN"
```

**JavaScript**

```javascript
const res = await fetch("https://api.markdrop.in/api/v1/workspaces/WORKSPACE_ID/domains/DOMAIN_ID/attach", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MARKDROP_TOKEN}`,
  },
});
const data = await res.json();
```

**Python**

```python
import os

import requests

r = requests.post(
    "https://api.markdrop.in/api/v1/workspaces/WORKSPACE_ID/domains/DOMAIN_ID/attach",
    headers={"Authorization": f"Bearer {os.environ['MARKDROP_TOKEN']}"},
)
r.raise_for_status()
print(r.json())
```
