This documentation is currently under development. Certain sections are not yet complete and will be added shortly.
For the complete documentation index, see llms.txt. This page is also available as Markdown.
GuideAPIReference

Insights API

Query logs, events, and metrics from The Wallet Crew with Kusto Query Language.

Insights API

The Insights API gives access to the usage database of The Wallet Crew. Query logs, events, and metrics using Kusto Query Language (KQL).

This API is designed for technical teams extracting data programmatically.

Real-world examples
  • Query pass installation trends by day after a campaign launch.

  • Export webhook or scan activity into a BI pipeline.

  • Inspect platform logs while debugging a tenant-specific integration issue.

Authentication and permissions

Access requires standard The Wallet Crew authentication.

  • Permission required: Insights:Read

  • Authentication flow: use an existing The Wallet Crew auth token (for example, from login or service-to-service).

  • Single-tenant scope: you can only query data from your own tenant.

Send the access token through the Authorization header.

Retention and rate limits

  • Logs: retained 45 days

  • Events: retained indefinitely

  • Metrics: retained indefinitely

Rate limit: 60 API calls per minute. To request higher limits, open a support ticket.

Endpoint

All queries use this operation:

Execute analytics query

post
/api/{tenantId}/insights/query

Runs a custom analytics query and returns results in tabular format.

Authorization

Requires Insights.Read scope.

Rate Limiting

Limited to 60 requests per interval to protect analytics infrastructure.

Query Language

Typically uses Kusto Query Language (KQL) syntax:

Passes
| where timestamp > ago(7d)
| summarize count() by passType
| order by count_ desc

Parameters

Supports parameterized queries for security and reusability:

{
  "query": "Events | where Name == name | take 100",
  "parameters": { "name": "Pass:Installed" }
}

Use Cases

  • Custom dashboards

  • Business intelligence reports

  • Data exports

  • Trend analysis

Performance

  • Query timeout: Configurable per tenant

  • Result limits: May be enforced

  • Caching: Not automatic - implement client-side if needed

Required scopes
This endpoint requires the following scopes:
Authorizations
OAuth2implicitRequired
Authorization URL:
Path parameters
tenantIdstringRequired
Body
querystringRequired
optionsobject · QueryOptionsOptional
Responses
200

Query executed successfully

columnsstring[]Optional
post/api/{tenantId}/insights/query
  • {tenantId} = your tenant identifier

  • Request body must contain a query string in KQL

Tables and schema

The Insights database contains three tables:

Logs

Column
Type

eventId

guid

timestamp

datetime

tenantId

string

eventType

string

operationId

string

properties

dynamic

Contains errors and traces related to platform activity. Useful for debugging and monitoring health.

Events

Column
Type

eventId

guid

timestamp

datetime

tenantId

string

eventType

string

operationId

string

properties

dynamic

Contains:

  • Page views

  • API requests

  • Custom business events

Metrics

Column
Type

metricId

guid

tenantId

string

metricType

string

value

dynamic

properties

dynamic

timestamp

datetime

Represents snapshots of the system state, taken hourly.

Common queries

Count new customers

Count pass installations

Count requests per day

Count redirects per day

Count page views per browser

Common event types

Here are some of the most common eventType values you may want to query:

  • Customer lifecycle

    • Customer:Upserted

    • Y2:Customer:Created

    • Y2:Customer:Updated

  • Pass lifecycle

    • Pass:Created

    • Pass:Updated

    • Pass:Installed

    • Pass:Uninstalled

  • User actions

    • action:addToAppleWallet

    • action:addToGoogleWallet

    • action:loginWithGoogle

    • action:loginWithApple

  • Tracking & analytics

    • Request

    • PageView

    • Redirect:Redirected

    • step:complete

    • step:changed

Troubleshooting

  • 401 Unauthorized

    • Ensure your token is valid and includes Insights:Read.

  • 429 Too Many Requests

    • You exceeded the rate limit (60 calls/minute). Implement retries with exponential backoff.

  • Query takes too long

    • Simplify query or reduce time window.

    • Avoid unbounded queries on large tables.

FAQ

Can I export results to CSV/JSON?

Not directly via the API.

Consume the JSON response and convert it locally.

Can I query multiple tenants?

No.

Access is restricted to your tenant only.

Does the Insights DB contain personal data?

No.

It does not contain PII.

Can I set up alerts (thresholds, triggers)?

Not at the moment.

Last updated