Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.qoder.com/llms.txt

Use this file to discover all available pages before exploring further.

About this document

Query Credits usage events and summaries by member or organization, and query Shared Add-on Credits details for an organization. Complete Get API Key first, then read Conventions.

Requirements

  • Valid API key tied to the organization.

API list

1. List usage events

GET /v1/organizations/{organization_id}/members/{member_id}/usage-events Paginated retrieval of aggregated Credits usage records for a specified member.

Path parameters

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID
member_idstringYesMember ID

Query parameters

ParameterTypeRequiredDescription
startDatestringNoStart time; supports RFC 3339 format or Unix millisecond timestamp
endDatestringNoEnd time; supports RFC 3339 format or Unix millisecond timestamp
sourcesstringNoFilter by source, comma-separated. Values: IDE, CLI, JetBrains Plugin, Web, QoderWork
operationsstringNoFilter by operation, comma-separated. Values: Inline Chat, Ask, Agent, Repo Wiki, Quest, Plan Mode, Code Review, Optimize Input, Voice Input, Experts, Image
modelTiersstringNoFilter by model tier, comma-separated. Values: Auto, Performance, Efficient, Lite, Ultimate, Vision, Qwen-Coder-Qoder-1.0, Kimi-K2.5, GLM-5, MiniMax-M2.5, DeepSeek-V4.0, Qwen3.5-Plus, Standard, Premium, Enterprise
maxResultsintegerNoPage size (default 20, max 100)
nextCreditsstringNoPagination cursor

Success response (200 OK)

With usage records and more pages:
{
  "usages": [
    {
      "timestamp": 1719849600000,
      "userId": "user_abc123",
      "userEmail": "user@example.com",
      "source": "IDE",
      "operation": "Agent",
      "modelTier": "Ultimate",
      "credits": 0.35,
      "cost": 0.35
    },
    {
      "timestamp": 1719849500000,
      "userId": "user_abc123",
      "source": "CLI",
      "operation": "Completion",
      "credits": 0.02,
      "cost": 0.02
    }
  ],
  "maxResults": 20,
  "nextCredits": "eyJwYWdlIjogMn0="
}
Some records may not return userEmail or modelTier; treat them as optional fields during integration.
No usage records / last page:
{

  "usages": [],

  "maxResults": 20
}
When nextCredits is empty or absent, it indicates the last page.

Response fields

FieldTypeDescription
usagesarrayList of usage records
usages[].timestampint64Start time (Unix millisecond timestamp)
usages[].userIdstringUser ID
usages[].userEmailstringUser email (may be empty)
usages[].sourcestringSource: IDE, CLI, JetBrains Plugin, Web, QoderWork
usages[].operationstringOperation: Inline Chat, Ask, Agent, Repo Wiki, Quest, Plan Mode, Code Review, Optimize Input, Voice Input, Experts, Image
usages[].modelTierstringModel tier (may be empty): Auto, Performance, Efficient, Lite, Ultimate, Vision, Qwen-Coder-Qoder-1.0, Kimi-K2.5, GLM-5, MiniMax-M2.5, DeepSeek-V4.0, Qwen3.5-Plus, Standard, Premium, Enterprise
usages[].creditsfloat64Credits consumed (two decimal places)
usages[].costfloat64Billing-adjusted cost (two decimal places); usually equals credits or has a fixed conversion ratio
maxResultsint32Page size for this request
nextCreditsstringNext-page cursor; empty means last page

2. Get usage summary

GET /v1/organizations/{organization_id}/members/{member_id}/usage-summary Summarize a member’s Credits consumption over a given time range by the specified dimension. The time range must not exceed 7 days.

Path parameters

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID
member_idstringYesMember ID

Query parameters

ParameterTypeRequiredDescription
startDatestringYesStart time; supports RFC 3339 format or Unix millisecond timestamp
endDatestringYesEnd time; supports RFC 3339 format or Unix millisecond timestamp
groupBystringYesGrouping dimension: source (by source) or operation (by operation)

Success response (200 OK)

Grouped by source (**groupBy=source**):
{
  "summary": {
    "IDE": 12.50,
    "CLI": 3.25
  }
}
Grouped by operation (**groupBy=operation**):
{
  "summary": {
    "Agent": 8.40,
    "Completion": 5.10,
    "Inline Chat": 2.25
  }
}
No usage data:
{
  "summary": {}
}

Response fields

