# Make an agent calendar

Source: https://docs.vlayers.ai/reference/calendar/create-calendar

`POST /v1/calendar/calendars` · scope `calendar:use`

Makes a separate calendar for an agent inside the person's own Google or Outlook account. It counts when checking whether the person is free, and bookings for the agent's mailbox land on it. A Google account connected before this existed is asked to sign in again to approve one more permission: the refusal carries the link.

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

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `name` | body | string | yes | A name people will recognise, for example `Sales agent`. |
| `timeZone` | body | string | yes | Where the agent works, as an IANA name such as `America/Chicago`. |
| `forMailbox` | body | string | no | The agent's email address, so meetings booked for that mailbox land on this calendar. One calendar per mailbox. |
| `connectionId` | body | string | no | Only needed when more than one calendar account is connected. |

## Request

cURL:

```bash
curl -X POST https://api.vlayers.ai/v1/calendar/calendars \
  -H "Authorization: Bearer $VOICELAYER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Sales agent",
    "timeZone": "America/Chicago",
    "forMailbox": "sales@test.vlayers.ai"
  }'
```

TypeScript:

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

const voicelayer = new VoiceLayer();

const { summary } = await voicelayer.calendar.create({
  name: 'Sales agent',
  timeZone: 'America/Chicago',
  forMailbox: 'sales@test.vlayers.ai'
});
console.log(summary);
```

Python:

```python
from voicelayer import VoiceLayer

vl = VoiceLayer()

result = vl.calendar.create(
    name="Sales agent",
    time_zone="America/Chicago",
    for_mailbox="sales@test.vlayers.ai",
)
print(result.summary)
```

## Response `200`

```json
{
  "calendar": {
    "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": "Made a calendar called \"Sales agent\" in Google Calendar for sales@acme.vlayersmail.com. It counts when I check if you're free, and you can rename or edit it in Google Calendar like any other."
}
```
