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

# Synchronize branches

> Register CRM branches and use their external identifiers when starting SSO.

Every Social Trading user belongs to a branch. The CRM retains its own identifier, and ExuraCopy maps it to the environment configuration.

## Synchronize a branch

Use the same `id` that identifies the branch in the CRM.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://social-api.example.com/api/v1/branches/sync" \
  -H "Authorization: Bearer YOUR_CRM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": 27,
    "external_provider": "CRM",
    "name": "Latam",
    "branch_uuid": "9f217928-ef50-4eb7-8849-299024236acd"
  }'
```

| Field | Required | Description |
| - | - | - |
| `id` | Yes | Stable CRM branch ID. Use `0` for the default branch agreed with ExuraCopy. |
| `external_provider` | Recommended | Source identifier. Use `CRM` for this integration. |
| `name` | Yes | Display name of the branch. |
| `branch_uuid` | No | External UUID, when available in the CRM. |

## Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": 42,
  "name": "Latam",
  "branch_uuid": "9f217928-ef50-4eb7-8849-299024236acd",
  "created_at": "2026-08-20T14:30:00Z",
  "updated_at": "2026-08-20T14:30:00Z",
  "external_provider": "CRM",
  "external_branch_id": 27
}
```

> [!NOTE]
>
> The response field `id` identifies the branch within ExuraCopy. For SSO requests, retain and send your CRM ID, returned as `external_branch_id`.

Synchronization is repeatable: sending the same `external_provider` and `id` combination again updates its data without creating another branch.

## Use the branch in SSO

After synchronizing the branch, send its external ID with every SSO request:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "external_reference": "crm-user-127",
  "email": "cliente@example.com",
  "external_provider": "CRM",
  "branch_id": 27
}
```

An unknown branch produces a `422` response. Do not replace the CRM ID with the internal `id` returned by ExuraCopy.

> [!WARNING]
>
> Before sending branches for existing users, ask ExuraCopy Support to migrate the environment and wait for confirmation.

> [card] [Previous: Authentication](https://crm-social.exuratech.com/getting-started/authentication.md)
>
> Review credentials and environments.

> [card] [Next: Create an SSO session](https://crm-social.exuratech.com/guides/sso.md)
>
> Assign the branch when creating or linking a user.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.