FieldTypeDescription
summaryobjectSummary result; key is the group name (source or operation), value is total Credits
summary.{key}float64Total Credits consumed by that group (two decimal places)

Error responses

Missing required parameter (400)
{
  "requestId": "req_abc123",
  "code": "BadRequest",
  "message": "startDate is required"
}
Time range exceeded (400)
{
  "requestId": "req_abc123",
  "code": "BadRequest",
  "message": "date range must not exceed 7 days"
}
Invalid groupBy (400)
{
  "requestId": "req_abc123",
  "code": "BadRequest",
  "message": "groupBy is required and must be 'source' or 'operation'"
}

3. List organization usage events

GET /v1/organizations/{organization_id}/usage-events Paginated retrieval of aggregated token usage records for all members in the specified organization. The response structure is identical to the member usage events endpoint.

Path parameters

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID

Query parameters

ParameterTypeRequiredDescription
startDatestringNoStart time; supports RFC 3339 format or Unix millisecond timestamp
endDatestringNoEnd time; supports RFC 3339 format or Unix millisecond timestamp
sourcesstringNoFilter by source, comma-separated. Values: IDE, CLI, JetBrains Plugin, Web, QoderWork
operationsstringNoFilter by operation, comma-separated. Values: Inline Chat, Ask, Agent, Repo Wiki, Quest, Plan Mode, Code Review, Optimize Input, Voice Input, Experts
modelTiersstringNoFilter by model tier, comma-separated. Values: Auto, Performance, Efficient, Lite, Ultimate, Vision, Qwen-Coder-Qoder-1.0, Kimi-K2.5, GLM-5, MiniMax-M2.5, DeepSeek-V4.0, Qwen3.5-Plus, Standard, Premium, Enterprise
maxResultsintegerNoPage size (default 20, max 100)
nextTokenstringNoPagination cursor

Success response (200 OK)

{
  "usages": [
    {
      "timestamp": 1719849600000,
      "userId": "user_abc123",
      "userEmail": "user@example.com",
      "source": "IDE",
      "operation": "Agent",
      "modelTier": "Ultimate",
      "credits": 0.35,
      "cost": 0.35
    },
    {
      "timestamp": 1719849500000,
      "userId": "user_def456",
      "source": "CLI",
      "operation": "Ask",
      "credits": -0.02,
      "cost": -0.02
    }
  ],
  "maxResults": 20,
  "nextToken": "eyJwYWdlIjogMn0="
}
Some records may not return userEmail or modelTier; treat them as optional fields during integration. The endpoint does not filter out negative Credits records by default; refunds and reversals may also appear.

Response fields

Response fields are identical to “1. List usage events”.

4. List organization Shared Add-on Credits packages

GET /v1/organizations/{organization_id}/resource-packages Returns all Shared Add-on Credits details for an organization with pagination. The response contains only per-batch information and does not include summaries (aggregate limitValue / usedValue / remainingValue on the client side if needed).

Path parameters

ParameterTypeRequiredDescription
organization_idstringYesOrganization ID

Query parameters

ParameterTypeRequiredDescription
statusstringNoFilter by status. Values: active, exhausted, expired, suspended. Returns all non-deleted packages when omitted
orderBystringNoSort field. Values: expiresAt (default), activatedAt, remainingValue
orderstringNoSort direction. Values: asc (default), desc
maxResultsintegerNoPage size (default 20, max 100)
nextTokenstringNoPagination cursor from the previous response’s nextToken field

Success response (200 OK)

With Shared Add-on Credits records and more pages:
{
  "resourcePackages": [
    {
      "id": "pkg-001",
      "name": "Enterprise Annual Pack",
      "source": "purchased",
      "status": "active",
      "activatedAt": "2025-01-01T00:00:00Z",
      "expiresAt": "2026-01-01T00:00:00Z",
      "limitValue": 3000.0,
      "usedValue": 800.0,
      "remainingValue": 2200.0,
      "unit": "credits"
    },
    {
      "id": "pkg-002",
      "name": "Trial Pack",
      "source": "trial",
      "status": "exhausted",
      "activatedAt": "2025-03-15T00:00:00Z",
      "expiresAt": "2025-09-15T00:00:00Z",
      "limitValue": 500.0,
      "usedValue": 500.0,
      "remainingValue": 0.0,
      "unit": "credits"
    }
  ],
  "maxResults": 20,
  "nextToken": "eyJwYWdlIjogMn0="
}
Some packages may not return activatedAt (e.g., batches not yet activated); treat it as an optional field during integration.
No Shared Add-on Credits / last page:
{

  "resourcePackages": [],

  "maxResults": 20
}
When nextToken is empty or absent, it indicates the last page.

