# Connect a mailbox

Connects one email account, which is the same act as starting to watch it: mail arriving there is ingested from then on, and the address becomes one this workspace's own email may go out as. Body: `provider` ("gmail" or "outlook"), `address`, and `connection_id` (required — which already-connected account this inbox belongs to; no credential is pasted here). It registers a subscription with the provider, so a deployment missing that integration is told so with a 503 and no row is written, rather than showing a connected mailbox that receives nothing. An admin's route.

Access class: `workspace`.

## Endpoint

`POST /v1/mailboxes`

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "address": "string",
    "connection_id": "",
    "provider": "string"
  },
  "params": {},
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "address": "string",
    "connection_id": "",
    "created_at": "string",
    "id": "",
    "last_synced_at": "string",
    "mine": true,
    "provider": "string",
    "source": "string",
    "watching": true
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
