> ## Documentation Index
> Fetch the complete documentation index at: https://docs.drin.run/llms.txt
> Use this file to discover all available pages before exploring further.

# Enable or disable receiving

> PATCH /v1/domains/{id}/receiving — turn inbound email on or off for a domain and get the MX record to publish.

Turn a verified domain into a receiving domain. Once enabled and the MX record resolves, you can create inboxes on it and read inbound threads.

**`PATCH /v1/domains/{id}/receiving`**

Enabling receiving returns the `MX` record(s) to publish. Mail can only route in once that record resolves. With receiving on, create an [inbox](/api-reference/inboxes/create) on the domain, then read conversations via [threads](/api-reference/threads/list). To read the current state without changing it, issue a `GET` on the same path.

## Path parameters

<ParamField body="id" type="string" required>
  The domain id, for example `dom_01HZ8K3M9P`.
</ParamField>

## Body

<ParamField body="enabled" type="boolean" required>
  `true` to turn receiving on, `false` to turn it off. Disabling stops routing new inbound mail; existing threads and inboxes are preserved.
</ParamField>

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH https://api.drin.run/v1/domains/dom_01HZ8K3M9P/receiving \
    -H "Authorization: Bearer $DRIN_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "enabled": true }'
  ```

  ```typescript Node.js theme={null}
  import { DrinClient } from "@drin00/sdk";

  const drin = new DrinClient({ apiKey: process.env.DRIN_API_KEY });

  const receiving = await drin.domains.setReceiving("dom_01HZ8K3M9P", {
    enabled: true,
  });

  // Publish the MX record so mail can route in.
  for (const record of receiving.records) {
    console.log(record.type, record.name, record.value, record.priority);
  }
  ```
</CodeGroup>

## Response

`200 OK` — the updated receiving state. When enabling, the `records` array carries the `MX` record(s) to publish; each `verified` flag flips to `true` once it resolves.

```json theme={null}
{
  "enabled": true,
  "records": [
    {
      "type": "MX",
      "name": "acme.com",
      "value": "inbound.drin.run",
      "priority": 10,
      "purpose": "verification",
      "verified": false
    }
  ]
}
```

<Note>
  **Verify sending first.** Receiving can only be enabled on a domain that has already passed [verification](/api-reference/domains/verify) for sending.
</Note>
