Skip to main content
Usage

List Template Usage

GET /api/v1/forward/usage/templates Query Template-level Usage summaries for the current account within a specified time window.

Headers

HeaderRequiredDescription
AuthorizationYesBearer <PAT or SAT>

Query parameters

ParameterTypeRequiredDefaultDescription
start_timeintegerYes-Unix millisecond timestamp. Start of the time window (inclusive).
end_timeintegerYes-Unix millisecond timestamp. End of the time window (exclusive). Must be greater than start_time and span no more than 31 days.
template_idstringNo-Filter by a single Forward Template ID.
template_idsstring/string[]No-Filter by multiple Forward Template IDs. Supports comma-separated values or repeated query parameters.
identity_idstringNo-Filter by a single Forward Identity ID.
identity_idsstring/string[]No-Filter by multiple Forward Identity IDs. Supports comma-separated values or repeated query parameters.

Example request

curl -s -X GET 'https://api.qoder.com.cn/api/v1/forward/usage/templates?start_time=1783267200000&end_time=1784476800000&template_ids=tmpl_123,tmpl_456' \
  -H "Authorization: Bearer $QODER_ACCESS_TOKEN"

Example response

HTTP 200 OK
{
  "type": "template_usage.list",
  "start_time": 1783267200000,
  "end_time": 1784476800000,
  "data": [
    {
      "type": "template_usage",
      "template_id": "tmpl_123",
      "active_identities": 8,
      "session_count": 42,
      "duration_seconds": 3600,
      "credits": 12.34
    }
  ]
}

Response fields

FieldTypeDescription
typestringAlways template_usage.list.
start_timeintegerRequested time window start.
end_timeintegerRequested time window end.
dataarrayUsage list grouped by Template.
data[].typestringAlways template_usage.
data[].template_idstringForward Template ID.
data[].active_identitiesintegerDeduplicated count of Forward Identities under this Template.
data[].session_countintegerNumber of Forward sessions.
data[].duration_secondsintegerForward session runtime aggregated and converted to seconds.
data[].creditsnumberCredit consumption aggregated by session, rounded to two decimal places. null when Credit query is unavailable.

Error codes

HTTPTypeCodeTrigger
400invalid_request_error-Missing start_time/end_time, invalid time format, end_time <= start_time, or time span exceeds 31 days.
401authentication_errorauthentication_requiredThe PAT is invalid or expired.
500api_error-The Forward session query or usage metrics query failed.