Provision a Managed Organizational Unit Early access

Read as Markdown

Early access program

This is in our early access program where we closely support organizations in their usage.

To have this enabled for your organization contact support@cronofy.com or your account manager.

Description #

Creates a Managed Organizational Unit, or updates it if your application has already provisioned one with the same organizational_unit_id, and returns an authorization for it.

The Managed Organizational Unit collects your customer’s connections to services such as their calendar and conferencing systems, the people you add as members, and everyone’s scheduling preferences. Your application solely controls its membership.

The authorization has the managed_organizational_unit scope. It allows everything organizational_unit_scheduling does, and reading and updating Selection Rules. Otherwise it’s equivalent to the customer authorizing your application through Organization Connect, and its access token is refreshed in the same way. If the authorization has been revoked, provisioning again creates a new one.

Authentication is with your application’s client_secret.

URL format #

{data_center_url}/v1/organizational_units

Example Request #

POST /v1/organizational_units HTTP/1.1
Host: {data_center_url}
Authorization: Bearer {CLIENT_SECRET}
Content-Type: application/json; charset=utf-8

{
  "organizational_unit_id": "customer-123",
  "name": "Hill Valley Futures",
  "default_locale": "en",
  "default_tzid": "America/Chicago",
  "callback_url": "https://example.com/cronofy/notifications"
}

Example Response #

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "organizational_unit": {
    "sub": "org_16c99459e89a32a08cdb6b2a",
    "organizational_unit_id": "customer-123",
    "name": "Hill Valley Futures",
    "default_locale": "en",
    "default_tzid": "America/Chicago",
    "callback_url": "https://example.com/cronofy/notifications"
  },
  "authorization": {
    "access_token": "{ACCESS_TOKEN}",
    "token_type": "bearer",
    "expires_in": 3600,
    "refresh_token": "{REFRESH_TOKEN}",
    "scope": "managed_organizational_unit",
    "sub": "org_16c99459e89a32a08cdb6b2a"
  }
}

200 OK is returned whether the Managed Organizational Unit was created or already existed.

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.

organizational_unit_id Required  #

A String containing your application’s identifier for the Managed Organizational Unit, such as the ID of the customer in your system.

It’s unique among the Managed Organizational Units your application manages in the data center. Provisioning again with the same organizational_unit_id updates the existing Managed Organizational Unit.

name Required  #

A String containing the name of the Managed Organizational Unit, typically your customer’s name.

Set to the value sent on every call.

default_locale Optional  #

A String containing the default locale for the Managed Organizational Unit, such as en or fr.

Defaults to en when the Managed Organizational Unit is created. Left unchanged when omitted.

Supported locales:

  • ar Arabic
  • cs Czech
  • cy Welsh
  • de German
  • en US English (default)
  • es Spanish
  • fr French
  • fr-CA Canadian French
  • he Hebrew
  • it Italian
  • ja Japanese
  • nl Dutch
  • pl Polish
  • pt-BR Brazilian Portuguese
  • ro Romanian
  • ru Russian
  • sv Swedish
  • tr Turkish
  • zh-CN Simplified Chinese

default_tzid Optional  #

A String representing the default time zone for the Managed Organizational Unit, as an identifier from the IANA Time Zone Database such as America/Chicago.

Left unchanged when omitted. If it has never been set, the data center’s default time zone is used.

callback_url Optional  #

A String containing the URL Cronofy sends webhooks to for the Managed Organizational Unit, such as those about its members and Scheduling Requests.

It must be an http or https URL that’s reachable from the internet. Left unchanged when omitted. Pass null to stop sending webhooks.

Response Parameters #

organizational_unit.sub  #

A String containing Cronofy’s identifier for the Managed Organizational Unit.

organizational_unit.organizational_unit_id  #

A String containing your application’s identifier for the Managed Organizational Unit.

organizational_unit.name  #

A String containing the name of the Managed Organizational Unit.

organizational_unit.default_locale  #

A String containing the default locale.

organizational_unit.default_tzid  #

A String containing the default time zone identifier.

organizational_unit.callback_url  #

A String containing the URL webhooks are sent to, or null if none.

authorization.access_token  #

A String containing the access token for calling the API on behalf of the Managed Organizational Unit.

authorization.token_type  #

A String, always bearer.

authorization.expires_in  #

An Integer number of seconds until the access token expires.

authorization.refresh_token  #

A String containing the refresh token for getting a new access token with Refresh an Access Token.

Provisioning again also returns a valid access token.

authorization.scope  #

A String containing the scopes granted, separated by spaces. Includes managed_organizational_unit.

authorization.sub  #

A String containing Cronofy’s identifier for the Managed Organizational Unit.

Error responses #

401 Unauthorized #

The request was refused as the client_secret wasn’t recognized.

402 Payment Required #

The request was refused as your plan doesn’t include Managed Organizational Units.

403 Forbidden #

The request was refused as it was made by an Internal Application.

422 Unprocessable #

The request was unable to be processed due to it containing invalid parameters.

The response contains a JSON object with one or more errors for the invalid parameters. For example, omitting the required name parameter returns:

{
  "errors": {
    "name": [
      {
        "key": "errors.required",
        "description": "required"
      }
    ]
  }
}

The key is intended for programmatic use, and the description is a human-readable equivalent.