---
title: "Rename the team’s own address"
method: PATCH
path: "/api/v1/mail/hosted"
tags: ["Desk"]
---

# Rename the team’s own address

`PATCH /api/v1/mail/hosted`

## Request

- Base URL: `http://localhost:5180`
- URL: `http://localhost:5180/api/v1/mail/hosted`
- Auth: API key in cookie `better-auth.session_token`

Gives the address a new name before the @, while no message has arrived at it. Each name belongs to one team, and a name once given to a team that has since been erased is never given again. Once mail has arrived the name stays, because somebody may write to it again.

## Request body

- object
  - `name` string, required: What goes before the @: letters, digits, dots and dashes.

## Response `200`

The address under its new name.

- object
  - `ok` unknown, required
  - `data` object, required
    - `domain` string, required: The domain every team address sits at.
    - `address` string, nullable, required: The team’s own address, or null where the team has no plan running and so no address yet.
    - `mailboxId` string, nullable, required: The mailbox on the portfolio that this address files into.
    - `renamable` boolean, required: Whether the name before the @ may still change. It is fixed once the first message arrives.
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

## Other responses

- `404`: The team has no address yet.
- `409`: The name is held or was held by another team (`taken`), or mail already arrived (`received`), in `details.reason`.
- `422`: The name cannot be an address: `short`, `long`, `shape` or `reserved` in `details.reason`.

---

[API](https://skmtc.dev/dardaris/apis/dardaris-api.md) · [All operations](https://skmtc.dev/dardaris/apis/dardaris-api/llms.txt) · [OpenAPI document](https://skmtc.dev/dardaris/apis/dardaris-api/revisions/4aff33835c73?raw)
