Skip to content

Agents & Teams

Agents are users with the agent type — they sign in, handle conversations, and have permissions via roles. Teams are agent groupings, used for team-based assignment and team-inbox routing.

Current agent (self-service)

These endpoints act on the authenticated caller. No permission required beyond being logged in.

MethodPath
GET/api/v1/agents/me
PUT/api/v1/agents/me
GET/api/v1/agents/me/teams
PUT/api/v1/agents/me/availability
DELETE/api/v1/agents/me/avatar
POST/api/v1/agents/me/push-token
DELETE/api/v1/agents/me/push-token

Get current agent

GET /api/v1/agents/me

Returns the full agent record + their permissions + their teams.

Response:

json
{
  "data": {
    "id": 17,
    "first_name": "Bob",
    "last_name": "Smith",
    "email": "bob@example.com",
    "avatar_url": "…",
    "type": "agent",
    "availability": "online",
    "country": "AU",
    "roles": ["admin"],
    "permissions": [
      "conversations:read_all", "messages:write", "users:manage", 
    ],
    "teams": [{ "id": 3, "name": "Support" }]
  }
}

Update current agent

PUT /api/v1/agents/me

Body:

json
{
  "first_name": "Bob",
  "last_name": "Smith",
  "email": "bob@example.com",
  "avatar_url": "…",
  "country": "AU"
}

Field-level partial updates — only provided fields are touched.

Update availability

PUT /api/v1/agents/me/availability

Body:

json
{ "availability": "online" }

Allowed values: online, away, offline. Drives the green/yellow/grey dot on agent avatars across the app.

Push notifications (mobile)

POST   /api/v1/agents/me/push-token   { "token": "...", "platform": "ios" }
DELETE /api/v1/agents/me/push-token

Register / unregister a device push token. Used by the mobile app to receive new-message notifications when backgrounded.

Lightweight directory

GET /api/v1/agents/compact    authenticated
GET /api/v1/teams/compact     authenticated

Returns [{ id, name }] for every agent or team — used by the assignee/team picker dropdowns. Lighter than the full list endpoints below and accessible to any authenticated user.

Agent management

MethodPathPermission
GET/api/v1/agentsusers:manage
GET/api/v1/agents/{id}users:manage
POST/api/v1/agentsusers:manage
PUT/api/v1/agents/{id}users:manage
DELETE/api/v1/agents/{id}users:manage

List agents

GET /api/v1/agents

Standard pagination. Returns the directory.

Create agent

POST /api/v1/agents

Body:

json
{
  "first_name": "Alice",
  "last_name": "Agent",
  "email": "alice@example.com",
  "roles": ["agent"],
  "teams": [3],
  "send_welcome_email": true
}

If send_welcome_email is true, the new agent gets a reset-password link and can set their own password. Otherwise, an admin must invoke set-password manually.

Update agent

PUT /api/v1/agents/{id}

Same body shape as create. All fields optional. Setting roles to an empty array removes all roles.

Delete agent

DELETE /api/v1/agents/{id}

Soft-delete — the agent's conversations stay, but they can no longer sign in. Audit log entries retain the original author.

Agent import

MethodPathPermission
POST/api/v1/agents/importusers:manage
GET/api/v1/agents/import/statususers:manage

Bulk-import agents from a CSV. The import runs async — import/status returns the running/completed/errored count.

Import body (multipart):

FieldTypeNotes
filefileCSV with header row email,first_name,last_name,roles,teams. Roles + teams are comma-separated names within each cell.

API keys

MethodPathPermission
POST/api/v1/agents/{id}/api-keyusers:manage
DELETE/api/v1/agents/{id}/api-keyusers:manage

Generate API key

POST /api/v1/agents/{id}/api-key

Provisions a new API key for the target agent. The plaintext key is returned only once in this response — it's stored hashed in the database and cannot be retrieved later.

Response:

json
{
  "data": {
    "api_key": "lk_abc123def456…",
    "created_at": "…"
  }
}

Subsequent requests use it as Authorization: Bearer lk_….

Revoke API key

DELETE /api/v1/agents/{id}/api-key

Invalidates the agent's API key. Future requests with the old key return 401 AuthError.

One key per agent

Each agent has at most one active API key. Generating a new one revokes the previous. If you need per-device keys, use the Google Mobile Auth endpoint, which issues device-bound keys.

Password reset

MethodPathAuthRate-limit
POST/api/v1/agents/reset-passwordnone (try-auth)per-IP
POST/api/v1/agents/set-passwordreset tokenper-IP

Request a reset

POST /api/v1/agents/reset-password
{ "email": "agent@example.com" }

Always returns 200 — never reveals whether the email exists. If a matching agent exists, an email is sent with a reset link.

Set the new password

POST /api/v1/agents/set-password
{ "token": "…", "password": "new-strong-password" }

The token comes from the reset email. On success, the agent can sign in immediately.

Teams

MethodPathPermission
GET/api/v1/teamsteams:manage
GET/api/v1/teams/{id}teams:manage
POST/api/v1/teamsteams:manage
PUT/api/v1/teams/{id}teams:manage
DELETE/api/v1/teams/{id}teams:manage

Create team

POST /api/v1/teams

Body:

json
{
  "name": "Support",
  "emoji": "🛟",
  "members": [17, 42]
}

members is an array of agent IDs. Updating later replaces the full member set.

Delete team

DELETE /api/v1/teams/{id}

Unassigns the team from all conversations first, then deletes. Cannot be undone.

Released under AGPL-3.0. HelperIQ is a fork of LibreDesk.