Documentation Index
Fetch the complete documentation index at: https://docs.monk.com/llms.txt
Use this file to discover all available pages before exploring further.
Querying Data
The SDK provides fluent query builders for listing events, retrieving aggregated usage, and checking service health.
List Events
Query ingested events with optional filters. The builder pattern lets you chain only the filters you need:
let response = client.list_events()
.event_name("api_call")
.customer_id("cust_123")
.start("2025-01-01")
.end("2025-01-31")
.limit(100)
.offset(0)
.send()
.await?;
for event in &response.events {
println!("{}: {}", event.event_name, event.timestamp);
}
println!("total: {} | has_more: {}", response.total, response.has_more);
Response Fields
| Field | Type | Description |
|---|
events | Vec | List of matching events |
total | u64 | Total number of matching events |
limit | u64 | Page size |
offset | u64 | Current offset |
has_more | bool | Whether more pages are available |
Use limit and offset to page through results:
let mut offset = 0;
let limit = 100;
loop {
let page = client.list_events()
.event_name("api_call")
.limit(limit)
.offset(offset)
.send()
.await?;
for event in &page.events {
// process event
}
if !page.has_more {
break;
}
offset += limit;
}
Query Usage
Retrieve aggregated usage data for a given time range:
let usage = client.query_usage("2025-01-01", "2025-01-31")
.event_name("api_call")
.send()
.await?;
println!("total: {}", usage.total_count);
for bucket in &usage.breakdown {
println!(" {}: {}", bucket.date, bucket.count);
}
Response Fields
| Field | Type | Description |
|---|
organization_id | String | Your organization ID |
event_name | String | The event type queried |
start | String | Start of the time range |
end | String | End of the time range |
total_count | u64 | Total event count in the range |
breakdown | Vec | Daily or bucketed usage breakdown |
Health Checks
Use liveness and readiness probes to verify the Monk Events API is operational:
// Liveness — is the service running?
let health = client.health().await?;
println!("liveness: {}", health.status);
// Readiness — is the service ready to accept traffic?
let ready = client.ready().await?;
println!("readiness: {}", ready.status);
These are useful for startup checks, Kubernetes probes, or circuit-breaker integrations in your own infrastructure.