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

# Update Calendar

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

Updates the calendar's default time zone. Existing events keep their own `timezone`; only
events created later without a `timezone` use the new default.

Requires the `calendar_update` permission. To make the update conditional, send the
calendar's current `etag` in `If-Match`: a stale value returns `412`. Without `If-Match` the
update applies to the calendar as it is.

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/update

## 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.

### Headers

- `If-Match` (string, optional) — The calendar's current `etag`, for example `"rv-0"`. Optional; makes the update conditional; `*` matches any current version.

### Body (application/json)

This endpoint expects an object.

- `timezone` (string, required) — New default time zone for events created without a `timezone`.

## Response

### 200

- `inbox_id` (string, required) — The ID of the inbox.
- `timezone` (string, required) — Default time zone for events created without a `timezone`. Defaults to `UTC`. Changing it does not move existing events.
- `event_count` (integer, required) — Number of one-off and recurring events on the calendar. Each recurring event counts once.
- `created_at` (datetime, required) — Time at which the calendar was created. The calendar exists from the moment the inbox does, so this is the inbox's creation time.
- `updated_at` (datetime, required) — Time at which the calendar was last updated.
- `etag` (string, required) — The calendar's current version, also sent as the `ETag` response header. Send it in `If-Match` to make an update conditional.

## 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.

### 412 Precondition Failed Error

The resource changed since the `If-Match` value was read. Fetch it again, reapply the change, and retry with the new `etag`.

- `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.
- `current_revision` (integer, optional) — The resource's current revision.
- `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.

## Examples

**Request**

```json
{
  "timezone": "America/New_York"
}
```

**Response**

```json
{
  "inbox_id": "scheduler@agentmail.to",
  "timezone": "America/New_York",
  "event_count": 2,
  "created_at": "2026-10-01T16:20:00Z",
  "updated_at": "2026-10-01T16:25:00Z",
  "etag": "\"rv-1\""
}
```

**SDK Code**

```python
import requests

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

payload = { "timezone": "America/New_York" }
headers = {
    "Authorization": "Bearer <api_key>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <api_key>', 'Content-Type': 'application/json'},
  body: '{"timezone":"America/New_York"}'
};

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

```go
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"timezone\": \"America/New_York\"\n}")

	req, _ := http.NewRequest("PATCH", 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
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <api_key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"timezone\": \"America/New_York\"\n}"

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

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

HttpResponse<String> response = Unirest.patch("https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar")
  .header("Authorization", "Bearer <api_key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"timezone\": \"America/New_York\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar', [
  'body' => '{
  "timezone": "America/New_York"
}',
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/inboxes/scheduler%40agentmail.to/calendar");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <api_key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"timezone\": \"America/New_York\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <api_key>",
  "Content-Type": "application/json"
]
let parameters = ["timezone": "America/New_York"] 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")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
```