Response fields

FieldTypeDescription
resourcePackagesarrayList of Shared Add-on Credits
resourcePackages[].idstringUnique credits package ID
resourcePackages[].namestringCredits package name
resourcePackages[].sourcestringCredits source: purchased, bonus (gifted), trial, carryOver (carried over), refund, dev (development/testing), sales (sales-configured)
resourcePackages[].statusstringCredits status: active (in effect), exhausted (quota used up), expired, suspended
resourcePackages[].activatedAtstringActivation time (RFC 3339 / ISO 8601, UTC; may be empty)
resourcePackages[].expiresAtstringExpiration time (RFC 3339 / ISO 8601, UTC)
resourcePackages[].limitValuefloat64Initial total quota
resourcePackages[].usedValuefloat64Consumed quota
resourcePackages[].remainingValuefloat64Remaining quota (= limitValue - usedValue)
resourcePackages[].unitstringQuota unit, typically credits
maxResultsint32Page size for this request
nextTokenstringNext-page cursor; absent when on the last page

Error responses

Invalid status parameter (400)
{
  "requestId": "req_abc123",
  "code": "BadRequest",
  "message": "invalid status, must be one of: active, exhausted, expired, suspended"
}
Invalid orderBy parameter (400)
{
  "requestId": "req_def456",
  "code": "BadRequest",
  "message": "invalid orderBy field, must be one of: expiresAt, activatedAt, remainingValue"
}
Organization not found or no access (404)
{
  "requestId": "req_jkl012",
  "code": "NotFound",
  "message": "organization not found or not accessible"
}

Status reference

Shared Add-on Credits status machine:
StatusDescriptionEntry condition
activeIn effect, consumableDefault status after activation
exhaustedUsed upRemaining quota reaches zero (an exhausted package does not automatically transition to expired when it expires; it stays exhausted)
expiredExpiredAn hourly scheduled task transitions due active packages to expired
suspendedSuspendedManually suspended by admin; not consumable
Because expired is set by an hourly async job, there may be up to a 1-hour window between the actual expiration time and the status change. During this window, status is still active but expiresAt < now. For precise “truly available” checks, combine status and expiresAt on the client side:
truly available = status == "active" AND expiresAt > now

Usage examples

List member usage events

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/members/member_abc123/usage-events?maxResults=20" \
  -H "Authorization: Bearer <api_key>"

Filter by date range

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/members/member_abc123/usage-events?startDate=2025-06-01T00:00:00Z&endDate=2025-06-30T23:59:59Z" \
  -H "Authorization: Bearer <api_key>"

List organization usage events

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/usage-events?maxResults=20" \
  -H "Authorization: Bearer <api_key>"

Filter by source and operation

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/members/member_abc123/usage-events?sources=IDE&operations=Ask,Agent" \
  -H "Authorization: Bearer <api_key>"

Summarize usage by source

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/members/member_abc123/usage-summary?startDate=2026-03-13T00:00:00Z&endDate=2026-03-20T00:00:00Z&groupBy=source" \
  -H "Authorization: Bearer <api_key>"

Summarize usage by operation

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/members/member_abc123/usage-summary?startDate=2026-03-13T00:00:00Z&endDate=2026-03-20T00:00:00Z&groupBy=operation" \
  -H "Authorization: Bearer <api_key>"

List organization Shared Add-on Credits

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/resource-packages?status=active&orderBy=expiresAt&order=asc&maxResults=20" \
  -H "Authorization: Bearer <api_key>"

Paginate Shared Add-on Credits

curl -X GET "https://api.qoder.com/v1/organizations/org_xxx/resource-packages?nextToken=eyJwYWdlIjogMn0%3D" \
  -H "Authorization: Bearer <api_key>"
nextToken may contain URL-reserved characters; URL-encode it when passing as a query parameter (e.g., =%3D).

Error codes

Error codeHTTP statusDescription
BadRequest400Invalid request parameters (e.g., empty member_id, incorrect date format, time range exceeded, invalid groupBy)
Unauthorized401API key missing or invalid
Forbidden403No permission to access this organization
NotFound404Member not found
InternalError500Internal server error
Error response shape: see Error responses in Conventions.