logo
Development
Search
Get Organization Usage Summary

Get Organization Usage Summary

Retrieve the total credits consumption, new session count, and user query count of an organization over a time interval, and expand it by Agent / Workflow with pagination. A single call can obtain data for all Agents under the organization, without needing to call each Agent individually.

Note: You can query up to 31 days of data; only development spaces are counted. See "Statistical Scope" below for details.

Request Method

GET

Endpoint

https://api-${endpoint}.gptbots.ai/v1/org/stat/summary

Authentication

Use account-level DevKey / DevSecret with Basic authentication: 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 "Usage View" permission (organization Owner and Administrators have it by default).
  • Please call the address of the data center where the organization is located. ${endpoint} should be the region returned by Query Organization List (SG → sg, TH → th, JP → jp). Calls to other data centers will return "Not a member of this organization."

Call Frequency

  • Each developer key can call this endpoint up to 60 times per minute.
  • Each call also counts toward the organization plan's "Usage API" per-minute quota, shared with Agent API Key calls to usage APIs.
  • Queries including today or yesterday are cached for 5 minutes; results for earlier dates are cached for 1 hour. It is recommended to call the API every 5 to 15 minutes.

Request

Request Example

curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/org/stat/summary?org_id=${org_id}&start_time=1792425600000&end_time=1795017600000&page=1&page_size=20' \ -H 'Authorization: Basic ${BASIC_TOKEN}'
                      
                      curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/org/stat/summary?org_id=${org_id}&start_time=1792425600000&end_time=1795017600000&page=1&page_size=20' \
  -H 'Authorization: Basic ${BASIC_TOKEN}'

                    
This code block in the floating window

Request Headers

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.
start_time Long Yes Start time, in milliseconds. Extend to 0:00 of the day according to the organization timezone.
end_time Long Yes End time (exclusive), in milliseconds. Use the natural day of the previous millisecond according to the organization timezone as the last day. The start and end dates can span a maximum of 31 days.
agent_type String No Expand only one type: AGENT or WORKFLOW; if not provided, both types are listed. Only affects the agents list, does not affect total.
page Integer No Page number, starting from 1, default 1, maximum 10000.
page_size Integer No Number of items per page, default 20, maximum 100.

Response

Response Example

{ "code": 0, "message": "OK", "data": { "org_id": "65f0c2a1b4e8d93a1c7e5b20", "timezone": "+07:00", "range_start_date": "2026-10-16", "range_end_date": "2026-11-14", "data_since": "2026-10-15", "data_until": 1794614400000, "total": { "credits": 1234.5678, "unattributed_credits": 36.2011, "conversation_count": 5210, "message_count": 48213 }, "agents": { "page": 1, "page_size": 20, "total": 86, "list": [ { "agent_id": "65f0c2a1b4e8d93a1c7e5b21", "name": "客服助手", "agent_type": "AGENT", "credits": 402.1200, "conversation_count": 2104, "message_count": 19820 }, { "agent_id": "65f0c2a1b4e8d93a1c7e5b2a", "name": "订单查询", "agent_type": "WORKFLOW", "credits": 130.5000, "conversation_count": null, "message_count": null } ] } } }
                      
                      {
    "code": 0,
    "message": "OK",
    "data": {
        "org_id": "65f0c2a1b4e8d93a1c7e5b20",
        "timezone": "+07:00",
        "range_start_date": "2026-10-16",
        "range_end_date": "2026-11-14",
        "data_since": "2026-10-15",
        "data_until": 1794614400000,
        "total": {
            "credits": 1234.5678,
            "unattributed_credits": 36.2011,
            "conversation_count": 5210,
            "message_count": 48213
        },
        "agents": {
            "page": 1,
            "page_size": 20,
            "total": 86,
            "list": [
                {
                    "agent_id": "65f0c2a1b4e8d93a1c7e5b21",
                    "name": "客服助手",
                    "agent_type": "AGENT",
                    "credits": 402.1200,
                    "conversation_count": 2104,
                    "message_count": 19820
                },
                {
                    "agent_id": "65f0c2a1b4e8d93a1c7e5b2a",
                    "name": "订单查询",
                    "agent_type": "WORKFLOW",
                    "credits": 130.5000,
                    "conversation_count": null,
                    "message_count": null
                }
            ]
        }
    }
}

                    
This code block in the floating window

Successful Response

Field Type Description
org_id String Organization ID.
timezone String Organization timezone (UTC offset, e.g., +07:00), indicating the timezone for date segmentation.
range_start_date String The actual start date of the statistics yyyy-MM-dd (organization timezone, inclusive).
range_end_date String The actual end date of the statistics yyyy-MM-dd (organization timezone, inclusive).
data_since String The earliest date from which data is complete (yyyy-MM-dd): credits are available from the feature launch date, conversation count and question count are available from 31 days before the launch, taking the later of the two; data before it is incomplete. Shows null if there is no data yet.
data_until Long The timestamp up to which conversation count and question count have been counted (milliseconds). Credits are real-time.
total.credits Number Total organization credit consumption, including Workflow and credits not attributed to any Agent, with 4 decimal places.
total.unattributed_credits Number Portion not attributed to any Agent (e.g., knowledge base storage, speech recognition), will not appear in the agents list.
total.conversation_count Long Total number of new conversations within the period.
total.message_count Long Total number of user questions within the period, excluding AI responses.
agents.page Integer Current page number.
agents.page_size Integer Number of items per page.
agents.total Integer The number of Agents and Workflows with data in the interval (after filtering by agent_type).
agents.list[].agent_id String The ID of the Agent or Workflow.
agents.list[].name String Name.
agents.list[].agent_type String AGENT or WORKFLOW.
agents.list[].credits Number Credit consumption.
agents.list[].conversation_count Long Number of conversations created in the interval; for Workflow it is null.
agents.list[].message_count Long Number of user questions in the interval; for Workflow it is null.

Failed Response

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

Error Codes

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: this developer key has exceeded the per-minute limit for this API.
40008 Exceeded the per-minute quota of the organization's plan for "statistical APIs."
40010 The API is temporarily closed, please try again later.
40100 No permission: lacking permission to view usage.
40105 Not a member of this organization, or called an address from another data center.
40324 DevKey or DevSecret is incorrect.
403132 Invalid time range: start time is not earlier than end time, or exceeds the maximum query range.

Statistical Scope

  • Scope of Statistics: Only statistics for the developer space, including API, shared pages, web embedding, bubble components, LiveDesk, as well as various instant messaging and phone channels, and the developer space's Workflow; usage in workspaces (GWork) is not included, nor is usage of published Agents within workspaces.
  • Credits: All consumption types (excluding point expiration and subscription payments). Workflow consumption is recorded under the Workflow itself; consumption generated by an Agent calling a Workflow is not counted for that Agent. Credits data is available from the feature launch date (data_since) and historical data is not backfilled.
  • Number of Sessions: The number of sessions created within the period that have had at least one conversation, excluding developer space debug previews. Workflow runs do not generate sessions; AI searches in workspaces are not counted. Session and question counts have data starting from 31 days before the feature launch.
  • Number of Questions: The number of question messages sent by users within the period, excluding AI replies.
  • Sorting: agents.list is sorted by credits in descending order; if credits are the same, sorted by number of sessions. Agents with no credits, sessions, or questions in the period will not be listed.
  • Update Frequency: Credits are updated in real time; session and question counts are updated every hour on the hour, with approximately a 1-hour delay.