Create a machine user
1
Add the machine user
Go to Settings → Machine users & API Keys and click Add machine user.
- Name: visible only to your team. Describe the agent, for example Support Agent.
- Public name: what customers see, for example Acme Support.
- Avatar: optional, shown next to messages.
2
Create an API key
Click Add API key and grant the permissions this agent needs. For a support agent that reads and replies:
thread:readthread:replygeneratedReply:createfor suggested repliesthread:assignandthread:unassignfor handoffscustomer:read
3
Use the API key
Send it as
Authorization: Bearer plainApiKey_your_api_key_here.Machine user ID
You need the ID in code, for example to check assignment. See routing. It is the last segment of the URL: Settings → Machine users & API Keys →/settings/machine-users/mu_…. Or load the machine user that owns the key with myMachineUser.
Reply as a team member
By default a reply from your agent shows the machine user’s public name. To have the agent reply as a specific team member instead, add them to the API key’s impersonation allow list, then passimpersonation.asUser to replyToThread.
The allow list belongs to the API key, not the machine user, and a key with an empty list can’t reply as anyone. Open the API key from the machine user’s page and, under Impersonation, add who it may reply as:
- individual team members
- everyone holding a built-in role: Owner, Admin or Support
- everyone holding a custom role
impersonationAllowList on createApiKey or updateApiKey, as userIds, roleIds (role_owner, role_admin or role_support) and customRoleIds. Setting it replaces the whole list, and updateApiKey also replaces permissions, so send the key’s full permission list alongside it.
