Sync Clerk Members

Sync your organization's Clerk members as agent profiles in LeadHQL.

Synchronize your organization's Clerk members to automatically create or update agent profiles in LeadHQL. This ensures your agent directory stays in sync with your team.

Endpoint

POST /agents/sync

Authentication: Required (JWT)

What It Does

The sync operation:

  1. Fetches all current members of your Clerk organization
  2. For each member, creates an agent record if one doesn't exist, or updates the existing record with the latest name and avatar from Clerk
  3. Links each agent to the corresponding Clerk user ID

This is useful after adding new team members to your organization — run a sync to automatically create their agent profiles without manually entering their details.

Example

curl -X POST https://api.leadhql.com/agents/sync \
  -H "Authorization: Bearer <jwt-session-token>"

Response

Returns the list of synced agent records:

[
  {
    "id": "a1b2c3d4-...",
    "clerkUserId": "user_2abc123def456",
    "firstName": "Sarah",
    "lastName": "Johnson",
    "avatarUrl": "https://img.clerk.com/...",
    "isActive": true,
    "organizationId": "org-uuid-...",
    ...
  },
  {
    "id": "e5f6a7b8-...",
    "clerkUserId": "user_2xyz789ghi012",
    "firstName": "Miguel",
    "lastName": "Fernández",
    "avatarUrl": "https://img.clerk.com/...",
    "isActive": true,
    "organizationId": "org-uuid-...",
    ...
  }
]

When to Use

  • After inviting new team members to your organization
  • After team members update their Clerk profile (name, avatar)
  • As part of an onboarding flow to populate the agent directory

The sync is idempotent — running it multiple times is safe and will only update records that have changed.

LeadHQL Help

Docs & support

Hi there, how can we help?

Browse popular articles or ask a question below.

Popular articles

Or ask a question