Analytics operations
| Operation | Node.js | Parameters | Returns |
|---|---|---|---|
| Project traffic | analytics.projectTraffic(projectId, input?) | timeframe?, domain? | Requests, visitors, transfer, errors, latency, countries, and timeline |
| Owned domain traffic | analytics.domainTraffic(domainId, input?) | timeframe?, teamId? | Domain traffic summary and timeline |
| Domain lookup | analytics.userDomainTraffic(domain, timeframe?) | Domain name, timeframe? (default 24h) | Traffic for an owned hostname |
24h, 48h, 72h, 7d, and 30d.
- Node.js
- Go
- Python
- Rust
const traffic = await pxxl.analytics.projectTraffic("proj_123", {
timeframe: "7d",
domain: "api.example.com",
});
traffic, err := client.ProjectTraffic(ctx, "proj_123", url.Values{
"timeframe": {"7d"}, "domain": {"api.example.com"},
})
traffic = client.project_traffic(
"proj_123", timeframe="7d", domain="api.example.com"
)
let traffic = client.project_traffic(
"proj_123",
Some(&[("timeframe", "7d"), ("domain", "api.example.com")]),
).await?;
{
"projectId": "proj_123",
"timeframe": "7d",
"analytics": {
"requests": 12540,
"visitors": 3210,
"pageViews": 9820,
"responseBytes": 428901220,
"requestBytes": 12047210,
"errors": 31,
"p50LatencyMs": 18,
"p95LatencyMs": 76,
"p99LatencyMs": 140,
"topDomains": [],
"countries": [],
"timeline": []
}
}
Team operations
| Operation | Node.js | Parameters | Returns |
|---|---|---|---|
| List teams | teams.list() | None | { teams, total } |
| Get team | teams.get(id) | Team ID | { team, success? } |
| Team databases | teams.databases(id) | Team ID | Team database collection |
const teams = await pxxl.teams.list();
const team = await pxxl.teams.get("team_123");
const databases = await pxxl.teams.databases("team_123");
{
"teams": [
{
"id": "team_123",
"name": "Production",
"myRole": "owner",
"status": "active",
"totalMembers": 4,
"totalProjects": 8,
"totalDatabases": 2,
"totalDomains": 5
}
],
"total": 1
}
Other languages
| Operation | Go | Python | Rust |
|---|---|---|---|
| Project traffic | ProjectTraffic(ctx, projectID, values) | project_traffic(project_id, **params) | project_traffic(project_id, query) |
| Owned domain traffic | DomainTraffic(ctx, domainID, values) | domain_traffic(domain_id, **params) | domain_traffic(domain_id, query) |
| Domain lookup | UserDomainTraffic(ctx, domain, timeframe) | user_domain_traffic(domain, timeframe="24h") | user_domain_traffic(domain, timeframe) |
| List teams | ListTeams(ctx) | list_teams() | list_teams() |
| Get team | GetTeam(ctx, id) | get_team(team_id) | get_team(id) |
| Team databases | ListTeamDatabases(ctx, id) | list_team_databases(team_id) | list_team_databases(id) |
Work in a team
Set a defaultteamId on the client in Node.js, Python, and Rust. Calls that accept a team use it unless you pass a different one. In Go, pass the team ID to each call that takes one.
const pxxl = new Pxxl({ apiKey: process.env.PXXL_API_KEY, teamId: "team_123" });
const jobs = await pxxl.cron.list(); // team_123's cron jobs

