> ## Documentation Index > Fetch the complete documentation index at: https://developer.rocket.chat/llms.txt > Use this file to discover all available pages before exploring further. # Get History of Agents Available for Service >
Enterprise
Return the list of agents and their available time for the provided time frame. Permission required: `view-livechat-manager` ## OpenAPI ````json GET /api/v1/livechat/analytics/agents/available-for-service-history { "openapi": "3.0.0", "info": { "version": "1.0.0", "title": "Omnichannel" }, "servers": [ { "url": "https://apiexplorer.support.rocket.chat" } ], "tags": [ { "name": "Omnichannel Users" }, { "name": "Omnichannel Agents" }, { "name": "Omnichannel Monitors" }, { "name": "Omnichannel Visitors" }, { "name": "Omnichannel Contacts" }, { "name": "Omnichannel Rooms" }, { "name": "Omnichannel Departments" }, { "name": "Omnichannel Custom Fields" }, { "name": "Omnichannel Business Hours" }, { "name": "Omnichannel Priorities" }, { "name": "Omnichannel Tags" }, { "name": "Omnichannel Units" }, { "name": "SLA Policies" }, { "name": "Canned Responses" }, { "name": "Omnichannel Transcript" }, { "name": "Omnichannel Statistics" }, { "name": "Omnichannel Agent Stats" }, { "name": "Omnichannel Dashboards" }, { "name": "Reports" }, { "name": "Omnichannel Inquiries" }, { "name": "Omnichannel Webhooks" }, { "name": "Livechat" }, { "name": "Livechat Appearance" }, { "name": "Livechat Triggers" }, { "name": "Livechat Messages" }, { "name": "Livechat Page Visited" } ], "paths": { "/api/v1/livechat/analytics/agents/available-for-service-history": { "get": { "tags": [ "Omnichannel Agent Stats" ], "summary": "Get History of Agents Available for Service", "description": "
\"Enterprise\"
\n\nReturn the list of agents and their available time for the provided time frame.\nPermission required: `view-livechat-manager`", "operationId": "get-api-v1-livechat-analytics-agents-available-for-service-history", "parameters": [ { "$ref": "#/components/parameters/AuthToken" }, { "$ref": "#/components/parameters/UserId" }, { "$ref": "#/components/parameters/start" }, { "$ref": "#/components/parameters/end" }, { "name": "fullReport", "in": "query", "description": "If set to true, it shares the service history which will contain more granular data such as the time of the day the agent was available.", "schema": { "type": "boolean" }, "example": true }, { "$ref": "#/components/parameters/offset" }, { "$ref": "#/components/parameters/count" } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "agents": { "type": "array", "items": { "type": "object", "properties": { "serviceHistory": { "type": "array", "items": { "type": "object", "properties": { "startedAt": { "type": "string" }, "stoppedAt": { "type": "string" } } } }, "availableTimeInSeconds": { "type": "integer" }, "username": { "type": "string" } } } }, "count": { "type": "integer" }, "offset": { "type": "integer" }, "total": { "type": "integer" }, "success": { "type": "boolean" } } }, "examples": { "Success Example": { "value": { "agents": [ { "serviceHistory": [ { "startedAt": "2021-11-24T08:35:49.058Z", "stoppedAt": "2021-11-24T08:41:32.721Z" }, { "startedAt": "2021-11-24T08:51:15.623Z", "stoppedAt": "2021-11-24T08:53:59.707Z" }, { "startedAt": "2021-11-24T08:55:45.128Z", "stoppedAt": "2021-11-24T08:55:45.214Z" }, { "startedAt": "2021-11-24T16:56:35.486Z", "stoppedAt": "2021-11-24T17:05:56.611Z" }, { "startedAt": "2021-11-24T17:20:26.066Z", "stoppedAt": "2021-11-24T18:29:59Z" } ], "availableTimeInSeconds": 2115334, "username": "doe.john" }, { "serviceHistory": [ { "startedAt": "2022-02-06T09:45:26.476Z", "stoppedAt": "2022-02-06T09:45:27.499Z" }, { "startedAt": "2022-02-06T09:45:28.083Z", "stoppedAt": "2022-02-06T09:45:28.663Z" }, { "startedAt": "2022-02-06T09:45:29.117Z", "stoppedAt": "2022-02-06T09:45:29.672Z" }, { "startedAt": "2022-02-06T09:45:30.129Z", "stoppedAt": "2022-02-06T09:45:30.534Z" }, { "startedAt": "2022-02-06T09:45:30.923Z", "stoppedAt": "2022-02-06T09:45:31.714Z" }, { "startedAt": "2022-02-06T09:45:39.037Z", "stoppedAt": "2022-02-06T09:45:41.68Z" } ], "availableTimeInSeconds": 7586, "username": "white.chris" }, { "serviceHistory": [ { "startedAt": "2021-12-27T13:25:44.459Z", "stoppedAt": "2021-12-27T13:27:11.208Z" } ], "availableTimeInSeconds": 1508, "username": "max.yui" } ], "count": 3, "offset": 0, "total": 3, "success": true } } } } } }, "400": { "$ref": "#/components/responses/startendError" }, "401": { "$ref": "#/components/responses/authorizationError" }, "403": { "$ref": "#/components/responses/permissionError" } } } } }, "components": { "parameters": { "AuthToken": { "name": "X-Auth-Token", "in": "header", "description": "The `authToken` of the authenticated user.", "required": true, "schema": { "type": "string" }, "example": "RScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f" }, "UserId": { "name": "X-User-Id", "in": "header", "description": "The `userId` of the authenticated user.", "required": true, "schema": { "type": "string" }, "example": "rbAXPnMktTFbNpwtJ" }, "start": { "name": "start", "in": "query", "description": "The start date.", "required": true, "schema": { "type": "string" }, "example": "2020-09-10T23:59:22.345Z" }, "end": { "name": "end", "in": "query", "description": "The end date.", "required": true, "schema": { "type": "string" }, "example": "2020-09-09T00:11:22.345Z" }, "offset": { "name": "offset", "in": "query", "required": false, "schema": { "type": "integer" }, "example": 50, "description": "Number of items to \"skip\" in the query, i.e. requests return count items, skipping the first offset items. Refer to the [official documentation](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more." }, "count": { "name": "count", "in": "query", "required": false, "schema": { "type": "integer" }, "example": 25, "description": "The number of items to return. Refer to the [official documentation](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more." } }, "responses": { "startendError": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "error": { "type": "string" }, "errorType": { "type": "string" } } }, "examples": { "Example 1": { "value": { "success": false, "error": "must have required property 'start' [invalid-params]", "errorType": "invalid-params" } }, "Example 2": { "value": { "success": false, "error": "The \"start\" query parameter must be a valid date." } }, "Example 3": { "value": { "success": false, "error": "must have required property 'end' [invalid-params]", "errorType": "invalid-params" } }, "Example 4": { "value": { "success": false, "error": "The \"end\" query parameter must be a valid date." } } } } } }, "authorizationError": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string" }, "message": { "type": "string" } } }, "examples": { "Authorization Error": { "value": { "status": "error", "message": "You must be logged in to do this." } } } } } }, "permissionError": { "description": "Forbidden", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "error": { "type": "string" } } }, "examples": { "Permission Error": { "value": { "success": false, "error": "User does not have the permissions required for this action [error-unauthorized]" } }, "Unauthorized": { "value": { "success": false, "error": "unauthorized" } } } } } } } } } ````