# Connect an account to a calendar

`PUT https://www.getrevox.com/api/assistants/{id}/calendars/{calendarId}/connection`

Attach a Nango connection of the organization to the calendar, which takes the handle of that account (`google_calendar_aric_at_getrevox.com`, then `_2` for a second calendar on the same account). Reconnecting the same account keeps the handle. Google's primary calendar, or the account's only event type, is picked right away; otherwise pick one with the selection endpoint.

## Path parameters

- `id` (string, required)
- `calendarId` (string, required)

## Request body (JSON)

- `connection_id` (string, required): The Nango connection ID linking an account of the calendar's provider to Revox.

## Example request

```bash
curl -X PUT https://www.getrevox.com/api/assistants/3c90c3cc-0d44-4b50-8888-8dd25736052a/calendars/3c90c3cc-0d44-4b50-8888-8dd25736052a/connection \
  -H "Authorization: Bearer $REVOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  }'
```

## Responses

### 200: Success

- `calendar` ([AssistantCalendar](https://www.getrevox.com/docs/api/objects/assistant-calendar.md), required)

### 400: Invalid request: the body or a parameter failed validation

- `message` (string, optional)
- `error` (string, optional)
- `bodyErrors` (object, optional): The validation errors returned from the API.
  - `issues` (array of object, required)
    - `path` (array of one of, required)
      - One of, **string** (string)
      - One of, **number** (number)
    - `message` (string, required)
    - `code` (string, optional)

### 404: Not found in your organization

- `message` (string, optional)
- `error` (string, optional)
- `bodyErrors` (object, optional): The validation errors returned from the API.
  - `issues` (array of object, required)
    - `path` (array of one of, required)
      - One of, **string** (string)
      - One of, **number** (number)
    - `message` (string, required)
    - `code` (string, optional)