Get all team members

Fetch a list of all team members for your account
Written by Konstantine
Updated 1 year ago

You can get a list of all agents for your HelpCrunch account. Agents are the team member accounts that have access to your HelpCrunch account regardless of their roles and permissions.

You may need to use this method in order to get agent/assignee id for Update chat assignee method.


➡️ Request

URL https://api.helpcrunch.com/v1/agents
Method GET
Headers Authorization: Bearer <your_api_key>

Read more about authorization header here.


✅ Successful Response

If your request has succeeded, you'll get a 200 OK success status code together with the following response body.

{
    "data": [
        {
            "id": 2533,
            "name": "Alex",
            "email": "[email protected]",
            "role": "admin"
        },
        {
            "id": 4761,
            "name": "Nick Grachesku",
            "email": "[email protected]",
            "role": "agent"
        },
        {
            "id": 6694,
            "name": "Lisa",
            "email": "[email protected]",
            "role": "agentChatOnly"
        },
        {
            "id": 6679,
            "name": "Les",
            "email": "[email protected]",
            "role": "superviser"
        }
    ],
  "meta": {
   "total": 5
  }
}

You can get details on every Agent Object field in the Agent model article.

How to get all agents

By default, this method returns only the first 100 agents. To get a different set of agents, you should use the offset and limit parameters in the query string of the GET request.

Default limit is 100 and it can not be bigger than that. Default offset is 0

To page through all the available departments, first, use the meta section of the JSON response to get the total number of chats.

Send subsequent requests with increasing offsets and a fixed limit until you get all the data.  

https://api.helpcrunch.com/agents?offset=100&limit=100
https://api.helpcrunch.com/agents?offset=200&limit=100
https://api.helpcrunch.com/agents?offset=300&limit=100
...

The overall requests limit is 120 per minute

🛑 Error Responses

You may get one of the following error status codes and responses. More info on the errors is available here.

400 Bad Request

{
  "errors": [
    {
      "code": "invalid_request",
      "message": "Invalid request"
    },
    {
      "code": "customer",
      "message": "This value should be of type numeric."
    },
    {
      "code": "filter[0].field",
      "message": "This value should not be blank."
    }
  ]
}

401 Unauthorized

{
  "errors": [
    {
      "code": "invalid_request",
      "message": "Invalid request"
    },
    {
      "code": "unauthorized",
      "message": "Unauthorized"
    }
  ]
}

429 Too Many Requests

{
  "errors": [
    {
      "code": "invalid_request",
      "message": "Invalid request"
    },
    {
      "code": "too_many_requests",
      "message": "Too many requests"
    }
  ]
}

If you have any questions regarding the REST API, feel free to chat us any time.

👩‍💻 Happy Coding! 👨‍💻

Did this answer your question?