---
name: "directory_sync_from_hr"
area: "directory"
title: "Bring the directory in line with HR"
price: "$0.01"
method: "POST"
url: "https://api.conecto.chat/v1/tools/directory_sync_from_hr"
mcp_server: "https://api.conecto.chat/mcp/directory"
auth: "Authorization: Bearer <conecto_sk_ key>"
docs_url: "https://conecto.chat/tools/directory/directory_sync_from_hr"
---

# Bring the directory in line with HR (`directory_sync_from_hr`)

Sets titles and departments in the directory as HR has them; dry_run shows the plan first.

Compare HR's people (hr area) with the directory by work email and set titles and departments (and managers, with include_managers) as HR has them. With suspend_leavers, people HR says have left are suspended too. dry_run (the default) only shows the plan.

Price: $0.01 a call. A call that fails costs nothing.

## Use it when

Every night, or after HR records changed, so the directory follows HR.

- For one person, use [directory_update_user](https://conecto.chat/tools/directory/directory_update_user.md).

## Say this to your agent

> Make the directory match HR, and show me what would change first.

## Inputs

| Name | Type | Required | Description | Allowed values | Default |
|---|---|---|---|---|---|
| `dry_run` | boolean | no |  |  | `true` |
| `suspend_leavers` | boolean | no |  |  | `false` |
| `include_managers` | boolean | no |  |  | `false` |

## Example

Written for Hansen & Voss, a restaurant-equipment wholesaler in Hamburg with 60 staff.

MCP: call `directory_sync_from_hr` on the MCP server `https://api.conecto.chat/mcp/directory` with these arguments:

```json
{
  "dry_run": true
}
```

REST:

```bash
curl https://api.conecto.chat/v1/tools/directory_sync_from_hr \
  -H "Authorization: Bearer $CONECTO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dry_run": true}'
```

## Response

```json
{
  "call_id": "5f0c8a2e-3b7d-4c1e-9a64-2d8e1f7b0c93",
  "tool": "directory_sync_from_hr",
  "status": "succeeded",
  "replayed": false,
  "cost_usd": "$0.01",
  "balance_usd": "$19.75",
  "result": {
    "dry_run": true,
    "changes": [
      {
        "person": "Lena Brandt",
        "email": "lena.brandt@hansenvoss.example",
        "user_id": "00u1",
        "changes": {
          "title": "Support lead",
          "department": "Customer care"
        }
      }
    ],
    "would_suspend": [],
    "leavers_still_active": []
  }
}
```

`result`: dry_run; changes: each person with what would change; would_suspend or suspended; leavers_still_active: people HR says have left who can still sign in.

## Errors

| Code | Status | When | Fix |
|---|---|---|---|
| `not_connected` | 409 | No directory is connected yet. | Connect Entra ID or Okta with directory_connect. |
| `directory_rejected` | 502 | The directory refused, usually because a permission is missing. | Ask its admin to grant what the message names. |
| `directory_unavailable` | 503 | The directory could not be reached. | Try again in a minute; nothing changed. |

The refusals every tool can give (401 key, 402 balance, 429 limits) are on the errors page: https://conecto.chat/docs/errors.md

## Related

- [directory_connect](https://conecto.chat/tools/directory/directory_connect.md): Connects the company's Microsoft Entra ID or Okta, checked by reading one person. $0.001 a call.
- [directory_list_users](https://conecto.chat/tools/directory/directory_list_users.md): People in the directory with their name, email, title, department and whether they can sign in. Free up to 1,000,000 reads a month.
- [directory_get_user](https://conecto.chat/tools/directory/directory_get_user.md): One person in the directory by id or email. Free up to 1,000,000 reads a month.
- [directory_list_groups](https://conecto.chat/tools/directory/directory_list_groups.md): The directory's groups with their id, name and description. Free up to 1,000,000 reads a month.
- [directory_create_user](https://conecto.chat/tools/directory/directory_create_user.md): Opens a joiner's account with their title, department and groups; no password passes Conecto. $0.25 a call.
- [directory_update_user](https://conecto.chat/tools/directory/directory_update_user.md): Changes a person's title, department or manager in the directory. $0.01 a call.
- [directory_set_groups](https://conecto.chat/tools/directory/directory_set_groups.md): Adds a person to groups and takes them out of others. $0.01 a call.
- [directory_suspend_user](https://conecto.chat/tools/directory/directory_suspend_user.md): Blocks a leaver's sign-in and ends their sessions, after the owner approves by default. $0.25 a call.
- [directory_restore_user](https://conecto.chat/tools/directory/directory_restore_user.md): Lets a suspended person sign in again. $0.001 a call.
- [directory_disconnect](https://conecto.chat/tools/directory/directory_disconnect.md): Forgets the directory's credentials; nothing in the directory changes. Free.
