# Create an access schedule

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

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

Creates an access schedule for the product, identified by the supplied tag.

Each tag and product pair has at most one access schedule. If one already exists for the pair, the existing schedule is returned with `200 OK` and no new schedule is created.

Access schedules cannot be created for replicated products; these requests return the `replica_readonly` error code.

Required permissions: `access_schedules.create`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `product_id` | path | string | yes |  |

## Request body

Content type: `application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `tag_id` | string | yes |  |

## Responses

### 200

An access schedule already exists for this tag and product. Returns the existing 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 |  |

### 201

Returns the newly created 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 product was not found or is not accessible with the current credentials.

Body: Error.

### 422

The request body or query parameters failed validation.

Body: ValidationFailed.

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