# Create or Update Availability Rule

#### Description
Creates or updates an availability rule for the authenticated account.

#### URL format
```
{data_center_url}/v1/availability_rules
```

#### Example Request
```http
POST /v1/availability_rules HTTP/1.1
Host: {data_center_url}
Authorization: Bearer {ACCESS_TOKEN}
Content-Type: application/json; charset=utf-8

{
  "availability_rule_id": "default",
  "tzid": "America/Chicago",
  "calendar_ids": [
    "cal_n23kjnwrw2_jsdfjksn234"
  ],
  "weekly_periods": [
    {
      "day": "monday",
      "start_time": "09:30",
      "end_time": "12:30"
    },
    {
      "day": "monday",
      "start_time": "14:00",
      "end_time": "17:00"
    },
    {
      "day": "wednesday",
      "start_time": "09:30",
      "end_time": "12:30"
    }
  ]
}
```

#### Request parameters
##### `data_center_url` *(required)*

The URL for the data center you want to communicate with. Possible choices are:

- `api-au.cronofy.com` - Australia
- `api-ca.cronofy.com` - Canada
- `api-de.cronofy.com` - Germany
- `api-sg.cronofy.com` - Singapore
- `api-uk.cronofy.com` - United Kingdom
- `api.cronofy.com` - United States

Find out more about [Cronofy's data centers](/developers/data-centers/index.md).
##### `availability_rule_id` *(required)*

The [`String`](/developers/api/data-types/index.md) that uniquely identifies the availability rule. The first request made for an `availability_rule_id` will create an available period for the account and subsequent requests will update its details.

Usually this will be your own internal ID for the available period, encoded as an ASCII-only [`String`](/developers/api/data-types/index.md) of up to 64 characters.

##### `tzid` *(required)*

A [`String`](/developers/api/data-types/index.md) representing a known time zone identifier from the [IANA Time Zone Database](https://www.iana.org/time-zones).

Common examples are:

- `Etc/UTC`

- `Europe/Paris`

- `America/Chicago`

##### `calendar_ids` *(optional)*

An [`Array`](/developers/api/data-types/index.md) specifying the calendars that should impact the user's availability. When provided at least one calendar must be specified.

##### `weekly_periods` *(required)*

An [`Array`](/developers/api/data-types/index.md) of weekly recurring periods for the availability rule.

##### `weekly_period.day` *(required)*

A [`String`](/developers/api/data-types/index.md) the week day this period applies to.

Each day can be specified multiple times to set multiple periods on the same day.

Valid options are:

- `sunday`

- `monday`

- `tuesday`

- `wednesday`

- `thursday`

- `friday`

- `saturday`

##### `weekly_period.start_time` *(required)*

A [`String`](/developers/api/data-types/index.md) the time of day the period should start expressed as a 24hr clock string, eg: 09:30.

##### `weekly_period.end_time` *(required)*

A [`String`](/developers/api/data-types/index.md) the time of day the period should end expressed as a 24hr clock string, eg: 16:30.

In addition to a standard time string, the value of `24:00` is supported in order to allow representation of a rule ending at midnight, eg:

```json
{
  "day": "monday",
  "start_time": "08:00",
  "end_time": "24:00"
}
```

#### Example Response
```http
HTTP/1.1 200 Success
Content-Type: application/json; charset=utf-8

{
  "availability_rule": {
    "availability_rule_id": "default",
    "tzid": "America/Chicago",
    "calendar_ids": [
      "cal_n23kjnwrw2_jsdfjksn234"
    ],
    "weekly_periods": [
      {
        "day": "monday",
        "start_time": "09:30",
        "end_time": "12:30"
      },
      {
        "day": "monday",
        "start_time": "14:00",
        "end_time": "17:00"
      },
      {
        "day": "wednesday",
        "start_time": "09:30",
        "end_time": "12:30"
      }
    ]
  }
}
```



---
[Read in HTML](/developers/api/scheduling/availability-rules/upsert-availability-rule/)