# Create or replace a grant setting

> **PUT** `https://api.us.nylas.com/v3/grants/{grant_id}/settings/{setting_name}`

Source: https://developer.nylas.com/docs/reference/api/manage-grants/put_grant_setting/

Creates the setting, or replaces it if it already exists. Send the value under the same key as
`setting_name`. You don't need to know whether the grant already has a value, and retrying the
same request is safe. What each setting accepts is in the request body schema.

**Authentication:** NYLAS_API_KEY

## Parameters

### Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `grant_id` | string | Yes | ID of the grant to access. |
| `setting_name` | string, one of: `synced-calendars` | Yes | The setting name. Request and response bodies use the same name as the JSON key. |

## Request body

Content-Type: application/json

- `synced-calendars` (array, minItems: 1, maxItems: 50) **(required)** - The calendar IDs to sync, from 1 to 50. Nylas syncs and sends `calendar.*` and `event.*`
notifications for these calendars only, starting from the grant's next sync. It checks every
ID against the grant's calendars before it saves anything, so use the provider's calendar IDs from
[`GET /v3/grants/{grant_id}/calendars`](/docs/reference/api/calendar/get-all-calendars/),
not `primary`. To remove the list, delete the setting instead of sending an empty array.

## Responses

### 200 - OK

- `request_id` (string) - The request ID.
- `data` (object) - The grant's public settings. Each key is the setting name, the same as in the path. A setting that isn't set
is `null`.
  - `synced-calendars` (array, nullable, maxItems: 50) - The calendars that Nylas syncs and sends `calendar.*` and `event.*` notifications for on this
grant, as provider calendar IDs. `null` when the grant has no list, which means the
**Subscribe to primary calendars only** setting in the Dashboard applies. For how the two
interact, see
[Sync and notify for specific calendars](/docs/v3/calendar/#sync-and-notify-for-specific-calendars).

### 400 - Bad Request

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

### 401 - Not Authenticated

- `request_id` (string) **(required)** - ID of the request
- `error` (object) **(required)** - Error object
  - `type` (string) - Type of error
  - `message` (string, default: `"Authentication error"`) - Informative error message
  - `provider_error` (object) - (OPTIONAL) informative error message from provider's side

### 404 - Not Found

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

## Code samples

### cURL

```bash
curl --request PUT \
  --url 'https://api.us.nylas.com/v3/grants/<NYLAS_GRANT_ID>/settings/synced-calendars' \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <NYLAS_API_KEY>' \
  --data '{
    "synced-calendars": [
      "jane@example.com",
      "c_3a7d1e5b@group.calendar.google.com"
    ]
  }'

```
