# Update an access schedule

`PATCH https://api.cademi.com.br/api/v3/products/{product_id}/access-schedules/{access_schedule_id}`

Operation ID: `products.access_schedules.update` · API v3

Renames or restores an access schedule.

The access schedule takes its name from its tag, so changing `name` renames the tag everywhere it is used and also requires the `tags.update` permission. Setting `deleted` to `false` restores an access schedule from the trash.

Replicated access schedules are read-only and return the `replica_readonly` error code.

Send the current `ETag` value in the `If-Match` header to avoid overwriting a newer version.

Required permissions: `access_schedules.update`, `tags.update`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `product_id` | path | string | yes |  |
| `access_schedule_id` | path | string | yes |  |
| `If-Match` | header | string | no |  |

## Request body

Content type: `application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `deleted` | boolean | no |  |
| `name` | string | no |  |

## Responses

### 200

Returns the updated access schedule.

Body: `data`: AccessSchedule.

Fields of AccessSchedule:

| Field | Type | Required | Description |
|---|---|---|---|
| `created_at` | string (date-time) | yes |  |
| `default` | boolean | yes |  |
| `deleted` | boolean | yes |  |
| `deliveries` | array of object or null | no | Deliveries that apply this access schedule's tag. Returned only when retrieving a single access schedule. |
| `deliveries_count` | integer | yes |  |
| `id` | string | yes |  |
| `name` | string | yes |  |
| `object` | string, one of `access_schedule` | yes |  |
| `product_id` | string | yes |  |
| `revision` | string | yes |  |
| `rules_count` | integer | yes |  |
| `tag_id` | string or null | yes |  |
| `updated_at` | string (date-time) | yes |  |

### 401

The credential is missing, malformed, expired, or revoked.

Body: Error.

### 403

The current credentials do not have the permission required by this operation.

Body: Error.

### 404

The access schedule was not found for this product or is not accessible with the current credentials.

Body: Error.

### 412

The access schedule has changed since the supplied revision was retrieved.

Body: Error.

### 422

The request body or query parameters failed validation.

Body: ValidationFailed.

Full schema: https://cademi.dev/openapi/v3.json
