# Add members

> **EARLY ACCESS**

> **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
Adds people to a Managed Organizational Unit, or updates them if they've
already been added with the same `directory_user_id`.

When the customer connects their calendars through a service account, as
with [Enterprise Connect](https://docs.cronofy.com/developers/temporal-grid/connectivity/enterprise-connect/index.md), people
you add become members automatically.

Otherwise each person connects their own calendars, as with
[Individual Connect](https://docs.cronofy.com/developers/temporal-grid/connectivity/individual-connect/index.md). Send them
their `operation_urls.onboarding_url`, and they become a member of the Organizational Unit
once they've connected. Until then, their `status` is `pending`.

Authentication is with the access token for the Managed Organizational Unit,
returned when you
[provision](https://docs.cronofy.com/api-reference/managed-scheduling/managed-organizational-units/provision/index.md)
it. The Organizational Unit must be managed by your application.

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

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

{
  "directory_users": [
    {
      "directory_user_id": "user-1001",
      "email": "doc@example.com",
      "name": "Doc Brown"
    },
    {
      "directory_user_id": "user-1002",
      "email": "marty@example.com",
      "name": "Marty McFly"
    }
  ]
}
```

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

{
  "directory_users": [
    {
      "directory_user_id": "user-1001",
      "email": "doc@example.com",
      "name": "Doc Brown",
      "status": "member",
      "operation_urls": {
        "onboarding_url": "https://..."
      }
    },
    {
      "directory_user_id": "user-1002",
      "email": "marty@example.com",
      "name": "Marty McFly",
      "status": "pending",
      "operation_urls": {
        "onboarding_url": "https://..."
      }
    }
  ]
}
```

### 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](https://docs.cronofy.com/developers/data-centers/index.md).
##### `directory_users` *(required)*

The people to add or update [`Array`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md).
Must contain at least one person, and each `directory_user_id` can appear only once.

##### `directory_users.directory_user_id` *(required)*

Your application's identifier for the person, such as their user ID in your
system [`String`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md).

Adding a person again with the same `directory_user_id` updates their details.

##### `directory_users.email` *(required)*

The person's email address [`String`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md).

##### `directory_users.name` *(optional)*

The person's name [`String`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md).

Left unchanged when omitted.

### Response Parameters
##### `directory_users.directory_user_id`

Your application's identifier for the person
[`String`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md).

##### `directory_users.email`

The person's email address [`String`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md).

##### `directory_users.name`

The person's name, or `null` if none has been given
[`String`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md).

##### `directory_users.status`

Whether the person has joined the Organizational Unit
[`String`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md):

- `pending`: they haven't yet connected their calendars.

- `member`: they're a member of the Organizational Unit, either through the
customer's service account or by connecting their own calendars.

##### `directory_users.operation_urls.onboarding_url`

A link for the person to connect their own calendars, for customers who
don't connect through a service account
[`String`](https://docs.cronofy.com/api-reference/fundamentals/data-types/index.md).

Each link is valid for 48 hours. Add the person again to get a new one.

### Error responses
##### 401 Unauthorized

The request was refused as the provided
[authentication credentials](https://docs.cronofy.com/api-reference/authorization/authentication/index.md)
were not recognized.

When an OAuth `refresh_token` is available then it should be used to
[request a replacement access token](https://docs.cronofy.com/api-reference/authorization/organization-connect/refresh-token/index.md)
before the request is retried.

##### 403 Forbidden

The request was refused as the access token doesn't grant the
`organizational_unit_scheduling` scope.

##### 422 Unprocessable

The request was unable to be processed due to it containing invalid
parameters, or the Organizational Unit isn't managed by your application.



---
[Read in HTML](https://docs.cronofy.com/api-reference/managed-scheduling/managed-organizational-units/add-member/)