# Add an email domain

> Page: https://docs.plotwork.dev/api/post-orgs-org-sso-domains. Index of every page: https://docs.plotwork.dev/llms.txt

Adds a domain and answers the TXT record to publish at `_plotwork-verify.<domain>`.

`POST /orgs/{org}/sso/domains`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Add an email domain. |
| What does it take? | A JSON body of type [`SsoDomainBody`](https://docs.plotwork.dev/api/schemas.md#ssodomainbody). |
| What does it return? | Status 201 with a body of type [`SsoDomain`](https://docs.plotwork.dev/api/schemas.md#ssodomain). |
| What can go wrong? | `400` the body is not valid; `401` not signed in; `403` a member or a reader (orgs.forbidden), a plan without single sign-on (plan.sso_not_included), or the request came from an origin that may not make changes; `404` no such organisation, or the caller is not a member of it; `409` another organisation verified this domain (sso.domain_taken); `422` not a domain a provider can be proved for (sso.domain_invalid); `429` too many requests; `503` single sign-on is not set up on this server (sso.unavailable), or organisations are not. Every failure uses the one error envelope. |

## What it does

Adds a domain and answers the TXT record to publish at `_plotwork-verify.<domain>`. It counts once verified. Public mail domains are refused; at most 20; one another organisation verified is 409 sso.domain_taken.

## Path parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `org` | `string` | yes | The organisation's id or its slug. |

## Request body

The body has the type [`SsoDomainBody`](https://docs.plotwork.dev/api/schemas.md#ssodomainbody).

| Field | Type | Required | Description |
|---|---|---|---|
| `domain` | `string` | yes | at least 3 characters; at most 253 characters. |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 201 | The domain and its record. | [`SsoDomain`](https://docs.plotwork.dev/api/schemas.md#ssodomain) |
| 400 | The body is not valid. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 401 | Not signed in. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 403 | A member or a reader (orgs.forbidden), a plan without single sign-on (plan.sso_not_included), or the request came from an origin that may not make changes. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 404 | No such organisation, or the caller is not a member of it. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 409 | Another organisation verified this domain (sso.domain_taken). | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 422 | Not a domain a provider can be proved for (sso.domain_invalid). | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 429 | Too many requests. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 503 | Single sign-on is not set up on this server (sso.unavailable), or organisations are not. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |

## Response body

A 201 answer has the type [`SsoDomain`](https://docs.plotwork.dev/api/schemas.md#ssodomain).

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | yes |  |
| `domain` | `string` | yes |  |
| `verified` | `boolean` | yes |  |
| `verifiedAt` | `integer \| null` | yes |  |
| `checkedAt` | `integer \| null` | yes |  |
| `createdAt` | `integer` | yes |  |
| `record` | `object` | yes |  |
| `record.name` | `string` | yes |  |
| `record.type` | `"TXT"` | yes |  |
| `record.value` | `string` | yes |  |

## See also

| Doc | Why |
|---|---|
| [API reference](https://docs.plotwork.dev/api/reference.md) | Every endpoint, and the error envelope |
| [Schemas](https://docs.plotwork.dev/api/schemas.md) | Every request and response type |
| [Tool reference](https://docs.plotwork.dev/mcp/tools.md) | The operations as callable tools |
