# Add a domain

`POST /workspace/domains` · Rivier · domains

Add a domain: detect where its DNS is hosted, build the records and check for conflicts.

- Scope: domains:write
- Mcp: rivier_domain_set
- Sdk: domains.domain.add
- Cli: domains domain add
- Events: domains.domain.added

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "domain": {
      "type": "string",
      "minLength": 3,
      "maxLength": 253
    },
    "mode": {
      "type": "string",
      "enum": [
        "apex",
        "subdomain",
        "delegate"
      ]
    },
    "subLabel": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]{0,30}$"
    }
  },
  "required": [
    "domain"
  ],
  "additionalProperties": false
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/workspace/domains' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "domain": "string"
}'
```
