# Application Calendars

#### Description
Provisions a Cronofy hosted calendar for use by your application.

The `application_calendar_id` uniquely identifies the calendar for your
application so that the first time it is used a new calendar is created, and
subsequent calls return the details of the existing calendar.

Application calendars are limited to one primary calendar and cannot invite
users to events. They also cannot be invited as an attendee to events created in other calendars.

Application Calendars can be revoked by calling to the [Revoking Authorization](/developers/api/authorization/revoke/index.md) endpoint and passing the Application Calendar's `access_token` or the `sub` value.

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

#### Example Request
```http
POST /v1/application_calendars HTTP/1.1
Content-Type: application/json; charset=utf-8

{
  "client_id": {CLIENT_ID},
  "client_secret": {CLIENT_SECRET},
  "application_calendar_id": "my-unique-string"
}
```

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

{
  "token_type": "bearer",
  "access_token": {RANDOM_TOKEN},
  "expires_in": 3600,
  "refresh_token": {RANDOM_TOKEN},
  "scope": "read_write",
  "application_calendar_id": "my-unique-string",
  "sub": "apc_64b17fbb8090ea21640c9152",
  "linking_profile": {
    "provider_name": "cronofy",
    "profile_id": "pro_n23kjnwrw2",
    "profile_name": "n23kjnwrw2"
  }
}
```

#### 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).
##### `client_id` *(required)*

The `client_id` of the client creating the calendar.

##### `client_secret` *(required)*

The `client_secret` of the client creating the calendar.

##### `application_calendar_id` *(required)*

The [`String`](/developers/api/data-types/index.md) that uniquely identifies the application calendar.

> **WARNING:** The `application_calendar_id` parameter does not replace the `calendar_id`. This `application_calendar_id` should be used to identify the calendar within your application, and `calendar_id` should be used in API calls to Cronofy endpoints that require that parameter.

You can use [UserInfo](/developers/api/identity/userinfo/index.md) to find out the `calendar_id` of an Application Calendar.

#### Response parameters
##### `token_type`

Describes the type of the token as defined in <a href="https://www.rfc-editor.org/rfc/rfc6749#section-7.1">section 7.1 of RFC 6749</a>.

Will always be `bearer`.

##### `access_token`

The new Access Token to use to authenticate when using the API on behalf of the user.

Will always be a 32 character [`String`](/developers/api/data-types/index.md) of ASCII characters.

##### `expires_in`

An approximate number of seconds that the new Access Token will be valid for. Will always be a positive integer no greater than 2,147,483,647.

This value may be used to pre-emptively request a new Access Token when this one is expected to have already expired.

However, as being issued new Access Tokens counts for rate limiting but a `401 Unauthorized` response for an invalid Access Token does not, it is recommended to use each Access Token you received for as long as possible.

##### `refresh_token`

The `refresh_token` for the granted authorization.

Will always be a 32 character [`String`](/developers/api/data-types/index.md) of ASCII characters.

##### `scope`

The Access Token Scope as defined in <a href="https://www.rfc-editor.org/rfc/rfc6749#section-3.3">section 3.3 of RFC 6749</a>.

This scope will currently return `read_write` scope, as this is implicitly granted to the client.

##### `application_calendar_id` *(optional)*

The [`String`](/developers/api/data-types/index.md) that uniquely identifies the application calendar.

##### `sub` *(optional)*

The ID of the application calendar the credentials relate to.

##### `linking_profile` *(optional)*

The details of the profile.

##### `linking_profile.provider_name` *(optional)*

This specifies the provider of the calendar as a lowercase, ASCII-only [`String`](/developers/api/data-types/index.md).

Currently will always return `cronofy`. However, this will be expanded over time and therefore consumers should support any value for this field.

##### `linking_profile.profile_id` *(optional)*

This specifies the ID of the profile, a profile may consist of many calendars, as an ASCII-only [`String`](/developers/api/data-types/index.md).

This is used for targetting other API actions toward this profile.

##### `linking_profile.profile_name` *(optional)*

This specifies the name of the profile as a [`String`](/developers/api/data-types/index.md).



---
[Read in HTML](/developers/api/calendars/application-calendars/)