logo
Development
Search
Get Agent Escalation Rate

Get Agent Escalation Rate

Retrieve the number of sessions, the number of sessions escalated to human agents, and the escalation rate for a specific Agent within a time period. The methodology is consistent with the console's "Agent Insights → Escalation Rate".

Note: You can query up to 92 days of data; only channels in the development workspace are included. For the statistical scope, see "Statistical Methodology" below.

Request Method

GET

API Endpoint

https://api-${endpoint}.gptbots.ai/v1/org/agent/stat/human-handoff

Authentication

Use Basic authentication with an account-level DevKey / DevSecret: Authorization: Basic ${BASIC_TOKEN}, where ${BASIC_TOKEN} is the Base64 encoding of DevKey:DevSecret.

  • The calling account must be a member of the organization corresponding to org_id and have "View Usage" permissions (Owners and Admins have it by default), and must be able to access the Agent: the Agent creator, the organization Owner, or members granted permissions for this Agent (or all Agents).
  • Please call the endpoint in the data center where your organization is located. ${endpoint} should be set to the region returned by Query Organization List (SG → sg, TH → th, JP → jp). Calling from another data center will return "Not a member of this organization".

Rate Limit

  • Each developer key can call this API up to 60 times per minute.
  • Each call counts toward the organization's package "Statistics API" per-minute quota, shared with Agent API Key calls to statistics APIs.
  • Query results are cached for 10 minutes. It is recommended to call once per hour.

Request

Request Example

curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/org/agent/stat/human-handoff?org_id=${org_id}&agent_id=${agent_id}&start_time=1788192000000&end_time=1790784000000' \ -H 'Authorization: Basic ${BASIC_TOKEN}'
                      
                      curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/org/agent/stat/human-handoff?org_id=${org_id}&agent_id=${agent_id}&start_time=1788192000000&end_time=1790784000000' \
  -H 'Authorization: Basic ${BASIC_TOKEN}'

                    
This code block in the floating window

Request Header

Field Type Description
Authorization Basic ${BASIC_TOKEN} Use the Basic Token after Base64 encoding DevKey:DevSecret.

Request Parameters

Field Type Required Description
org_id String Yes Organization ID.
agent_id String Yes Agent ID. Workflow is not supported.
start_time Long Yes Start time, in milliseconds timestamp. Extend to 0:00 of the day according to organization timezone.
end_time Long Yes End time (exclusive), in milliseconds timestamp. Consider the last day as the natural day of the previous millisecond in organization timezone. The date range can span up to 92 days.

Response

Response Example

{ "code": 0, "message": "OK", "data": { "agent_id": "65f0c2a1b4e8d93a1c7e5b21", "timezone": "+08:00", "range_start_date": "2026-09-01", "range_end_date": "2026-09-29", "data_until": 1790665200000, "conversation_count": 1200, "handoff_conversation_count": 96, "handoff_rate": 0.0800 } }
                      
                      {
    "code": 0,
    "message": "OK",
    "data": {
        "agent_id": "65f0c2a1b4e8d93a1c7e5b21",
        "timezone": "+08:00",
        "range_start_date": "2026-09-01",
        "range_end_date": "2026-09-29",
        "data_until": 1790665200000,
        "conversation_count": 1200,
        "handoff_conversation_count": 96,
        "handoff_rate": 0.0800
    }
}

                    
This code block in the floating window

Successful Response

Field Type Description
agent_id String Agent ID.
timezone String Organization timezone (UTC offset, e.g., +08:00), indicating which timezone the dates are split by.
range_start_date String Actual start date for statistics yyyy-MM-dd (organization timezone, inclusive).
range_end_date String Actual end date for statistics yyyy-MM-dd (organization timezone, inclusive).
data_until Long Time until which data is counted (milliseconds timestamp): if there are real-time calculated dates in the range, it represents the calculation time for the real-time part (results cached for up to 10 minutes); if the entire range has completed daily statistics, it represents the end of the range.
conversation_count Long Number of conversations that occurred within the range (cumulative by day).
handoff_conversation_count Long Number of conversations transferred to human agents.
handoff_rate Number Handoff rate = handoff_conversation_count ÷ conversation_count, range 0 to 1, rounded to 4 decimal places; if conversation count is 0, value is null.

Failed Response

Field Type Description
code Integer Error code.
message String Error details.

Error Codes

The HTTP status code corresponds to the first three digits of the error code, for example, 40000 corresponds to 400, 40100 corresponds to 401, 403132 corresponds to 403.

Error Code Description
40000 Parameter error, such as missing required parameters or invalid parameter values.
40001 Too many requests: The developer key has exceeded the per-minute limit for this API.
40008 Exceeded the per-minute quota for the organization's plan "Statistics API."
40010 The API is temporarily closed, please try again later.
40100 No permission: Missing usage view permission, or no authority to view this Agent (including the Agent not belonging to this organization).
40105 Not a member of this organization, or called the address of a different data center.
40324 DevKey or DevSecret is incorrect.
40378 Agent has been deleted.
403132 Invalid time range: start time is not earlier than end time, or exceeds the maximum query range.

Statistical Caliber

  • Number of sessions: The number of sessions that had conversations each day, accumulated daily; sessions that continue across days are counted once for each day.
  • Number of human-transferred sessions: The number of sessions that were transferred to a human agent.
  • Statistical scope: Only counts channels in the development space, including API, share pages, web embeds, bubble components, LiveDesk, and various instant messaging and phone channels; does not include usage after the Agent is published to a workspace.
  • Update frequency: Dates with completed daily statistics read daily statistics; calculated in real-time for the current day. Daily statistics are generated by the statistical task after midnight in the organization’s time zone. Before generation is complete, the previous day is also calculated in real-time, so there will not be a situation where "yesterday" after midnight is 0.
  • Caliber of real-time part: Counted based on the time of the latest conversation of the session. Sessions that continue across days are only counted once in the real-time part (counted on the day of the latest conversation), which may have slight differences from the daily statistics accumulated by day.