> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://docs.agentmail.to/llms.txt.

# Create Event

POST https://api.agentmail.to/v0/inboxes/{inbox_id}/calendar/events
Content-Type: application/json

Creates a one-off or recurring event on the inbox's calendar. Times are wall-clock values in
`timezone` (the calendar's default time zone if omitted); the response also gives each
boundary as a UTC instant in `start_at` and `end_at`.

`calendar.event.created` is sent once the event is stored, then `calendar.event.starting`
and `calendar.event.ending` as each date begins and ends. With `send_invites: true` the
inbox also emails an invitation to every attendee.

Pass `client_id` to make retries safe: repeating the request with the same `client_id` and
body returns the original event with status `200` instead of `201`, for as long as the event
exists.

With `send_invites: true`, each attendee counts as one send against the organization, pod
and inbox send limits, charged before the event is stored. An over-limit request returns
`429` `rate_limit_exceeded` and creates nothing. A replay of an earlier create is not
charged again.

The event's `etag` is the value to send in `If-Match` to make a later update or delete
conditional. Requires the `calendar_event_create` permission.

Calendar is in private beta in US production (`api.agentmail.to`). It is unavailable in EU
production (`api.agentmail.eu`). Organizations without access receive a `403`.

Reference: https://docs.agentmail.to/api-reference/inboxes/calendar/create-event

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://api.agentmail.to` (prod, default)
- `https://x402.api.agentmail.to` (prod-x402)
- `https://mpp.api.agentmail.to` (prod-mpp)
- `https://api.agentmail.eu` (eu-prod)

## Request

### Path parameters

- `inbox_id` (string, required) — The ID of the inbox.

### Body (application/json)

This endpoint expects a CreateCalendarEventRequest.

- `title` (string, required) — Title of the event. 1 to 1,000 characters.
- `start` (string, required) — Local start time in `timezone`: `YYYY-MM-DDTHH:mm:ss` for timed events, `YYYY-MM-DD` for all-day events. For a recurring event, this is the first date.
- `end` (string, required) — Local end time in `timezone`, in the same format as `start`. For timed events it must be after `start`; for all-day events it is the last day (inclusive) and can equal `start`. One-off events can last up to 366 days; each date of a recurring event up to 31 days.
- `client_id` (string, optional) — Your idempotency key for this create. Retrying with the same `client_id` and the same body returns the original event with `200` instead of creating a second one, for as long as the event exists (`404` once it has been deleted). Reusing it with a different body is a `409` `idempotency_conflict`.
- `description` (string, optional) — Description of the event. At most 65,536 bytes.
- `location` (string, optional) — Location of the event. At most 1,024 characters.
- `metadata` (any, optional) — Your own JSON value (usually an object), returned on reads and in webhooks (except agenda and instance list items, and the webhook for a date cancelled with `DELETE`). Never sent to attendees. At most 16,384 bytes serialized.
- `status` (enum, optional) — Defaults to `confirmed`.
  - Allowed values: `confirmed`, `tentative`, `cancelled`
- `all_day` (boolean, optional) — Set to `true` for an all-day event. Defaults to `false`.
- `timezone` (string, optional) — Time zone of `start` and `end`. Defaults to the calendar's `timezone`.
- `duration_mode` (enum, optional) — Timed events only. Defaults to `exact` for one-off events and `nominal` for recurring events.
  - Allowed values: `nominal`, `exact`
- `recurrence` (RecurrenceInput, optional) — Makes this a recurring event.
- `attendees` (list of Attendee, optional) — Attendees of the event. At most 100.
- `send_invites` (boolean, optional) — When `true`, the inbox emails an invitation (iCalendar `REQUEST`) to every attendee. Defaults to `false`.

## Response

### 201

- `event` (CalendarEvent, required) — A calendar event. The same shape is used by every response, list item and webhook. `kind` says whether it is a one-off event, the definition of a recurring series, or one date of a series.
- `operation_id` (string, required) — ID of the change this request made. The `calendar.event.created`, `calendar.event.updated`, `calendar.event.deleted` or `calendar.event.responded` webhook for the change carries the same value as its `event_id`, so you can match webhooks to your own requests.

## Errors

### 400 Validation Error

- `name` (string, required) — Name of error.
- `errors` (any, required) — Validation errors. Each entry has a path and a message identifying the invalid field.
- `code` (string, optional) — Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
- `message` (string, optional) — Error message.
- `fix` (string, optional) — The concrete next action that resolves the error.
- `docs` (string, optional) — Link to the error reference entry for this code.

### 403 Forbidden Error

The organization does not have calendar access (calendar is in private beta), or the API key lacks the required calendar permission.

- `name` (string, required) — Name of error.
- `message` (string, required) — Error message.
- `code` (string, optional) — Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
- `fix` (string, optional) — The concrete next action that resolves the error.
- `docs` (string, optional) — Link to the error reference entry for this code.

### 404 Not Found Error

- `name` (string, required) — Name of error.
- `message` (string, required) — Error message.
- `code` (string, optional) — Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
- `fix` (string, optional) — The concrete next action that resolves the error.
- `docs` (string, optional) — Link to the error reference entry for this code.

### 409 Conflict Error

- `name` (string, required) — Name of error.
- `message` (string, required) — Error message.
- `code` (string, optional) — Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
- `fix` (string, optional) — The concrete next action that resolves the error.
- `docs` (string, optional) — Link to the error reference entry for this code.

### 413 Payload Too Large Error

The request body is too large (8 KB for calendar settings, 128 KB for events).

- `name` (string, required) — Name of error.
- `message` (string, required) — Error message.
- `code` (string, optional) — Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
- `fix` (string, optional) — The concrete next action that resolves the error.
- `docs` (string, optional) — Link to the error reference entry for this code.

### 429 Rate Limit Error

Too many requests, or the invitation emails this request would send exceed an organization, pod or inbox send limit. Nothing was changed. Honor the `Retry-After` header when present.

- `name` (string, required) — Name of error.
- `message` (string, required) — Error message.
- `code` (string, optional) — Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
- `fix` (string, optional) — The concrete next action that resolves the error.
- `docs` (string, optional) — Link to the error reference entry for this code.

## Types

### RecurrenceInput

Repeats the event. `rule` is an RFC 5545 RRULE, evaluated in the event's `timezone` from the event's `start`. Each date keeps its wall-clock time across daylight-saving changes.

- `rule` (string, required) — RFC 5545 RRULE body, with or without the `RRULE:` prefix, for example `FREQ=WEEKLY;BYDAY=MO,WE,FR` or `FREQ=MONTHLY;BYDAY=-1FR;COUNT=12`. Supported parts: `FREQ`, `INTERVAL` (1 to 366), `COUNT` (1 to 10,000), `UNTIL` (`YYYYMMDD` for all-day events, `YYYYMMDDTHHMMSSZ` for timed events), `WKST`, `BYMONTH`, `BYWEEKNO`, `BYYEARDAY`, `BYMONTHDAY`, `BYDAY`, `BYHOUR`, `BYMINUTE`, `BYSECOND` and `BYSETPOS`. `COUNT` and `UNTIL` are mutually exclusive. The rule is stored in a normalized form, so a response can differ textually from what you sent. At most 512 characters after normalization.
- `exdates` (list of string, optional) — Dates to skip, matching the original start of a date: `YYYY-MM-DDTHH:mm:ss` for timed events, `YYYY-MM-DD` for all-day events. At most 366.
- `rdates` (list of RecurrenceDate, optional) — Extra dates to add. Timed events take date-times or periods; all-day events take dates. At most 100.

### Attendee

- `email` (string, required) — Email address of the attendee. Stored in lowercase. Must be unique within the event.
- `name` (string, optional) — Display name of the attendee. At most 256 characters.
- `status` (enum, optional) — Response status. Defaults to `needs_action`.
  - Allowed values: `needs_action`, `accepted`, `declined`, `tentative`
- `role` (enum, optional) — Defaults to `required`.
  - Allowed values: `required`, `optional`
- `comment` (string, optional) — Comment the attendee sent with their response. At most 4,096 UTF-8 bytes; on create or update, a longer comment is dropped rather than rejected.
- `responded_at` (datetime, optional) — Time at which the attendee last responded.

### CalendarEvent

A calendar event. The same shape is used by every response, list item and webhook. `kind` says whether it is a one-off event, the definition of a recurring series, or one date of a series.

- `event_id` (string, required) — ID of a calendar event. A one-off or recurring event is addressed by its UUID. One date of a recurring event is addressed by a dated ID, `<uuid>_<slot>`: `<uuid>_t20261015T090000` for a timed date (the original wall-clock start in the event's time zone) or `<uuid>_d20261015` for an all-day date. Dated IDs are stable: moving a date keeps its original ID.
- `kind` (enum, required) — What the event object represents. - `single`: a one-off event, addressed by its UUID. - `series`: the definition of a recurring event, addressed by its UUID. It carries `recurrence`; `start` and `end` describe its first date. - `instance`: one date of a recurring event, addressed by its dated ID. It carries `series_id`, `original_start` and `is_exception`.
  - Allowed values: `single`, `series`, `instance`
- `title` (string, required) — Title of the event.
- `status` (enum, required) — Status of the event. A `cancelled` event or date stays readable but sends no `calendar.event.starting` or `calendar.event.ending` webhooks (cancelling a date that is already running still sends its `calendar.event.ending`). A date cancelled by deleting its dated ID is removed from the series instead, so reading it can return `404` or `410`.
  - Allowed values: `confirmed`, `tentative`, `cancelled`
- `all_day` (boolean, required) — Whether this is an all-day event.
- `start` (string, required) — Local start time in `timezone`. For all-day events, the first day.
- `end` (string, required) — Local end time in `timezone`. For all-day events, the last day (inclusive).
- `timezone` (string, required) — Canonical IANA time zone name, for example `America/New_York`, `Europe/London` or `UTC`. Abbreviations such as `PST`, Windows names such as `Pacific Standard Time`, and spellings that differ from the canonical name are rejected.
- `duration_mode` (enum, required) — How the event's length is kept when a date crosses a daylight-saving change. - `exact`: the event lasts the same elapsed time. Default for one-off timed events. - `nominal`: the event keeps its wall-clock end time (a 09:00 to 10:00 meeting stays 09:00 to 10:00 local time). Default for recurring timed events. All-day events are always `nominal`.
  - Allowed values: `nominal`, `exact`
- `duration_value` (integer, required) — Length of the event, in milliseconds for timed events and in days for all-day events.
- `start_at` (datetime, required) — Start as a UTC instant. This is when `calendar.event.starting` is due.
- `end_at` (datetime, required) — End as a UTC instant. This is when `calendar.event.ending` is due.
- `attendee_count` (integer, required) — Number of attendees.
- `uid` (string, required) — iCalendar UID of the event. Invitations about this event carry the same UID.
- `sequence` (integer, required) — iCalendar SEQUENCE number. It increases when a change to a one-off or series event affects what attendees see (time, status, title, description, location, recurrence or attendees). A change to a dated event increases it only when the change is sent with `send_invites`.
- `source` (enum, required) — Where the event came from. `api` events were created through this API and the inbox is their organizer. `email` events were created from a calendar invitation (iMIP) received by the inbox; their organizer is the sender of the invitation.
  - Allowed values: `api`, `email`
- `created_at` (datetime, required) — Time at which the event (or, for a date, the definition governing it) was created.
- `updated_at` (datetime, required) — Time at which the event (or, for a date, the definition governing it) was last updated.
- `series_id` (string, optional) — For `instance` events, the UUID of the series this date belongs to.
- `original_start` (string, optional) — For `instance` events, the date's start as the series rule generated it, before any edit.
- `original_start_at` (datetime, optional) — For `instance` events, `original_start` as a UTC instant.
- `is_exception` (boolean, optional) — For `instance` events, `true` when this date was edited or moved, individually or by a `mode=future` change.
- `description` (string, optional) — Description of the event. Omitted from agenda and instance list items.
- `location` (string, optional) — Location of the event.
- `metadata` (any, optional) — Your own JSON value for the event, usually an object. Never sent to attendees. Omitted from agenda and instance list items.
- `recurrence` (Recurrence, optional) — For `series` events, the recurrence.
- `attendees` (list of Attendee, optional) — Attendees of the event. Omitted from agenda and instance list items; `attendee_count` is always present.
- `organizer_email` (string, optional) — Email address of the organizer. For `api` events, the inbox.
- `origin_message_id` (string, optional) — For `email` events, the ID of the message whose invitation last created or updated the event.
- `resource_revision` (integer, optional) — Present on `single` and `series` events, except agenda items and `calendar.event.starting` and `calendar.event.ending` payloads, which omit it.
- `etag` (string, optional) — The event's or date's current version, also sent as the `ETag` response header. Send it in `If-Match` to make an update, delete or response conditional. Present on Get, Create, Update, Delete and Respond responses; list items and webhooks omit it. Treat it as opaque: a dated event's `etag` (`"occ-..."`) is not derived from `resource_revision`.

### RecurrenceDate

A wall-clock date or date-time, or (timed events only) a period.

### Recurrence

The recurrence of a series, as stored.

- `rule` (string, required) — Normalized RRULE body, without the `RRULE:` prefix.
- `exdates` (list of string, optional)
- `rdates` (list of RecurrenceDate, optional)
- `truncate_before` (string, optional) — Set when the series was ended with a `mode=future` delete: no date starting at or after this wall-clock time occurs.

### RecurrencePeriod

An extra date (RDATE) given as a period. Specify exactly one of `end` or `duration`.

- `start` (string, required) — A local wall-clock time without an offset, interpreted in the event's `timezone`. Timed events use `YYYY-MM-DDTHH:mm:ss` (for example `2026-10-15T09:00:00`). All-day events use `YYYY-MM-DD`. Years must be between 1900 and 9999.
- `end` (string, optional) — A local wall-clock time without an offset, interpreted in the event's `timezone`. Timed events use `YYYY-MM-DDTHH:mm:ss` (for example `2026-10-15T09:00:00`). All-day events use `YYYY-MM-DD`. Years must be between 1900 and 9999.
- `duration` (string, optional) — ISO 8601 duration, for example `PT30M`.

## Examples

### One-off event with an invitation

**Request**

```json
{
  "title": "Intro call with Acme",
  "start": "2026-10-15T14:00:00",
  "end": "2026-10-15T14:30:00",
  "client_id": "intro-acme-2026-10-15",
  "description": "Walk Jane through the onboarding plan.",
  "location": "https://meet.example.com/acme-intro",
  "metadata": {
    "crm_deal_id": "D-1042"
  },
  "timezone": "America/New_York",
  "attendees": [
    {
      "email": "jane@acme.com",
      "name": "Jane Doe"
    }
  ],
  "send_invites": true
}
```

**Response**

```json
{
  "event": {
    "event_id": "3f8a2c1e-6b4d-4e9f-a7c2-5d1b8e0f9a36",
    "kind": "single",
    "title": "Intro call with Acme",
    "status": "confirmed",
    "all_day": false,
    "start": "2026-10-15T14:00:00",
    "end": "2026-10-15T14:30:00",
    "timezone": "America/New_York",
    "duration_mode": "exact",
    "duration_value": 1800000,
    "start_at": "2026-10-15T18:00:00Z",
    "end_at": "2026-10-15T18:30:00Z",
    "attendee_count": 1,
    "uid": "3f8a2c1e-6b4d-4e9f-a7c2-5d1b8e0f9a36@agentmail.to",
    "sequence": 0,
    "source": "api",
    "created_at": "2026-10-01T16:30:00Z",
    "updated_at": "2026-10-01T16:30:00Z",
    "description": "Walk Jane through the onboarding plan.",
    "location": "https://meet.example.com/acme-intro",
    "metadata": {
      "crm_deal_id": "D-1042"
    },
    "attendees": [
      {
        "email": "jane@acme.com",
        "name": "Jane Doe",
        "status": "needs_action",
        "role": "required"
      }
    ],
    "organizer_email": "scheduler@agentmail.to",
    "resource_revision": 0,
    "etag": "\"rv-0\""
  },
  "operation_id": "0d6f1e2a-9c3b-4d5e-8f7a-6b1c2d3e4f50"
}
```

**SDK Code**

```python One-off event with an invitation
import requests

url = "https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events"

payload = {
    "title": "Intro call with Acme",
    "start": "2026-10-15T14:00:00",
    "end": "2026-10-15T14:30:00",
    "client_id": "intro-acme-2026-10-15",
    "description": "Walk Jane through the onboarding plan.",
    "location": "https://meet.example.com/acme-intro",
    "metadata": { "crm_deal_id": "D-1042" },
    "timezone": "America/New_York",
    "attendees": [
        {
            "email": "jane@acme.com",
            "name": "Jane Doe"
        }
    ],
    "send_invites": True
}
headers = {
    "Authorization": "Bearer <api_key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript One-off event with an invitation
const url = 'https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <api_key>', 'Content-Type': 'application/json'},
  body: '{"title":"Intro call with Acme","start":"2026-10-15T14:00:00","end":"2026-10-15T14:30:00","client_id":"intro-acme-2026-10-15","description":"Walk Jane through the onboarding plan.","location":"https://meet.example.com/acme-intro","metadata":{"crm_deal_id":"D-1042"},"timezone":"America/New_York","attendees":[{"email":"jane@acme.com","name":"Jane Doe"}],"send_invites":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go One-off event with an invitation
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events"

	payload := strings.NewReader("{\n  \"title\": \"Intro call with Acme\",\n  \"start\": \"2026-10-15T14:00:00\",\n  \"end\": \"2026-10-15T14:30:00\",\n  \"client_id\": \"intro-acme-2026-10-15\",\n  \"description\": \"Walk Jane through the onboarding plan.\",\n  \"location\": \"https://meet.example.com/acme-intro\",\n  \"metadata\": {\n    \"crm_deal_id\": \"D-1042\"\n  },\n  \"timezone\": \"America/New_York\",\n  \"attendees\": [\n    {\n      \"email\": \"jane@acme.com\",\n      \"name\": \"Jane Doe\"\n    }\n  ],\n  \"send_invites\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <api_key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby One-off event with an invitation
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <api_key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"title\": \"Intro call with Acme\",\n  \"start\": \"2026-10-15T14:00:00\",\n  \"end\": \"2026-10-15T14:30:00\",\n  \"client_id\": \"intro-acme-2026-10-15\",\n  \"description\": \"Walk Jane through the onboarding plan.\",\n  \"location\": \"https://meet.example.com/acme-intro\",\n  \"metadata\": {\n    \"crm_deal_id\": \"D-1042\"\n  },\n  \"timezone\": \"America/New_York\",\n  \"attendees\": [\n    {\n      \"email\": \"jane@acme.com\",\n      \"name\": \"Jane Doe\"\n    }\n  ],\n  \"send_invites\": true\n}"

response = http.request(request)
puts response.read_body
```

```java One-off event with an invitation
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events")
  .header("Authorization", "Bearer <api_key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"title\": \"Intro call with Acme\",\n  \"start\": \"2026-10-15T14:00:00\",\n  \"end\": \"2026-10-15T14:30:00\",\n  \"client_id\": \"intro-acme-2026-10-15\",\n  \"description\": \"Walk Jane through the onboarding plan.\",\n  \"location\": \"https://meet.example.com/acme-intro\",\n  \"metadata\": {\n    \"crm_deal_id\": \"D-1042\"\n  },\n  \"timezone\": \"America/New_York\",\n  \"attendees\": [\n    {\n      \"email\": \"jane@acme.com\",\n      \"name\": \"Jane Doe\"\n    }\n  ],\n  \"send_invites\": true\n}")
  .asString();
```

```php One-off event with an invitation
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events', [
  'body' => '{
  "title": "Intro call with Acme",
  "start": "2026-10-15T14:00:00",
  "end": "2026-10-15T14:30:00",
  "client_id": "intro-acme-2026-10-15",
  "description": "Walk Jane through the onboarding plan.",
  "location": "https://meet.example.com/acme-intro",
  "metadata": {
    "crm_deal_id": "D-1042"
  },
  "timezone": "America/New_York",
  "attendees": [
    {
      "email": "jane@acme.com",
      "name": "Jane Doe"
    }
  ],
  "send_invites": true
}',
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp One-off event with an invitation
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <api_key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"title\": \"Intro call with Acme\",\n  \"start\": \"2026-10-15T14:00:00\",\n  \"end\": \"2026-10-15T14:30:00\",\n  \"client_id\": \"intro-acme-2026-10-15\",\n  \"description\": \"Walk Jane through the onboarding plan.\",\n  \"location\": \"https://meet.example.com/acme-intro\",\n  \"metadata\": {\n    \"crm_deal_id\": \"D-1042\"\n  },\n  \"timezone\": \"America/New_York\",\n  \"attendees\": [\n    {\n      \"email\": \"jane@acme.com\",\n      \"name\": \"Jane Doe\"\n    }\n  ],\n  \"send_invites\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift One-off event with an invitation
import Foundation

let headers = [
  "Authorization": "Bearer <api_key>",
  "Content-Type": "application/json"
]
let parameters = [
  "title": "Intro call with Acme",
  "start": "2026-10-15T14:00:00",
  "end": "2026-10-15T14:30:00",
  "client_id": "intro-acme-2026-10-15",
  "description": "Walk Jane through the onboarding plan.",
  "location": "https://meet.example.com/acme-intro",
  "metadata": ["crm_deal_id": "D-1042"],
  "timezone": "America/New_York",
  "attendees": [
    [
      "email": "jane@acme.com",
      "name": "Jane Doe"
    ]
  ],
  "send_invites": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Recurring event

**Request**

```json
{
  "title": "Team standup",
  "start": "2026-10-05T09:00:00",
  "end": "2026-10-05T09:15:00",
  "location": "https://meet.example.com/standup",
  "timezone": "America/New_York",
  "recurrence": {
    "rule": "FREQ=WEEKLY;BYDAY=MO,WE,FR"
  }
}
```

**Response**

```json
{
  "event": {
    "event_id": "7c4e9b2a-1f3d-4a8e-b6c5-2e9d0f1a8b47",
    "kind": "series",
    "title": "Team standup",
    "status": "confirmed",
    "all_day": false,
    "start": "2026-10-05T09:00:00",
    "end": "2026-10-05T09:15:00",
    "timezone": "America/New_York",
    "duration_mode": "nominal",
    "duration_value": 900000,
    "start_at": "2026-10-05T13:00:00Z",
    "end_at": "2026-10-05T13:15:00Z",
    "attendee_count": 0,
    "uid": "7c4e9b2a-1f3d-4a8e-b6c5-2e9d0f1a8b47@agentmail.to",
    "sequence": 0,
    "source": "api",
    "created_at": "2026-10-01T16:25:00Z",
    "updated_at": "2026-10-01T16:25:00Z",
    "location": "https://meet.example.com/standup",
    "recurrence": {
      "rule": "FREQ=WEEKLY;BYDAY=MO,WE,FR"
    },
    "attendees": [],
    "organizer_email": "scheduler@agentmail.to",
    "resource_revision": 0,
    "etag": "\"rv-0\""
  },
  "operation_id": "0d6f1e2a-9c3b-4d5e-8f7a-6b1c2d3e4f50"
}
```

**SDK Code**

```python Recurring event
import requests

url = "https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events"

payload = {
    "title": "Team standup",
    "start": "2026-10-05T09:00:00",
    "end": "2026-10-05T09:15:00",
    "location": "https://meet.example.com/standup",
    "timezone": "America/New_York",
    "recurrence": { "rule": "FREQ=WEEKLY;BYDAY=MO,WE,FR" }
}
headers = {
    "Authorization": "Bearer <api_key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Recurring event
const url = 'https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <api_key>', 'Content-Type': 'application/json'},
  body: '{"title":"Team standup","start":"2026-10-05T09:00:00","end":"2026-10-05T09:15:00","location":"https://meet.example.com/standup","timezone":"America/New_York","recurrence":{"rule":"FREQ=WEEKLY;BYDAY=MO,WE,FR"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Recurring event
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events"

	payload := strings.NewReader("{\n  \"title\": \"Team standup\",\n  \"start\": \"2026-10-05T09:00:00\",\n  \"end\": \"2026-10-05T09:15:00\",\n  \"location\": \"https://meet.example.com/standup\",\n  \"timezone\": \"America/New_York\",\n  \"recurrence\": {\n    \"rule\": \"FREQ=WEEKLY;BYDAY=MO,WE,FR\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <api_key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Recurring event
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <api_key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"title\": \"Team standup\",\n  \"start\": \"2026-10-05T09:00:00\",\n  \"end\": \"2026-10-05T09:15:00\",\n  \"location\": \"https://meet.example.com/standup\",\n  \"timezone\": \"America/New_York\",\n  \"recurrence\": {\n    \"rule\": \"FREQ=WEEKLY;BYDAY=MO,WE,FR\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Recurring event
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events")
  .header("Authorization", "Bearer <api_key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"title\": \"Team standup\",\n  \"start\": \"2026-10-05T09:00:00\",\n  \"end\": \"2026-10-05T09:15:00\",\n  \"location\": \"https://meet.example.com/standup\",\n  \"timezone\": \"America/New_York\",\n  \"recurrence\": {\n    \"rule\": \"FREQ=WEEKLY;BYDAY=MO,WE,FR\"\n  }\n}")
  .asString();
```

```php Recurring event
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events', [
  'body' => '{
  "title": "Team standup",
  "start": "2026-10-05T09:00:00",
  "end": "2026-10-05T09:15:00",
  "location": "https://meet.example.com/standup",
  "timezone": "America/New_York",
  "recurrence": {
    "rule": "FREQ=WEEKLY;BYDAY=MO,WE,FR"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Recurring event
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <api_key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"title\": \"Team standup\",\n  \"start\": \"2026-10-05T09:00:00\",\n  \"end\": \"2026-10-05T09:15:00\",\n  \"location\": \"https://meet.example.com/standup\",\n  \"timezone\": \"America/New_York\",\n  \"recurrence\": {\n    \"rule\": \"FREQ=WEEKLY;BYDAY=MO,WE,FR\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Recurring event
import Foundation

let headers = [
  "Authorization": "Bearer <api_key>",
  "Content-Type": "application/json"
]
let parameters = [
  "title": "Team standup",
  "start": "2026-10-05T09:00:00",
  "end": "2026-10-05T09:15:00",
  "location": "https://meet.example.com/standup",
  "timezone": "America/New_York",
  "recurrence": ["rule": "FREQ=WEEKLY;BYDAY=MO,WE,FR"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar/events")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```