# Choose busy calendars

Source: https://docs.vlayers.ai/reference/calendar/set-calendar-availability

`PUT /v1/calendar/availability` · scope `calendar:use`

Chooses which calendars count as busy when a booking page works out whether the person is free. The choice replaces the old one; the default is the main calendar only. Names and ids both work.

Requires an API key with the `calendar:use` scope.

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `calendarIds` | body | string[] | yes | The calendars to check, by name or id. At least one: an empty choice would make everything look free. |
| `connectionId` | body | string | no | Only needed when more than one calendar account is connected. |

## Request

cURL:

```bash
curl -X PUT https://api.vlayers.ai/v1/calendar/availability \
  -H "Authorization: Bearer $VOICELAYER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "calendarIds": [
      "Main",
      "Sales agent"
    ]
  }'
```

TypeScript:

```ts
import { VoiceLayer } from '@voicelayer/api';

const voicelayer = new VoiceLayer();

const { summary } = await voicelayer.calendar.setAvailability({
  calendarIds: ['Main', 'Sales agent']
});
console.log(summary);
```

Python:

```python
from voicelayer import VoiceLayer

vl = VoiceLayer()

result = vl.calendar.set_availability(calendar_ids=["Main", "Sales agent"])
print(result.summary)
```

## Response `200`

```json
{
  "calendars": [
    {
      "connectionId": "0192f5c0-1a2b-7c3d-8e4f-5a6b7c8d9e01",
      "account": "owner@example.com",
      "app": "Google Calendar",
      "id": "c_agent@group.calendar.google.com",
      "name": "Sales agent",
      "main": false,
      "agentCalendar": true,
      "mailbox": "sales@acme.vlayersmail.com",
      "countsForAvailability": true
    }
  ],
  "summary": "From now on I check Main, Sales agent when working out if you're free."
}
```
