Skip to main content

Overview

The UsageClient provides access to usage statistics for your API consumption.

Initialization

Access the usage client through the main Client instance:
from xdk import Client

client = Client(bearer_token="your_token")
usage = client.usage

Methods

get()

Retrieves usage statistics for Posts over a specified number of days.
days
int
The number of days for which you need usage statistics
usage_fields
List[str]
A comma-separated list of Usage fields to display
Returns: GetResponse - Usage statistics data Example:
# Get usage for the last 7 days
usage_data = client.usage.get(days=7)

# Get usage with specific fields
usage_data = client.usage.get(
    days=30,
    usage_fields=["cap_reset_day", "daily_project_usage"]
)

Authentication

The usage endpoints require:
  • Bearer Token (App-only)
  • OAuth 2.0 User Context

See Also

Build docs developers (and LLMs) love