> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kaisupport.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sync account owners

> Push a book of business from your CRM into Kai.

This guide loads a list of customers and the teammate that owns each one.

## 1. Map your users to Kai members

Kai accepts an email address as an owner, so you do not need the member ids.
Read the roster first to find the people that your list names but your
workspace does not hold:

```bash theme={null}
curl https://kaisupport.com/api/v1/members \
  -H "Authorization: Bearer $KAI_API_KEY"
```

```json theme={null}
{
  "data": [
    { "id": "2c9a0d51-...", "name": "Baran Demir", "email": "baran@example.com", "role": "Manager" }
  ]
}
```

This key needs the `members:read` permission.

<Note>
  Membership is read-only here. To invite or remove a teammate, use Kai, under
  **Settings → People**.
</Note>

## 2. Assign in batches

```bash theme={null}
curl -X POST https://kaisupport.com/api/v1/contacts/batch \
  -H "Authorization: Bearer $KAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operations": [
      { "op": "assign", "external_id": "DK-1042", "owner": "baran@example.com" },
      { "op": "assign", "external_id": "DK-1043", "owner": "selin@example.com" },
      { "op": "assign", "external_id": "DK-1044", "owner": null }
    ]
  }'
```

An `owner` of `null` returns the contact to the shared pool.

An email address that no member holds fails that one operation:

```json theme={null}
{
  "index": 1,
  "op": "assign",
  "status": "error",
  "error": { "type": "invalid_request", "message": "No workspace member matches \"selin@example.com\"." }
}
```

## 3. Decide about the open conversations

By default an assignment through the API does not move the open conversations
of that customer. The new owner receives the next conversation.

To move the open conversations as well, add
`"reassign_open_conversations": true` to the operation. Use it for a real
handover, for example when a teammate leaves.

```json theme={null}
{ "op": "assign", "external_id": "DK-1042", "owner": "selin@example.com", "reassign_open_conversations": true }
```

Closed conversations and archived conversations never move.

## 4. Repeat the sync every night

The assign operation is safe to repeat. An assignment that does not change
writes the same owner again and moves nothing.

Keep `reassign_open_conversations` at its default for a nightly job. With it
on, every run moves every live conversation of every customer to the owner,
including the conversations that a manager gave to somebody else that morning.
