DESKIE API
Reports
Leaderboard

GET  |  https://[domain].deskie.io/api/stats_leaderboard.json
Statistics data from the "Leaderboard" subsection of the "Reports" section in the administrator account.

Time period

1) If you usually view statistics for standard periods in the administrator account, it makes sense to do the same via the API using the period parameter. In this situation, there is no need to determine the appropriate timestamp each time and worry about the data not matching what the administrator sees in their account.

2) When retrieving data for a custom time period using the from_time and to_time parameters, the minimum period that can be set is 1 hour, and the maximum is 3 months. If a request specifies a period that is too short or too long, an error will be returned in the response.

Caching

The number of cases, agents and associated statistical indices that need to be calculated can be quite large. Therefore, each request to this method does not lead to Deskie recalculating all the data from scratch. Depending on the specified period, a cache is used, which is stored for a certain time:
  • last_24_hours — 5 minutes cache lifetime;
  • last_7_days — 1 hour cache lifetime;
  • last_14_days — 1 hour cache lifetime;
  • last_30_days — 1 day cache lifetime;
  • today — 5 minutes cache lifetime;
  • yesterday — 1 day cache lifetime;
  • this_week — 1 day cache lifetime;
  • last_week — 1 week cache lifetime;
  • this_month — 1 day cache lifetime;
  • last_month — 1 month cache lifetime;
  • month_2 (if it's now 11.2023, data for 09.2023 is revealed) — 1 month cache lifetime;
  • month_3 (if it's now 11.2023, data for 08.2023 is revealed) — 1 month cache lifetime;
  • month_4 (if it's now 11.2023, data for 07.2023 is revealed) — 1 month cache lifetime;
  • month_5 (if it's now 11.2023, data for 06.2023 is revealed) — 1 month cache lifetime;
  • month_6 (if it's now 11.2023, data for 05.2023 is revealed) — 1 month cache lifetime;
  • 3_previous_months (three previous ones, excluding the current one) — 1 month cache lifetime;
  • 6_previous_months (six previous ones, excluding the current one) — 1 month cache lifetime;
  • this_year — 1 day cache lifetime;
  • last_year — 1 year cache lifetime;
  • custom period from one hour to one day — 1 hour cache lifetime;
  • custom period from one day — 1 day cache lifetime.

For example, if you want to receive up-to-date data for today to display it as a graph in the admin panel of your service, you can make a request to this method with the period=today parameter every 5-10 minutes. There is no point in executing requests more often, since you will receive cached data.
Parameters
Response

{
    "0": {
        "staff": {
            "staff_id": 42047,
            "staff_name": "John Snow",
            "new_cases_in_total": 21,
            "new_user_cases": 20,
            "reopened_cases": 2,
            "cases_being_handled": 25,
            "cases_with_a_response": 21,
            "first_response_time": 28, // in seconds
            "first_response_sla_violated": "0%", // first response SLA has been met
            "response_time": 49, // in seconds
            "response_sla_violated": "0%", // response SLA has been met
            "response_writing_time": 19, // in seconds
            "total_number_of_responses": 29,
            "total_number_of_notes": 8,
            "number_of_responses_for_resolution": 2,
            "closed_cases": 19,
            "resolution_time": 516, // in seconds
            "resolution_sla_violated": "0%", // resolution SLA has been met
            "ratings_of_responses": "-" // no satisfaction ratings were received
        }
    },
    "1": {
        "staff": {
            "staff_id": 50482,
            "staff_name": "Jack Sparrow",
            "new_cases_in_total": 58,
            "new_user_cases": 57,
            "reopened_cases": 7,
            "cases_being_handled": 103,
            "cases_with_a_response": 64,
            "first_response_time": 97,
            "first_response_sla_violated": "0%",
            "response_time": 80,
            "response_sla_violated": "0.9%",
            "response_writing_time": 38,
            "total_number_of_responses": 202,
            "total_number_of_notes": 18,
            "number_of_responses_for_resolution": 3,
            "closed_cases": 73,
            "resolution_time": 825,
            "resolution_sla_violated": "21.9%",
            "ratings_of_responses": "72%"
        }
    }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X GET "https://[domain].deskie.io/api/stats_leaderboard.json?period=this_month&channel=telegram&status=open&group_id=25403&priority=high&staff_id=all&labels=7152&initiator=user&user_id[]=2414276&user_id[]=2414389&company_id=74105&custom_fields[cf_7589]=0&custom_fields[cf_8621]=5
Agent statuses

GET  |  https://[domain].deskie.io/api/stats_staff_statuses.json
Get statistics on agent statuses.

Time period

1) If you usually view statistics for standard periods in the administrator account, it makes sense to do the same via the API using the period parameter. In this situation, there is no need to determine the appropriate timestamp each time and worry about the data not matching what the administrator sees in their account.

2) When retrieving data for a custom time period using the from_time and to_time parameters, the minimum period that can be set is 1 hour, and the maximum is 1 month. If a request specifies a period that is too short or too long, an error will be returned in the response.

Pagination

In one response to a request, 100 status changes are transmitted. If there were more of them during the selected period, to view the next page with the next 100 status changes, pass the page parameter.

The presence of the next page can be determined by the last_page=true/false parameter, which is present at the end of each response; last_page=true means you have reached the last page.
Parameters
Response

{
    "0": {
        "status_change": {
            "staff_id": 14,
            "timestamp": 1711615283,
            "from": "Online (1)",
            "to": "Offline (2)"
        }
    },
    "1": {
        "status_change": {
            "staff_id": 16,
            "timestamp": 1711615312,
            "from": "Online (1)",
            "to": "Lunch (113)"
        }
    },
    "2": {
        "status_change": {
            "staff_id": 11,
            "timestamp": 1711615358,
            "from": "Online (1)",
            "to": "Calls (104)"
        }
    },
    "3": {
        "status_change": {
            "staff_id": 14,
            "timestamp": 1711615361,
            "from": "Offline (2)",
            "to": "Online (1)"
        }
    },
    "last_page": true
}

Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X GET "https://[domain].deskie.io/api/stats_staff_statuses.json?from_time=01.09.2023&to_time=01.10.2023&staff_id=193&staff_access=full

Satisfaction ratings

GET  |  https://[domain].deskie.io/api/stats_satisfaction.json
Get a list of satisfaction ratings and user comments left on them.

Time period

1) If you usually view statistics for standard periods in the administrator account, it makes sense to do the same via the API using the period parameter. In this situation, there is no need to determine the appropriate timestamp each time and worry about the data not matching what the administrator sees in their account.

2) When retrieving data for a custom time period using the from_time and to_time parameters, the minimum period that can be set is 1 hour, and the maximum is 3 months. If a request specifies a period that is too short or too long, an error will be returned in the response.

Caching

The number of cases, agents and associated satisfaction ratings that need to be calculated can be quite large. Therefore, each request to this method does not lead to Deskie recalculating all the data from scratch. Depending on the specified period, a cache is used, which is stored for a certain time:
  • last_24_hours — 5 minutes cache lifetime;
  • last_7_days — 1 hour cache lifetime;
  • last_14_days — 1 hour cache lifetime;
  • last_30_days — 1 day cache lifetime;
  • today — 5 minutes cache lifetime;
  • yesterday — 1 day cache lifetime;
  • this_week — 1 day cache lifetime;
  • last_week — 1 week cache lifetime;
  • this_month — 1 day cache lifetime;
  • last_month — 1 month cache lifetime;
  • month_2 (if it's now 11.2023, data for 09.2023 is revealed) — 1 month cache lifetime;
  • month_3 (if it's now 11.2023, data for 08.2023 is revealed) — 1 month cache lifetime;
  • month_4 (if it's now 11.2023, data for 07.2023 is revealed) — 1 month cache lifetime;
  • month_5 (if it's now 11.2023, data for 06.2023 is revealed) — 1 month cache lifetime;
  • month_6 (if it's now 11.2023, data for 05.2023 is revealed) — 1 month cache lifetime;
  • 3_previous_months (three previous ones, excluding the current one) — 1 month cache lifetime;
  • 6_previous_months (six previous ones, excluding the current one) — 1 month cache lifetime;
  • this_year — 1 day cache lifetime;
  • last_year — 1 year cache lifetime;
  • custom period from one hour to one day — 1 hour cache lifetime;
  • custom period from one day — 1 day cache lifetime.

For example, if you want to receive up-to-date data for today to display it as a graph in the admin panel of your service, you can make a request to this method with the period=today parameter every 5-10 minutes. There is no point in executing requests more often, since you will receive cached data.
Parameters
Response

{
    "0": {
        "rating_id": 79,
        "rating": "3",
        "rating_comment": "cool123",
        "rated_staff_id": 193, // The agent ID is passed, if rating is associated with a certain 
                               // response of that agent, rather than assigned to the case as a whole
        "case_id": 47232,
        "case_number": "882-935664",
        "user_id": 222760,
        "staff_id": 193,
        "group_id": 318,
        "created_at": "Thu, 16 Jul 2020 15:00:35 +0300",
        "updated_at": "Thu, 16 Jul 2020 15:00:35 +0300"
    },
    "1": {
        "rating_id": 78,
        "rating": "2",
        "rating_comment": "",
        "rated_staff_id": 0, // 0 is passed, if rating is assigned to the case as a whole
        "case_id": 47223,
        "case_number": "898-213499",
        "user_id": 213381,
        "staff_id": 193, // agent who was assignee at the time the rating was assigned
        "group_id": 746,
        "created_at": "Thu, 16 Jul 2020 14:49:38 +0300",
        "updated_at": "Thu, 16 Jul 2020 14:54:50 +0300"
    },
    "total_count": 8
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -g "http://[domain].deskie.io/api/stats_satisfaction.json?from_time=2021-01-01&to_time=2021-31-01&user_id=213450&channel=sync&sort=added_at_asc"