Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Update api (#1028)

Goldflag0d69c42a27c0
diff --git a/client/src/api/analytics/endpoints/errors.ts b/client/src/api/analytics/endpoints/errors.ts
index a77a00527..d0e3c8608 100644
--- a/client/src/api/analytics/endpoints/errors.ts
+++ b/client/src/api/analytics/endpoints/errors.ts
@@ -73,7 +73,7 @@ export interface ErrorBucketedParams extends CommonApiParams {
/**
* Fetch error names with counts
- * GET /api/error-names/:site
+ * GET /api/sites/:site/errors/names
*/
export async function fetchErrorNames(
site: string | number,
@@ -86,7 +86,7 @@ export async function fetchErrorNames(
};
const response = await authedFetch<{ data: ErrorNamesPaginatedResponse }>(
- `/sites/${site}/error-names`,
+ `/sites/${site}/errors/names`,
queryParams
);
return response.data;
@@ -94,7 +94,7 @@ export async function fetchErrorNames(
/**
* Fetch individual error events
- * GET /api/error-events/:site
+ * GET /api/sites/:site/errors/events
*/
export async function fetchErrorEvents(
site: string | number,
@@ -108,7 +108,7 @@ export async function fetchErrorEvents(
};
const response = await authedFetch<{ data: ErrorEventsPaginatedResponse }>(
- `/sites/${site}/error-events`,
+ `/sites/${site}/errors/events`,
queryParams
);
return response.data;
@@ -116,7 +116,7 @@ export async function fetchErrorEvents(
/**
* Fetch error counts over time
- * GET /api/error-bucketed/:site
+ * GET /api/sites/:site/errors/time-series
*/
export async function fetchErrorBucketed(
site: string | number,
@@ -129,7 +129,7 @@ export async function fetchErrorBucketed(
};
const response = await authedFetch<{ data: GetErrorBucketedResponse }>(
- `/sites/${site}/error-bucketed`,
+ `/sites/${site}/errors/time-series`,
queryParams
);
return response.data;
diff --git a/client/src/api/analytics/endpoints/events.ts b/client/src/api/analytics/endpoints/events.ts
index 7192f524f..9a072764c 100644
--- a/client/src/api/analytics/endpoints/events.ts
+++ b/client/src/api/analytics/endpoints/events.ts
@@ -200,7 +200,7 @@ export async function fetchOutboundLinks(
/**
* Fetch bucketed event counts for top custom events
- * GET /sites/:site/events/bucketed
+ * GET /api/sites/:site/events/time-series
*/
export async function fetchEventBucketed(
site: string | number,
@@ -212,7 +212,7 @@ export async function fetchEventBucketed(
};
const response = await authedFetch<{ data: EventBucketedPoint[] }>(
- `/sites/${site}/events/bucketed`,
+ `/sites/${site}/events/time-series`,
queryParams
);
return response.data;
diff --git a/client/src/api/analytics/endpoints/goals.ts b/client/src/api/analytics/endpoints/goals.ts
index efed30989..9f18f0551 100644
--- a/client/src/api/analytics/endpoints/goals.ts
+++ b/client/src/api/analytics/endpoints/goals.ts
@@ -107,7 +107,7 @@ export async function fetchGoals(site: string | number, params: GoalsParams): Pr
/**
* Fetch bucketed conversion data for goals
- * GET /api/goals/bucketed/:site
+ * GET /api/sites/:site/goals/time-series
*/
export async function fetchGoalTimeSeries(
site: string | number,
@@ -118,7 +118,7 @@ export async function fetchGoalTimeSeries(
goal_ids: params.goalIds,
};
- const response = await authedFetch<{ data: GoalTimeSeriesPoint[] }>(`/sites/${site}/goals/bucketed`, queryParams);
+ const response = await authedFetch<{ data: GoalTimeSeriesPoint[] }>(`/sites/${site}/goals/time-series`, queryParams);
return response.data;
}
diff --git a/client/src/api/analytics/endpoints/overview.ts b/client/src/api/analytics/endpoints/overview.ts
index f5aa13ff5..e7a36600e 100644
--- a/client/src/api/analytics/endpoints/overview.ts
+++ b/client/src/api/analytics/endpoints/overview.ts
@@ -64,14 +64,14 @@ export async function fetchOverview(
/**
* Fetch time-series overview data
- * GET /api/overview-bucketed/:site
+ * GET /api/sites/:site/overview/time-series
*/
export async function fetchOverviewBucketed(
site: string | number,
params: BucketedParams
): Promise<GetOverviewBucketedResponse> {
const response = await authedFetch<{ data: GetOverviewBucketedResponse }>(
- `/sites/${site}/overview-bucketed`,
+ `/sites/${site}/overview/time-series`,
toBucketedQueryParams(params)
);
return response.data;
diff --git a/client/src/api/analytics/endpoints/sessions.ts b/client/src/api/analytics/endpoints/sessions.ts
index 86df22151..fb8a5aaea 100644
--- a/client/src/api/analytics/endpoints/sessions.ts
+++ b/client/src/api/analytics/endpoints/sessions.ts
@@ -185,14 +185,14 @@ export async function fetchSession(
/**
* Fetch session locations for map visualization
- * GET /api/session-locations/:site
+ * GET /api/sites/:site/sessions/locations
*/
export async function fetchSessionLocations(
site: string | number,
params: CommonApiParams
): Promise<LiveSessionLocation[]> {
const response = await authedFetch<{ data: LiveSessionLocation[] }>(
- `/sites/${site}/session-locations`,
+ `/sites/${site}/sessions/locations`,
toQueryParams(params)
);
return response.data;
diff --git a/client/src/app/[site]/api-playground/utils/endpointConfig.ts b/client/src/app/[site]/api-playground/utils/endpointConfig.ts
index 0fc76fc3d..b3f3a990d 100644
--- a/client/src/app/[site]/api-playground/utils/endpointConfig.ts
+++ b/client/src/app/[site]/api-playground/utils/endpointConfig.ts
@@ -85,6 +85,27 @@ export const endpointCategories: EndpointCategory[] = [
description: "Returns the list of excluded country codes",
hasCommonParams: false,
},
+ {
+ method: "GET",
+ path: "/sites/:site/excluded-paths",
+ name: "Get Excluded Paths",
+ description: "Returns the list of excluded URL paths",
+ hasCommonParams: false,
+ },
+ {
+ method: "GET",
+ path: "/sites/:site/excluded-hostnames",
+ name: "Get Excluded Hostnames",
+ description: "Returns the list of excluded hostnames",
+ hasCommonParams: false,
+ },
+ {
+ method: "GET",
+ path: "/sites/:site/excluded-user-agents",
+ name: "Get Excluded User Agents",
+ description: "Returns the list of excluded user-agent patterns",
+ hasCommonParams: false,
+ },
{
method: "GET",
path: "/sites/:site/private-link-config",
@@ -177,6 +198,53 @@ export const endpointCategories: EndpointCategory[] = [
},
],
},
+ {
+ name: "Teams",
+ endpoints: [
+ {
+ method: "GET",
+ path: "/organizations/:organizationId/teams",
+ name: "Get Teams",
+ description: "Returns the teams in an organization with members and sites",
+ hasCommonParams: false,
+ pathParams: ["organizationId"],
+ },
+ {
+ method: "POST",
+ path: "/organizations/:organizationId/teams",
+ name: "Create Team",
+ description: "Creates a team. Requires admin/owner role.",
+ hasCommonParams: false,
+ pathParams: ["organizationId"],
+ hasRequestBody: true,
+ requestBodyExample: {
+ name: "Marketing",
+ memberUserIds: [],
+ siteIds: [],
+ },
+ },
+ {
+ method: "PUT",
+ path: "/organizations/:organizationId/teams/:teamId",
+ name: "Update Team",
+ description: "Updates a team's name, members, or sites. Requires admin/owner role.",
+ hasCommonParams: false,
+ pathParams: ["organizationId", "teamId"],
+ hasRequestBody: true,
+ requestBodyExample: {
+ name: "Growth",
+ },
+ },
+ {
+ method: "DELETE",
+ path: "/organizations/:organizationId/teams/:teamId",
+ name: "Delete Team",
+ description: "Deletes a team. Requires admin/owner role.",
+ hasCommonParams: false,
+ pathParams: ["organizationId", "teamId"],
+ },
+ ],
+ },
{
name: "Overview",
endpoints: [
@@ -189,7 +257,7 @@ export const endpointCategories: EndpointCategory[] = [
},
{
method: "GET",
- path: "/sites/:site/overview-bucketed",
+ path: "/sites/:site/overview/time-series",
name: "Get Overview (Time Series)",
description: "Returns time-series analytics data broken down by time buckets",
hasCommonParams: true,
@@ -242,7 +310,7 @@ export const endpointCategories: EndpointCategory[] = [
},
{
method: "GET",
- path: "/sites/:site/events/bucketed",
+ path: "/sites/:site/events/time-series",
name: "Get Event Time Series",
description: "Returns time-series counts for top custom events",
hasCommonParams: true,
@@ -279,7 +347,7 @@ export const endpointCategories: EndpointCategory[] = [
endpoints: [
{
method: "GET",
- path: "/sites/:site/error-names",
+ path: "/sites/:site/errors/names",
name: "Get Error Names",
description: "Returns unique error messages with occurrence and session counts",
hasCommonParams: true,
@@ -287,7 +355,7 @@ export const endpointCategories: EndpointCategory[] = [
},
{
method: "GET",
- path: "/sites/:site/error-events",
+ path: "/sites/:site/errors/events",
name: "Get Error Events",
description: "Returns individual error occurrences with context and stack traces",
hasCommonParams: true,
@@ -296,7 +364,7 @@ export const endpointCategories: EndpointCategory[] = [
},
{
method: "GET",
- path: "/sites/:site/error-bucketed",
+ path: "/sites/:site/errors/time-series",
name: "Get Error Time Series",
description: "Returns error occurrence counts over time",
hasCommonParams: true,
@@ -305,6 +373,59 @@ export const endpointCategories: EndpointCategory[] = [
},
],
},
+ {
+ name: "Bots",
+ endpoints: [
+ {
+ method: "GET",
+ path: "/sites/:site/bots/overview",
+ name: "Get Bot Overview",
+ description: "Returns aggregate bot-traffic metrics with a breakdown by detection layer",
+ hasCommonParams: true,
+ specificParams: ["layer"],
+ },
+ {
+ method: "GET",
+ path: "/sites/:site/bots/time-series",
+ name: "Get Bot Time Series",
+ description: "Returns bot request counts over time",
+ hasCommonParams: true,
+ specificParams: ["bucket", "layer"],
+ },
+ {
+ method: "GET",
+ path: "/sites/:site/bots/by-dimension",
+ name: "Get Bots by Dimension",
+ description: "Returns bot requests broken down by a dimension",
+ hasCommonParams: true,
+ requiredParams: ["dimension"],
+ specificParams: ["dimension", "limit", "page", "layer"],
+ parameterMetadata: {
+ dimension: {
+ label: "Dimension",
+ type: "select",
+ options: [
+ "browser",
+ "browser_version",
+ "operating_system",
+ "operating_system_version",
+ "country",
+ "region",
+ "city",
+ "device_type",
+ "referrer",
+ "hostname",
+ "pathname",
+ "dimensions",
+ "asn_org",
+ "bot_category",
+ "matched_ua_pattern",
+ ],
+ },
+ },
+ },
+ ],
+ },
{
name: "Goals",
endpoints: [
@@ -316,6 +437,15 @@ export const endpointCategories: EndpointCategory[] = [
hasCommonParams: true,
specificParams: ["page", "page_size", "sort", "order"],
},
+ {
+ method: "GET",
+ path: "/sites/:site/goals/time-series",
+ name: "Get Goal Time Series",
+ description: "Returns goal conversions and conversion rate over time",
+ hasCommonParams: true,
+ requiredParams: ["goal_ids"],
+ specificParams: ["goal_ids", "bucket"],
+ },
{
method: "GET",
path: "/sites/:site/goals/:goalId/sessions",
@@ -532,7 +662,7 @@ export const endpointCategories: EndpointCategory[] = [
},
{
method: "GET",
- path: "/sites/:site/session-locations",
+ path: "/sites/:site/sessions/locations",
name: "Get Session Locations",
description: "Returns aggregated session locations for map visualization",
hasCommonParams: true,
@@ -720,6 +850,11 @@ export const parameterMetadata: Record<string, ParameterMetadata> = {
type: "select",
options: ["pathname", "country", "region", "browser", "operating_system", "device_type"],
},
+ layer: {
+ label: "Layer",
+ type: "select",
+ options: ["ua_pattern", "header_heuristics", "client_signals", "bot_asn", "rate_anomaly"],
+ },
mode: {
label: "Mode",
type: "select",
@@ -774,7 +909,9 @@ export const parameterMetadata: Record<string, ParameterMetadata> = {
// Path params
orgId: { label: "Organization ID", type: "text", placeholder: "org_abc123" },
goalId: { label: "Goal ID", type: "number", placeholder: "Goal ID" },
+ goal_ids: { label: "Goal IDs", type: "text", placeholder: "e.g. 1,2" },
funnelId: { label: "Funnel ID", type: "number", placeholder: "Funnel ID" },
+ teamId: { label: "Team ID", type: "text", placeholder: "team_abc123" },
sessionId: { label: "Session ID", type: "text", placeholder: "Session ID" },
stepNumber: { label: "Step Number", type: "number", placeholder: "Step number (1-indexed)" },
siteId: { label: "Site ID", type: "number", placeholder: "Site ID" },
diff --git a/docs/content/docs/api/api-keys/create.mdx b/docs/content/docs/api/api-keys/create.mdx
new file mode 100644
index 000000000..3a9041d86
--- /dev/null
+++ b/docs/content/docs/api/api-keys/create.mdx
@@ -0,0 +1,280 @@
+---
+title: Create API Key
+description: Programmatically create a new API key for your account.
+full: true
+method: POST
+---
+
+import { Callout } from 'fumadocs-ui/components/callout';
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+POST /api/user/api-keys
+```
+
+Creates a new API key scoped to your user account (and its organizations).
+
+<Callout type="warn">This endpoint authenticates with your logged-in dashboard **session**, not an API key — it is how you mint your first key, so you cannot bootstrap a key using another key. Send your session cookie with the request.</Callout>
+
+### Request Body
+
+<TypeTable
+ type={{
+ name: {
+ description: 'A label for the key',
+ type: 'string',
+ required: true,
+ },
+ expiresIn: {
+ description: 'Seconds until the key expires. Omit for a key that never expires.',
+ type: 'number',
+ required: false,
+ },
+ }}
+/>
+
+### Response
+
+Returns the created API key object.
+
+<TypeTable
+ type={{
+ id: {
+ description: "The key's identifier",
+ type: 'string',
+ },
+ key: {
+ description: 'The secret key value',
+ type: 'string',
+ },
+ name: {
+ description: 'The label for the key',
+ type: 'string',
+ },
+ start: {
+ description: 'A non-secret prefix of the key for display',
+ type: 'string',
+ },
+ prefix: {
+ description: 'The key prefix',
+ type: 'string',
+ },
+ userId: {
+ description: 'The ID of the user that owns the key',
+ type: 'string',
+ },
+ enabled: {
+ description: 'Whether the key is currently enabled',
+ type: 'boolean',
+ },
+ expiresAt: {
+ description: 'Expiration timestamp, or null if the key never expires',
+ type: 'string | null',
+ },
+ createdAt: {
+ description: 'Creation timestamp',
+ type: 'string',
+ },
+ updatedAt: {
+ description: 'Last update timestamp',
+ type: 'string',
+ },
+ rateLimitEnabled: {
+ description: 'Whether rate limiting is enabled for the key',
+ type: 'boolean',
+ },
+ rateLimitMax: {
+ description: 'Requests allowed per window',
+ type: 'number',
+ },
+ rateLimitTimeWindow: {
+ description: 'Window length in milliseconds',
+ type: 'number',
+ },
+ }}
+/>
+
+**Note:** Additional fields may be present in the response object.
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X POST "https://app.rybbit.io/api/user/api-keys" \
+ -H "Cookie: better-auth.session_token=YOUR_SESSION_TOKEN" \
+ -H "Content-Type: application/json" \
+ -d '{"name": "CI pipeline", "expiresIn": 2592000}'
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/user/api-keys',
+ {
+ method: 'POST',
+ credentials: 'include',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ name: 'CI pipeline',
+ expiresIn: 2592000
+ })
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.post(
+ 'https://app.rybbit.io/api/user/api-keys',
+ json={
+ 'name': 'CI pipeline',
+ 'expiresIn': 2592000
+ },
+ headers={
+ 'Cookie': 'better-auth.session_token=YOUR_SESSION_TOKEN'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/user/api-keys");
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_POST, true);
+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
+ 'name' => 'CI pipeline',
+ 'expiresIn' => 2592000
+]));
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Cookie: better-auth.session_token=YOUR_SESSION_TOKEN',
+ 'Content-Type: application/json'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI("https://app.rybbit.io/api/user/api-keys")
+req = Net::HTTP::Post.new(uri)
+req['Cookie'] = 'better-auth.session_token=YOUR_SESSION_TOKEN'
+req['Content-Type'] = 'application/json'
+req.body = {
+ name: 'CI pipeline',
+ expiresIn: 2592000
+}.to_json
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+body := bytes.NewBuffer([]byte(`{
+ "name": "CI pipeline",
+ "expiresIn": 2592000
+}`))
+req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/user/api-keys", body)
+req.Header.Set("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")
+req.Header.Set("Content-Type", "application/json")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .post("https://app.rybbit.io/api/user/api-keys")
+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")
+ .json(&serde_json::json!({
+ "name": "CI pipeline",
+ "expiresIn": 2592000
+ }))
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+String json = "{\"name\": \"CI pipeline\", \"expiresIn\": 2592000}";
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/user/api-keys"))
+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")
+ .header("Content-Type", "application/json")
+ .POST(HttpRequest.BodyPublishers.ofString(json))
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN");
+
+var content = new StringContent(
+ "{\"name\": \"CI pipeline\", \"expiresIn\": 2592000}",
+ Encoding.UTF8,
+ "application/json"
+);
+
+var response = await client.PostAsync("https://app.rybbit.io/api/user/api-keys", content);
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+<Callout type="warn">The full `key` value is returned **only once**, at creation. Store it securely — it cannot be retrieved again.</Callout>
+
+```json title="Response"
+{
+ "id": "key_8f3a1b2c4d5e6f7g",
+ "key": "rybbit_sk_live_xxxxxxxxxxxxxxxxxxxx",
+ "name": "CI pipeline",
+ "start": "rybbit_sk_live_xxxx",
+ "prefix": "rybbit_sk_live_",
+ "userId": "user_2a9b8c7d6e5f4g3h",
+ "enabled": true,
+ "expiresAt": "2026-07-25T12:00:00.000Z",
+ "createdAt": "2026-06-25T12:00:00.000Z",
+ "updatedAt": "2026-06-25T12:00:00.000Z",
+ "rateLimitEnabled": true,
+ "rateLimitMax": 200,
+ "rateLimitTimeWindow": 60000
+}
+```
+
+<Callout>On Rybbit Cloud, API keys require a Standard or Pro plan; free/basic plans receive HTTP 403. Rate limits are applied automatically based on your plan.</Callout>
+
+</div>
+</div>
diff --git a/docs/content/docs/api/api-keys/meta.json b/docs/content/docs/api/api-keys/meta.json
new file mode 100644
index 000000000..179df0c94
--- /dev/null
+++ b/docs/content/docs/api/api-keys/meta.json
@@ -0,0 +1,4 @@
+{
+ "title": "API Keys",
+ "pages": ["create"]
+}
diff --git a/docs/content/docs/api/bots/by-dimension.mdx b/docs/content/docs/api/bots/by-dimension.mdx
new file mode 100644
index 000000000..1c70f6f9f
--- /dev/null
+++ b/docs/content/docs/api/bots/by-dimension.mdx
@@ -0,0 +1,248 @@
+---
+title: Get Bots by Dimension
+description: Returns bot requests broken down by a dimension.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/bots/by-dimension
+```
+
+Returns bot requests broken down by a dimension.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) (time and filters).
+
+Bot filtering supports a subset of filter parameters: `browser`, `browser_version`, `operating_system`, `operating_system_version`, `country`, `region`, `city`, `device_type`, `referrer`, `hostname`, `pathname`, `querystring`, `dimensions`, `user_id`, `lat`, and `lon`.
+
+<TypeTable
+ type={{
+ dimension: {
+ description: 'The dimension to group by',
+ type: 'string',
+ typeDescription: '"browser" | "browser_version" | "operating_system" | "operating_system_version" | "country" | "region" | "city" | "device_type" | "referrer" | "hostname" | "pathname" | "dimensions" | "asn_org" | "bot_category" | "matched_ua_pattern"',
+ required: true,
+ },
+ limit: {
+ description: 'Number of results per page',
+ type: 'number',
+ default: 100,
+ },
+ page: {
+ description: 'Page number (1-indexed)',
+ type: 'number',
+ default: 1,
+ },
+ layer: {
+ description: 'Restrict results to a single detection layer',
+ type: 'string',
+ typeDescription: '"ua_pattern" | "header_heuristics" | "client_signals" | "bot_asn" | "rate_anomaly"',
+ required: false,
+ },
+ }}
+/>
+
+### Response
+
+<TypeTable
+ type={{
+ data: {
+ description: 'Paginated response object',
+ type: 'PaginatedResponse',
+ },
+ }}
+/>
+
+#### PaginatedResponse Object
+
+<TypeTable
+ type={{
+ data: {
+ description: 'Array of dimension breakdown objects',
+ type: 'BotDimension[]',
+ },
+ totalCount: {
+ description: 'Total number of distinct dimension values',
+ type: 'number',
+ },
+ }}
+/>
+
+#### BotDimension Object
+
+<TypeTable
+ type={{
+ value: {
+ description: 'The dimension value',
+ type: 'string',
+ },
+ hostname: {
+ description: 'Hostname (only populated when dimension is "pathname", otherwise empty)',
+ type: 'string',
+ },
+ count: {
+ description: 'Number of bot requests for this value',
+ type: 'number',
+ },
+ percentage: {
+ description: 'Share of bot requests for this value',
+ type: 'number',
+ typeDescription: 'Range: 0-100',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/bots/by-dimension?dimension=browser&start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/bots/by-dimension?dimension=browser&start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/bots/by-dimension',
+ params={
+ 'dimension': 'browser',
+ 'start_date': '2024-01-01',
+ 'end_date': '2024-01-31',
+ 'time_zone': 'America/New_York'
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/bots/by-dimension?dimension=browser&start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/bots/by-dimension?dimension=browser&start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/bots/by-dimension?dimension=browser&start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/bots/by-dimension?dimension=browser&start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/bots/by-dimension?dimension=browser&start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/bots/by-dimension?dimension=browser&start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "data": {
+ "data": [
+ { "value": "Chrome", "hostname": "", "count": 980, "percentage": 53.26 },
+ { "value": "HeadlessChrome", "hostname": "", "count": 540, "percentage": 29.35 }
+ ],
+ "totalCount": 12
+ }
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/bots/meta.json b/docs/content/docs/api/bots/meta.json
new file mode 100644
index 000000000..2dfff9cb9
--- /dev/null
+++ b/docs/content/docs/api/bots/meta.json
@@ -0,0 +1,4 @@
+{
+ "title": "Bots",
+ "pages": ["overview", "time-series", "by-dimension"]
+}
diff --git a/docs/content/docs/api/bots/overview.mdx b/docs/content/docs/api/bots/overview.mdx
new file mode 100644
index 000000000..58da59688
--- /dev/null
+++ b/docs/content/docs/api/bots/overview.mdx
@@ -0,0 +1,224 @@
+---
+title: Get Bot Overview
+description: Returns aggregate bot-traffic metrics with a breakdown by detection layer.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/bots/overview
+```
+
+Returns aggregate bot-traffic metrics with a breakdown by detection layer.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) (time and filters).
+
+Bot filtering supports a subset of filter parameters: `browser`, `browser_version`, `operating_system`, `operating_system_version`, `country`, `region`, `city`, `device_type`, `referrer`, `hostname`, `pathname`, `querystring`, `dimensions`, `user_id`, `lat`, and `lon`.
+
+<TypeTable
+ type={{
+ layer: {
+ description: 'Restrict results to a single detection layer',
+ type: 'string',
+ typeDescription: '"ua_pattern" | "header_heuristics" | "client_signals" | "bot_asn" | "rate_anomaly"',
+ required: false,
+ },
+ }}
+/>
+
+### Response
+
+<TypeTable
+ type={{
+ bot_requests: {
+ description: 'Total bot requests',
+ type: 'number',
+ },
+ total_events: {
+ description: 'Total requests (bots + humans)',
+ type: 'number',
+ },
+ bot_percentage: {
+ description: 'Bot requests as a percentage of all requests',
+ type: 'number',
+ typeDescription: 'Range: 0-100',
+ },
+ ua_pattern: {
+ description: 'Bot requests flagged by the user-agent pattern layer',
+ type: 'number',
+ },
+ header_heuristics: {
+ description: 'Bot requests flagged by the header-heuristics layer',
+ type: 'number',
+ },
+ client_signals: {
+ description: 'Bot requests flagged by the client-signals layer',
+ type: 'number',
+ },
+ bot_asn: {
+ description: 'Bot requests flagged by the known-bot-ASN layer',
+ type: 'number',
+ },
+ rate_anomaly: {
+ description: 'Bot requests flagged by the rate-anomaly layer',
+ type: 'number',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/bots/overview?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/bots/overview?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/bots/overview',
+ params={
+ 'start_date': '2024-01-01',
+ 'end_date': '2024-01-31',
+ 'time_zone': 'America/New_York'
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/bots/overview?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/bots/overview?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/bots/overview?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/bots/overview?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/bots/overview?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/bots/overview?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "data": {
+ "bot_requests": 1840,
+ "total_events": 48933,
+ "bot_percentage": 3.76,
+ "ua_pattern": 1200,
+ "header_heuristics": 410,
+ "client_signals": 95,
+ "bot_asn": 120,
+ "rate_anomaly": 15
+ }
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/bots/time-series.mdx b/docs/content/docs/api/bots/time-series.mdx
new file mode 100644
index 000000000..8458568fb
--- /dev/null
+++ b/docs/content/docs/api/bots/time-series.mdx
@@ -0,0 +1,211 @@
+---
+title: Get Bot Time Series
+description: Returns bot request counts over time.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/bots/time-series
+```
+
+Returns bot request counts over time.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) (time and filters).
+
+Bot filtering supports a subset of filter parameters: `browser`, `browser_version`, `operating_system`, `operating_system_version`, `country`, `region`, `city`, `device_type`, `referrer`, `hostname`, `pathname`, `querystring`, `dimensions`, `user_id`, `lat`, and `lon`.
+
+<TypeTable
+ type={{
+ bucket: {
+ description: 'Time bucket granularity',
+ type: 'string',
+ typeDescription: '"minute" | "five_minutes" | "ten_minutes" | "fifteen_minutes" | "hour" | "day" | "week" | "month" | "year"',
+ default: 'hour',
+ },
+ layer: {
+ description: 'Restrict results to a single detection layer',
+ type: 'string',
+ typeDescription: '"ua_pattern" | "header_heuristics" | "client_signals" | "bot_asn" | "rate_anomaly"',
+ required: false,
+ },
+ }}
+/>
+
+#### Bucket Selection Guide
+
+| Bucket | Best For |
+|--------|----------|
+| `minute` | Real-time monitoring (last hour) |
+| `five_minutes` | Short-term analysis (last few hours) |
+| `hour` | Daily analysis |
+| `day` | Weekly/monthly analysis |
+| `week` | Monthly/quarterly analysis |
+| `month` | Yearly analysis |
+
+### Response
+
+<TypeTable
+ type={{
+ time: {
+ description: 'Start of the time bucket',
+ type: 'string',
+ },
+ bot_requests: {
+ description: 'Number of bot requests in this bucket',
+ type: 'number',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/bots/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/bots/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/bots/time-series',
+ params={
+ 'bucket': 'hour',
+ 'start_date': '2024-01-01',
+ 'end_date': '2024-01-07',
+ 'time_zone': 'America/New_York'
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/bots/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/bots/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/bots/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/bots/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/bots/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/bots/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "data": [
+ { "time": "2024-01-15 13:00:00", "bot_requests": 42 },
+ { "time": "2024-01-15 14:00:00", "bot_requests": 58 }
+ ]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/errors/events.mdx b/docs/content/docs/api/errors/events.mdx
index 6db1883be..1f0d801af 100644
--- a/docs/content/docs/api/errors/events.mdx
+++ b/docs/content/docs/api/errors/events.mdx
@@ -12,7 +12,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
<div>
```
-GET /api/sites/:site/error-events
+GET /api/sites/:site/errors/events
```
Returns individual error occurrences for a specific error message, with full context including stack traces.
@@ -138,14 +138,14 @@ Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) plu
<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
<Tab value="cURL">
```bash title="Request"
-curl -X GET "https://app.rybbit.io/api/sites/1/error-events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10" \
+curl -X GET "https://app.rybbit.io/api/sites/1/errors/events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10" \
-H "Authorization: Bearer your_api_key_here"
```
</Tab>
<Tab value="JavaScript">
```javascript title="Request"
const response = await fetch(
- `https://app.rybbit.io/api/sites/1/error-events?errorMessage=${encodeURIComponent("Cannot read property 'map' of undefined")}&limit=10`,
+ `https://app.rybbit.io/api/sites/1/errors/events?errorMessage=${encodeURIComponent("Cannot read property 'map' of undefined")}&limit=10`,
{
headers: {
'Authorization': 'Bearer your_api_key_here'
@@ -161,7 +161,7 @@ const data = await response.json();
import requests
response = requests.get(
- 'https://app.rybbit.io/api/sites/1/error-events',
+ 'https://app.rybbit.io/api/sites/1/errors/events',
params={
'errorMessage': "Cannot read property 'map' of undefined",
'limit': 10
@@ -177,7 +177,7 @@ data = response.json()
<Tab value="PHP">
```php title="Request"
$ch = curl_init();
-curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/error-events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10');
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/errors/events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer your_api_key_here'
@@ -194,7 +194,7 @@ $data = json_decode($response, true);
require 'net/http'
require 'json'
-uri = URI('https://app.rybbit.io/api/sites/1/error-events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10')
+uri = URI('https://app.rybbit.io/api/sites/1/errors/events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer your_api_key_here'
@@ -204,7 +204,7 @@ data = JSON.parse(res.body)
</Tab>
<Tab value="Go">
```go title="Request"
-req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/1/error-events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10", nil)
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/1/errors/events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10", nil)
req.Header.Set("Authorization", "Bearer your_api_key_here")
client := &http.Client{}
@@ -219,7 +219,7 @@ json.NewDecoder(resp.Body).Decode(&data)
```rust title="Request"
let client = reqwest::Client::new();
let res = client
- .get("https://app.rybbit.io/api/sites/1/error-events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10")
+ .get("https://app.rybbit.io/api/sites/1/errors/events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10")
.header("Authorization", "Bearer your_api_key_here")
.send()
.await?;
@@ -231,7 +231,7 @@ let data: serde_json::Value = res.json().await?;
```java title="Request"
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
- .uri(URI.create("https://app.rybbit.io/api/sites/1/error-events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10"))
+ .uri(URI.create("https://app.rybbit.io/api/sites/1/errors/events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10"))
.header("Authorization", "Bearer your_api_key_here")
.GET()
.build();
@@ -244,7 +244,7 @@ HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.o
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
-var response = await client.GetAsync("https://app.rybbit.io/api/sites/1/error-events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10");
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/1/errors/events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10");
var data = await response.Content.ReadAsStringAsync();
```
</Tab>
diff --git a/docs/content/docs/api/errors/names.mdx b/docs/content/docs/api/errors/names.mdx
index ec922cb3e..dcb51330d 100644
--- a/docs/content/docs/api/errors/names.mdx
+++ b/docs/content/docs/api/errors/names.mdx
@@ -12,7 +12,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
<div>
```
-GET /api/sites/:site/error-names
+GET /api/sites/:site/errors/names
```
Returns a list of unique error messages with occurrence counts and affected session counts.
@@ -92,14 +92,14 @@ Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) plu
<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
<Tab value="cURL">
```bash title="Request"
-curl -X GET "https://app.rybbit.io/api/sites/1/error-names?start_date=2024-01-01&end_date=2024-01-31" \
+curl -X GET "https://app.rybbit.io/api/sites/1/errors/names?start_date=2024-01-01&end_date=2024-01-31" \
-H "Authorization: Bearer your_api_key_here"
```
</Tab>
<Tab value="JavaScript">
```javascript title="Request"
const response = await fetch(
- 'https://app.rybbit.io/api/sites/1/error-names?start_date=2024-01-01&end_date=2024-01-31',
+ 'https://app.rybbit.io/api/sites/1/errors/names?start_date=2024-01-01&end_date=2024-01-31',
{
headers: {
'Authorization': 'Bearer your_api_key_here'
@@ -115,7 +115,7 @@ const data = await response.json();
import requests
response = requests.get(
- 'https://app.rybbit.io/api/sites/1/error-names23',
+ 'https://app.rybbit.io/api/sites/1/errors/names',
params={
'start_date': '2024-01-01',
'end_date': '2024-01-31'
@@ -131,7 +131,7 @@ data = response.json()
<Tab value="PHP">
```php title="Request"
$ch = curl_init();
-curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/error-names?start_date=2024-01-01&end_date=2024-01-31');
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/errors/names?start_date=2024-01-01&end_date=2024-01-31');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer your_api_key_here'
@@ -148,7 +148,7 @@ $data = json_decode($response, true);
require 'net/http'
require 'json'
-uri = URI('https://app.rybbit.io/api/sites/1/error-names?start_date=2024-01-01&end_date=2024-01-31')
+uri = URI('https://app.rybbit.io/api/sites/1/errors/names?start_date=2024-01-01&end_date=2024-01-31')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer your_api_key_here'
@@ -158,7 +158,7 @@ data = JSON.parse(res.body)
</Tab>
<Tab value="Go">
```go title="Request"
-req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/1/error-names?start_date=2024-01-01&end_date=2024-01-31", nil)
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/1/errors/names?start_date=2024-01-01&end_date=2024-01-31", nil)
req.Header.Set("Authorization", "Bearer your_api_key_here")
client := &http.Client{}
@@ -173,7 +173,7 @@ json.NewDecoder(resp.Body).Decode(&data)
```rust title="Request"
let client = reqwest::Client::new();
let res = client
- .get("https://app.rybbit.io/api/sites/1/error-names?start_date=2024-01-01&end_date=2024-01-31")
+ .get("https://app.rybbit.io/api/sites/1/errors/names?start_date=2024-01-01&end_date=2024-01-31")
.header("Authorization", "Bearer your_api_key_here")
.send()
.await?;
@@ -185,7 +185,7 @@ let data: serde_json::Value = res.json().await?;
```java title="Request"
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
- .uri(URI.create("https://app.rybbit.io/api/sites/1/error-names?start_date=2024-01-01&end_date=2024-01-31"))
+ .uri(URI.create("https://app.rybbit.io/api/sites/1/errors/names?start_date=2024-01-01&end_date=2024-01-31"))
.header("Authorization", "Bearer your_api_key_here")
.GET()
.build();
@@ -198,7 +198,7 @@ HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.o
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
-var response = await client.GetAsync("https://app.rybbit.io/api/sites/1/error-names?start_date=2024-01-01&end_date=2024-01-31");
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/1/errors/names?start_date=2024-01-01&end_date=2024-01-31");
var data = await response.Content.ReadAsStringAsync();
```
</Tab>
diff --git a/docs/content/docs/api/errors/time-series.mdx b/docs/content/docs/api/errors/time-series.mdx
index a2f210480..70a288525 100644
--- a/docs/content/docs/api/errors/time-series.mdx
+++ b/docs/content/docs/api/errors/time-series.mdx
@@ -12,7 +12,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
<div>
```
-GET /api/sites/:site/error-bucketed
+GET /api/sites/:site/errors/time-series
```
Returns error occurrence counts over time for a specific error message. Useful for tracking error trends and identifying when issues started.
@@ -86,14 +86,14 @@ Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) plu
<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
<Tab value="cURL">
```bash title="Request"
-curl -X GET "https://app.rybbit.io/api/sites/1/error-bucketed?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC" \
+curl -X GET "https://app.rybbit.io/api/sites/1/errors/time-series?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC" \
-H "Authorization: Bearer your_api_key_here"
```
</Tab>
<Tab value="JavaScript">
```javascript title="Request"
const response = await fetch(
- `https://app.rybbit.io/api/sites/1/error-bucketed?errorMessage=${encodeURIComponent("Cannot read property 'map' of undefined")}&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC`,
+ `https://app.rybbit.io/api/sites/1/errors/time-series?errorMessage=${encodeURIComponent("Cannot read property 'map' of undefined")}&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC`,
{
headers: {
'Authorization': 'Bearer your_api_key_here'
@@ -109,7 +109,7 @@ const data = await response.json();
import requests
response = requests.get(
- 'https://app.rybbit.io/api/sites/1/error-bucketed',
+ 'https://app.rybbit.io/api/sites/1/errors/time-series',
params={
'errorMessage': "Cannot read property 'map' of undefined",
'bucket': 'hour',
@@ -128,7 +128,7 @@ data = response.json()
<Tab value="PHP">
```php title="Request"
$ch = curl_init();
-curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/error-bucketed?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC');
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/errors/time-series?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer your_api_key_here'
@@ -145,7 +145,7 @@ $data = json_decode($response, true);
require 'net/http'
require 'json'
-uri = URI('https://app.rybbit.io/api/sites/1/error-bucketed?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC')
+uri = URI('https://app.rybbit.io/api/sites/1/errors/time-series?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer your_api_key_here'
@@ -155,7 +155,7 @@ data = JSON.parse(res.body)
</Tab>
<Tab value="Go">
```go title="Request"
-req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/1/error-bucketed?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC", nil)
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/1/errors/time-series?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC", nil)
req.Header.Set("Authorization", "Bearer your_api_key_here")
client := &http.Client{}
@@ -170,7 +170,7 @@ json.NewDecoder(resp.Body).Decode(&data)
```rust title="Request"
let client = reqwest::Client::new();
let res = client
- .get("https://app.rybbit.io/api/sites/1/error-bucketed?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC")
+ .get("https://app.rybbit.io/api/sites/1/errors/time-series?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC")
.header("Authorization", "Bearer your_api_key_here")
.send()
.await?;
@@ -182,7 +182,7 @@ let data: serde_json::Value = res.json().await?;
```java title="Request"
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
- .uri(URI.create("https://app.rybbit.io/api/sites/1/error-bucketed?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC"))
+ .uri(URI.create("https://app.rybbit.io/api/sites/1/errors/time-series?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC"))
.header("Authorization", "Bearer your_api_key_here")
.GET()
.build();
@@ -195,7 +195,7 @@ HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.o
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
-var response = await client.GetAsync("https://app.rybbit.io/api/sites/1/error-bucketed?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC");
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/1/errors/time-series?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&bucket=hour&start_date=2024-01-30&end_date=2024-01-31&time_zone=UTC");
var data = await response.Content.ReadAsStringAsync();
```
</Tab>
diff --git a/docs/content/docs/api/events/count.mdx b/docs/content/docs/api/events/count.mdx
new file mode 100644
index 000000000..3f98a8cf6
--- /dev/null
+++ b/docs/content/docs/api/events/count.mdx
@@ -0,0 +1,239 @@
+---
+title: Get Event Counts
+description: Returns time-bucketed event counts grouped by event type.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/events/count
+```
+
+Returns time-bucketed event counts grouped by event type.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) (time and filters).
+
+<TypeTable
+ type={{
+ bucket: {
+ description: 'Time bucket size for grouping data',
+ type: 'TimeBucket',
+ typeDescription: '"minute" | "five_minutes" | "ten_minutes" | "fifteen_minutes" | "hour" | "day" | "week" | "month" | "year"',
+ default: 'day',
+ },
+ }}
+/>
+
+### Response
+
+<TypeTable
+ type={{
+ time: {
+ description: 'Start of the time bucket',
+ type: 'string',
+ },
+ pageview_count: {
+ description: 'Number of pageviews in this bucket',
+ type: 'number',
+ },
+ custom_event_count: {
+ description: 'Number of custom events in this bucket',
+ type: 'number',
+ },
+ performance_count: {
+ description: 'Number of performance events in this bucket',
+ type: 'number',
+ },
+ outbound_count: {
+ description: 'Number of outbound link events in this bucket',
+ type: 'number',
+ },
+ error_count: {
+ description: 'Number of error events in this bucket',
+ type: 'number',
+ },
+ button_click_count: {
+ description: 'Number of button click events in this bucket',
+ type: 'number',
+ },
+ copy_count: {
+ description: 'Number of copy events in this bucket',
+ type: 'number',
+ },
+ form_submit_count: {
+ description: 'Number of form submit events in this bucket',
+ type: 'number',
+ },
+ input_change_count: {
+ description: 'Number of input change events in this bucket',
+ type: 'number',
+ },
+ event_count: {
+ description: 'Total events across all types in this bucket',
+ type: 'number',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/events/count?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/events/count?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/events/count',
+ params={
+ 'bucket': 'day',
+ 'start_date': '2024-01-01',
+ 'end_date': '2024-01-07',
+ 'time_zone': 'America/New_York'
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/events/count?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/events/count?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/events/count?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/events/count?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/events/count?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/events/count?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "data": [
+ {
+ "time": "2024-01-15 00:00:00",
+ "pageview_count": 4820,
+ "custom_event_count": 312,
+ "performance_count": 1200,
+ "outbound_count": 88,
+ "error_count": 14,
+ "button_click_count": 540,
+ "copy_count": 9,
+ "form_submit_count": 33,
+ "input_change_count": 120,
+ "event_count": 7136
+ }
+ ]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/events/meta.json b/docs/content/docs/api/events/meta.json
index a097307f0..966173db4 100644
--- a/docs/content/docs/api/events/meta.json
+++ b/docs/content/docs/api/events/meta.json
@@ -1,4 +1,4 @@
{
"title": "Events",
- "pages": ["list", "names", "properties", "outbound"]
+ "pages": ["list", "names", "time-series", "count", "properties", "outbound"]
}
diff --git a/docs/content/docs/api/events/time-series.mdx b/docs/content/docs/api/events/time-series.mdx
new file mode 100644
index 000000000..80958f5a2
--- /dev/null
+++ b/docs/content/docs/api/events/time-series.mdx
@@ -0,0 +1,203 @@
+---
+title: Get Event Time Series
+description: Returns time-bucketed counts for the top custom events.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/events/time-series
+```
+
+Returns time-bucketed counts for the top custom events.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) (time and filters).
+
+<TypeTable
+ type={{
+ bucket: {
+ description: 'Time bucket size for grouping data',
+ type: 'TimeBucket',
+ typeDescription: '"minute" | "five_minutes" | "ten_minutes" | "fifteen_minutes" | "hour" | "day" | "week" | "month" | "year"',
+ default: 'hour',
+ },
+ limit: {
+ description: 'Number of top custom events (by total count) to include',
+ type: 'number',
+ typeDescription: 'Range: 1-10',
+ default: 5,
+ },
+ }}
+/>
+
+### Response
+
+<TypeTable
+ type={{
+ time: {
+ description: 'Start of the time bucket',
+ type: 'string',
+ },
+ event_name: {
+ description: 'Name of the custom event',
+ type: 'string',
+ },
+ event_count: {
+ description: 'Number of times the event occurred in this bucket',
+ type: 'number',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/events/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York&limit=5" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/events/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York&limit=5',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/events/time-series',
+ params={
+ 'bucket': 'hour',
+ 'start_date': '2024-01-01',
+ 'end_date': '2024-01-07',
+ 'time_zone': 'America/New_York',
+ 'limit': 5
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/events/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York&limit=5');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/events/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York&limit=5')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/events/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York&limit=5", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/events/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York&limit=5")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/events/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York&limit=5"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/events/time-series?bucket=hour&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York&limit=5");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "data": [
+ { "time": "2024-01-15 13:00:00", "event_name": "signup", "event_count": 42 },
+ { "time": "2024-01-15 13:00:00", "event_name": "purchase", "event_count": 12 }
+ ]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/goals/meta.json b/docs/content/docs/api/goals/meta.json
index dd177fd8a..d6d23fb40 100644
--- a/docs/content/docs/api/goals/meta.json
+++ b/docs/content/docs/api/goals/meta.json
@@ -1,4 +1,4 @@
{
"title": "Goals",
- "pages": ["list", "sessions", "create", "update", "delete"]
+ "pages": ["list", "time-series", "sessions", "create", "update", "delete"]
}
diff --git a/docs/content/docs/api/goals/time-series.mdx b/docs/content/docs/api/goals/time-series.mdx
new file mode 100644
index 000000000..2f45de1fd
--- /dev/null
+++ b/docs/content/docs/api/goals/time-series.mdx
@@ -0,0 +1,236 @@
+---
+title: Get Goal Time Series
+description: Returns goal conversions and conversion rate over time.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/goals/time-series
+```
+
+Returns goal conversions and conversion rate over time.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) (time and filters) plus the following:
+
+<TypeTable
+ type={{
+ goal_ids: {
+ description: 'The goals to include',
+ type: 'string',
+ typeDescription: 'Comma-separated goal IDs (e.g. "1,2") or a JSON array. If omitted, the response is empty.',
+ required: true,
+ },
+ bucket: {
+ description: 'Time bucket size for grouping data',
+ type: 'TimeBucket',
+ typeDescription: '"minute" | "five_minutes" | "ten_minutes" | "fifteen_minutes" | "hour" | "day" | "week" | "month" | "year"',
+ default: 'hour',
+ },
+ }}
+/>
+
+#### Bucket Selection Guide
+
+| Bucket | Best For |
+|--------|----------|
+| `minute` | Real-time monitoring (last hour) |
+| `five_minutes` | Short-term analysis (last few hours) |
+| `hour` | Daily analysis |
+| `day` | Weekly/monthly analysis |
+| `week` | Monthly/quarterly analysis |
+| `month` | Yearly analysis |
+
+### Response
+
+<TypeTable
+ type={{
+ time: {
+ description: 'Start of the time bucket',
+ type: 'string',
+ typeDescription: 'ISO 8601 datetime',
+ },
+ goal_id: {
+ description: 'ID of the goal',
+ type: 'number',
+ },
+ conversions: {
+ description: 'Number of distinct converting sessions in this bucket',
+ type: 'number',
+ },
+ total_sessions: {
+ description: 'Total number of sessions in this bucket',
+ type: 'number',
+ },
+ conversion_rate: {
+ description: 'Conversion rate as a fraction',
+ type: 'number',
+ typeDescription: 'Range: 0-1',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/goals/time-series?goal_ids=1,2&bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/goals/time-series?goal_ids=1,2&bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/goals/time-series',
+ params={
+ 'goal_ids': '1,2',
+ 'bucket': 'day',
+ 'start_date': '2024-01-01',
+ 'end_date': '2024-01-07',
+ 'time_zone': 'America/New_York'
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/goals/time-series?goal_ids=1,2&bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/goals/time-series?goal_ids=1,2&bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/goals/time-series?goal_ids=1,2&bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/goals/time-series?goal_ids=1,2&bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/goals/time-series?goal_ids=1,2&bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/goals/time-series?goal_ids=1,2&bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "data": [
+ {
+ "time": "2024-01-01T00:00:00.000Z",
+ "goal_id": 1,
+ "conversions": 84,
+ "total_sessions": 1250,
+ "conversion_rate": 0.0672
+ },
+ {
+ "time": "2024-01-02T00:00:00.000Z",
+ "goal_id": 1,
+ "conversions": 97,
+ "total_sessions": 1420,
+ "conversion_rate": 0.0683
+ }
+ ]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/imports/create.mdx b/docs/content/docs/api/imports/create.mdx
new file mode 100644
index 000000000..3bd4c16b3
--- /dev/null
+++ b/docs/content/docs/api/imports/create.mdx
@@ -0,0 +1,272 @@
+---
+title: Create Import
+description: Starts a new data import from a supported platform.
+full: true
+method: POST
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+POST /api/sites/:site/imports
+```
+
+Starts a new data import from a supported platform. Requires an admin or owner API key. On Rybbit Cloud, this requires a paid plan.
+
+Only one concurrent import is allowed per organization. Starting a second import while one is still running returns HTTP `429`.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Request Body
+
+<TypeTable
+ type={{
+ platform: {
+ description: 'Source platform to import data from',
+ type: 'string',
+ typeDescription: '"umami" | "simple_analytics" | "plausible"',
+ required: true,
+ },
+ }}
+/>
+
+### Response
+
+<TypeTable
+ type={{
+ data: {
+ description: 'Import details',
+ type: 'CreateImportData',
+ },
+ }}
+/>
+
+#### CreateImportData Object
+
+<TypeTable
+ type={{
+ importId: {
+ description: 'UUID of the created import. Use this when uploading events.',
+ type: 'string',
+ typeDescription: 'UUID',
+ },
+ allowedDateRange: {
+ description: 'The inclusive date window you may import events within, based on your plan\'s retention',
+ type: 'AllowedDateRange',
+ },
+ }}
+/>
+
+#### AllowedDateRange Object
+
+<TypeTable
+ type={{
+ earliestAllowedDate: {
+ description: 'Earliest date you may import events for (inclusive)',
+ type: 'string',
+ typeDescription: 'YYYY-MM-DD',
+ },
+ latestAllowedDate: {
+ description: 'Latest date you may import events for (inclusive)',
+ type: 'string',
+ typeDescription: 'YYYY-MM-DD',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X POST "https://app.rybbit.io/api/sites/123/imports" \
+ -H "Authorization: Bearer your_api_key_here" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "platform": "plausible"
+ }'
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/imports',
+ {
+ method: 'POST',
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here',
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ platform: 'plausible'
+ })
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.post(
+ 'https://app.rybbit.io/api/sites/123/imports',
+ json={
+ 'platform': 'plausible'
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$body = [
+ 'platform' => 'plausible'
+];
+
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/imports');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_POST, true);
+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here',
+ 'Content-Type: application/json'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/imports')
+request = Net::HTTP::Post.new(uri)
+request['Authorization'] = 'Bearer your_api_key_here'
+request['Content-Type'] = 'application/json'
+request.body = {
+ platform: 'plausible'
+}.to_json
+
+response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
+ http.request(request)
+end
+
+data = JSON.parse(response.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+body := map[string]interface{}{
+ "platform": "plausible",
+}
+jsonBody, _ := json.Marshal(body)
+
+req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/sites/123/imports", bytes.NewBuffer(jsonBody))
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+req.Header.Set("Content-Type", "application/json")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let body = serde_json::json!({
+ "platform": "plausible"
+});
+
+let client = reqwest::Client::new();
+let res = client
+ .post("https://app.rybbit.io/api/sites/123/imports")
+ .header("Authorization", "Bearer your_api_key_here")
+ .json(&body)
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+String json = """
+{
+ "platform": "plausible"
+}
+""";
+
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/imports"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .header("Content-Type", "application/json")
+ .POST(HttpRequest.BodyPublishers.ofString(json))
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+var body = new
+{
+ platform = "plausible"
+};
+
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var content = new StringContent(
+ JsonSerializer.Serialize(body),
+ Encoding.UTF8,
+ "application/json");
+
+var response = await client.PostAsync("https://app.rybbit.io/api/sites/123/imports", content);
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "data": {
+ "importId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
+ "allowedDateRange": {
+ "earliestAllowedDate": "2023-01-01",
+ "latestAllowedDate": "2024-01-31"
+ }
+ }
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/imports/delete.mdx b/docs/content/docs/api/imports/delete.mdx
new file mode 100644
index 000000000..c911c68f7
--- /dev/null
+++ b/docs/content/docs/api/imports/delete.mdx
@@ -0,0 +1,147 @@
+---
+title: Delete Import
+description: Deletes an import and all events it added. The import must be finished.
+full: true
+method: DELETE
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+DELETE /api/sites/:site/imports/:importId
+```
+
+Deletes an import and all events it added. The import must be finished. Requires an admin or owner API key. On Rybbit Cloud, this requires a paid plan.
+
+A still-running import cannot be deleted and returns HTTP `400`.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ importId: {
+ description: 'UUID of the import to delete',
+ type: 'string',
+ required: true,
+ },
+ }}
+/>
+
+### Response
+
+Returns `200 OK` with an empty body.
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X DELETE "https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479',
+ {
+ method: 'DELETE',
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.delete(
+ 'https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479',
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479')
+req = Net::HTTP::Delete.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("DELETE", "https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .delete("https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .DELETE()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.DeleteAsync("https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479");
+```
+ </Tab>
+</Tabs>
+
+</div>
+</div>
diff --git a/docs/content/docs/api/imports/events.mdx b/docs/content/docs/api/imports/events.mdx
new file mode 100644
index 000000000..570c12900
--- /dev/null
+++ b/docs/content/docs/api/imports/events.mdx
@@ -0,0 +1,243 @@
+---
+title: Upload Import Events
+description: Uploads a batch of raw events to an in-progress import.
+full: true
+method: POST
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+POST /api/sites/:site/imports/:importId/events
+```
+
+Uploads a batch of raw events to an in-progress import. Requires an admin or owner API key. On Rybbit Cloud, this requires a paid plan.
+
+Upload events in batches. The request body limit is 50 MB, so split large exports across multiple requests. Set `isLastBatch` to `true` on the final batch to finalize the import.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ importId: {
+ description: 'UUID of the import to upload events to',
+ type: 'string',
+ required: true,
+ },
+ }}
+/>
+
+### Request Body
+
+<TypeTable
+ type={{
+ events: {
+ description: 'Raw, platform-specific event objects whose shape matches the platform chosen when the import was created (Umami, Simple Analytics, or Plausible export rows)',
+ type: 'object[]',
+ required: true,
+ },
+ isLastBatch: {
+ description: 'Set to true on the final batch to finalize the import',
+ type: 'boolean',
+ required: false,
+ },
+ }}
+/>
+
+### Response
+
+Returns `200 OK` with an empty body. Events outside your plan's retention window are skipped and reflected in the import's `skippedEvents` / `invalidEvents` counts (see [List Imports](/docs/api/imports/list)).
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X POST "https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479/events" \
+ -H "Authorization: Bearer your_api_key_here" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "events": [
+ { "...": "platform-specific fields" }
+ ],
+ "isLastBatch": false
+ }'
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479/events',
+ {
+ method: 'POST',
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here',
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ events: [
+ { '...': 'platform-specific fields' }
+ ],
+ isLastBatch: false
+ })
+ }
+);
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.post(
+ 'https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479/events',
+ json={
+ 'events': [
+ { '...': 'platform-specific fields' }
+ ],
+ 'isLastBatch': False
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$body = [
+ 'events' => [
+ ['...' => 'platform-specific fields']
+ ],
+ 'isLastBatch' => false
+];
+
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479/events');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_POST, true);
+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here',
+ 'Content-Type: application/json'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479/events')
+request = Net::HTTP::Post.new(uri)
+request['Authorization'] = 'Bearer your_api_key_here'
+request['Content-Type'] = 'application/json'
+request.body = {
+ events: [
+ { '...': 'platform-specific fields' }
+ ],
+ isLastBatch: false
+}.to_json
+
+response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
+ http.request(request)
+end
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+body := map[string]interface{}{
+ "events": []map[string]string{
+ {"...": "platform-specific fields"},
+ },
+ "isLastBatch": false,
+}
+jsonBody, _ := json.Marshal(body)
+
+req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479/events", bytes.NewBuffer(jsonBody))
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+req.Header.Set("Content-Type", "application/json")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let body = serde_json::json!({
+ "events": [
+ {"...": "platform-specific fields"}
+ ],
+ "isLastBatch": false
+});
+
+let client = reqwest::Client::new();
+let res = client
+ .post("https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479/events")
+ .header("Authorization", "Bearer your_api_key_here")
+ .json(&body)
+ .send()
+ .await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+String json = """
+{
+ "events": [
+ {"...": "platform-specific fields"}
+ ],
+ "isLastBatch": false
+}
+""";
+
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479/events"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .header("Content-Type", "application/json")
+ .POST(HttpRequest.BodyPublishers.ofString(json))
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+var body = new
+{
+ events = new[]
+ {
+ new Dictionary<string, string> { { "...", "platform-specific fields" } }
+ },
+ isLastBatch = false
+};
+
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var content = new StringContent(
+ JsonSerializer.Serialize(body),
+ Encoding.UTF8,
+ "application/json");
+
+var response = await client.PostAsync("https://app.rybbit.io/api/sites/123/imports/f47ac10b-58cc-4372-a567-0e02b2c3d479/events", content);
+```
+ </Tab>
+</Tabs>
+
+</div>
+</div>
diff --git a/docs/content/docs/api/imports/list.mdx b/docs/content/docs/api/imports/list.mdx
new file mode 100644
index 000000000..d13bea82d
--- /dev/null
+++ b/docs/content/docs/api/imports/list.mdx
@@ -0,0 +1,282 @@
+---
+title: List Imports
+description: Returns all data imports for a site with their progress counts.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/imports
+```
+
+Returns all data imports for a site with their progress counts. Requires an admin or owner API key. On Rybbit Cloud, this requires a paid plan.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+This endpoint takes no query parameters.
+
+### Response
+
+<TypeTable
+ type={{
+ data: {
+ description: 'Array of import objects',
+ type: 'Import[]',
+ },
+ }}
+/>
+
+#### Import Object
+
+<TypeTable
+ type={{
+ importId: {
+ description: 'Unique import identifier',
+ type: 'string',
+ typeDescription: 'UUID',
+ },
+ platform: {
+ description: 'Source platform the data was imported from',
+ type: 'string',
+ typeDescription: '"umami" | "simple_analytics" | "plausible"',
+ },
+ importedEvents: {
+ description: 'Number of events successfully imported',
+ type: 'number',
+ },
+ skippedEvents: {
+ description: 'Number of events skipped (e.g. outside the retention window)',
+ type: 'number',
+ },
+ invalidEvents: {
+ description: 'Number of events rejected as invalid',
+ type: 'number',
+ },
+ startedAt: {
+ description: 'When the import started',
+ type: 'string',
+ typeDescription: 'ISO 8601 datetime',
+ },
+ completedAt: {
+ description: 'When the import finished, or null while it is still running',
+ type: 'string | null',
+ typeDescription: 'ISO 8601 datetime',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/imports" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/imports',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/imports',
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+<?php
+$ch = curl_init();
+
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/imports');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+?>
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+require 'uri'
+
+uri = URI('https://app.rybbit.io/api/sites/123/imports')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
+ http.request(req)
+end
+
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+package main
+
+import (
+ "encoding/json"
+ "io"
+ "net/http"
+)
+
+func main() {
+ url := "https://app.rybbit.io/api/sites/123/imports"
+
+ req, _ := http.NewRequest("GET", url, nil)
+ req.Header.Add("Authorization", "Bearer your_api_key_here")
+
+ client := &http.Client{}
+ resp, _ := client.Do(req)
+ defer resp.Body.Close()
+
+ body, _ := io.ReadAll(resp.Body)
+
+ var data map[string]interface{}
+ json.Unmarshal(body, &data)
+}
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+use reqwest;
+use serde_json::Value;
+
+#[tokio::main]
+async fn main() -> Result<(), Box<dyn std::error::Error>> {
+ let client = reqwest::Client::new();
+
+ let response = client
+ .get("https://app.rybbit.io/api/sites/123/imports")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+ let data: Value = response.json().await?;
+
+ Ok(())
+}
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+
+public class Main {
+ public static void main(String[] args) throws Exception {
+ HttpClient client = HttpClient.newHttpClient();
+
+ HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/imports"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+ HttpResponse<String> response = client.send(request,
+ HttpResponse.BodyHandlers.ofString());
+
+ String data = response.body();
+ }
+}
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using System;
+using System.Net.Http;
+using System.Threading.Tasks;
+
+class Program
+{
+ static async Task Main(string[] args)
+ {
+ using var client = new HttpClient();
+
+ client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+ var response = await client.GetAsync(
+ "https://app.rybbit.io/api/sites/123/imports");
+
+ var data = await response.Content.ReadAsStringAsync();
+ }
+}
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "data": [
+ {
+ "importId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
+ "platform": "plausible",
+ "importedEvents": 15420,
+ "skippedEvents": 120,
+ "invalidEvents": 3,
+ "startedAt": "2024-01-10T12:00:00.000Z",
+ "completedAt": "2024-01-10T12:04:30.000Z"
+ },
+ {
+ "importId": "9a1c8f2e-3b7d-4e1a-9c0f-2d5b6a7e8f10",
+ "platform": "umami",
+ "importedEvents": 8200,
+ "skippedEvents": 0,
+ "invalidEvents": 0,
+ "startedAt": "2024-01-15T09:30:00.000Z",
+ "completedAt": null
+ }
+ ]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/imports/meta.json b/docs/content/docs/api/imports/meta.json
new file mode 100644
index 000000000..be250be51
--- /dev/null
+++ b/docs/content/docs/api/imports/meta.json
@@ -0,0 +1,4 @@
+{
+ "title": "Imports",
+ "pages": ["list", "create", "events", "delete"]
+}
diff --git a/docs/content/docs/api/meta.json b/docs/content/docs/api/meta.json
index 592b163b1..cdf71c674 100644
--- a/docs/content/docs/api/meta.json
+++ b/docs/content/docs/api/meta.json
@@ -9,15 +9,21 @@
"---Analytics---",
"overview",
"sessions",
+ "session-replay",
"users",
+ "user-traits",
"events",
"goals",
"funnels",
"performance",
"errors",
+ "bots",
"insights",
"---Management---",
"organizations",
- "sites"
+ "teams",
+ "sites",
+ "imports",
+ "api-keys"
]
}
diff --git a/docs/content/docs/api/organizations/event-count.mdx b/docs/content/docs/api/organizations/event-count.mdx
new file mode 100644
index 000000000..d0a083c82
--- /dev/null
+++ b/docs/content/docs/api/organizations/event-count.mdx
@@ -0,0 +1,266 @@
+---
+title: Get Organization Event Count
+description: Returns daily event usage counts across an organization's sites.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/org-event-count/:organizationId
+```
+
+Returns daily event usage counts across an organization's sites.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ organizationId: {
+ description: 'Organization ID',
+ type: 'string',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+<TypeTable
+ type={{
+ start_date: {
+ description: 'Start of the date range. Omit start/end to get all-time daily counts.',
+ type: 'string',
+ typeDescription: 'YYYY-MM-DD',
+ },
+ end_date: {
+ description: 'End of the date range. Omit start/end to get all-time daily counts.',
+ type: 'string',
+ typeDescription: 'YYYY-MM-DD',
+ },
+ time_zone: {
+ description: 'IANA timezone used to bucket events into days',
+ type: 'string',
+ default: 'UTC',
+ },
+ }}
+/>
+
+### Response
+
+<TypeTable
+ type={{
+ event_date: {
+ description: 'The day the counts apply to',
+ type: 'string',
+ },
+ pageview_count: {
+ description: 'Number of pageview events',
+ type: 'number',
+ },
+ custom_event_count: {
+ description: 'Number of custom events',
+ type: 'number',
+ },
+ performance_count: {
+ description: 'Number of performance events',
+ type: 'number',
+ },
+ outbound_count: {
+ description: 'Number of outbound link events',
+ type: 'number',
+ },
+ error_count: {
+ description: 'Number of error events',
+ type: 'number',
+ },
+ button_click_count: {
+ description: 'Number of button click events',
+ type: 'number',
+ },
+ copy_count: {
+ description: 'Number of copy events',
+ type: 'number',
+ },
+ form_submit_count: {
+ description: 'Number of form submit events',
+ type: 'number',
+ },
+ input_change_count: {
+ description: 'Number of input change events',
+ type: 'number',
+ },
+ event_count: {
+ description: 'Total number of events for the day',
+ type: 'number',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/org-event-count/org_abc123?start_date=2024-01-01&end_date=2024-01-31&time_zone=UTC" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const organizationId = 'org_abc123';
+const response = await fetch(
+ `https://app.rybbit.io/api/org-event-count/${organizationId}?start_date=2024-01-01&end_date=2024-01-31&time_zone=UTC`,
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+organization_id = 'org_abc123'
+response = requests.get(
+ f'https://app.rybbit.io/api/org-event-count/{organization_id}',
+ params={
+ 'start_date': '2024-01-01',
+ 'end_date': '2024-01-31',
+ 'time_zone': 'UTC'
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$organizationId = 'org_abc123';
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/org-event-count/{$organizationId}?start_date=2024-01-01&end_date=2024-01-31&time_zone=UTC");
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+organization_id = 'org_abc123'
+uri = URI("https://app.rybbit.io/api/org-event-count/#{organization_id}?start_date=2024-01-01&end_date=2024-01-31&time_zone=UTC")
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+organizationId := "org_abc123"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/org-event-count/"+organizationId+"?start_date=2024-01-01&end_date=2024-01-31&time_zone=UTC", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let organization_id = "org_abc123";
+let client = reqwest::Client::new();
+let res = client
+ .get(format!("https://app.rybbit.io/api/org-event-count/{}?start_date=2024-01-01&end_date=2024-01-31&time_zone=UTC", organization_id))
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+String organizationId = "org_abc123";
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/org-event-count/" + organizationId + "?start_date=2024-01-01&end_date=2024-01-31&time_zone=UTC"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+var organizationId = "org_abc123";
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync($"https://app.rybbit.io/api/org-event-count/{organizationId}?start_date=2024-01-01&end_date=2024-01-31&time_zone=UTC");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "data": [
+ {
+ "event_date": "2024-01-01",
+ "pageview_count": 38900,
+ "custom_event_count": 4210,
+ "performance_count": 12050,
+ "outbound_count": 980,
+ "error_count": 145,
+ "button_click_count": 6320,
+ "copy_count": 410,
+ "form_submit_count": 220,
+ "input_change_count": 1530,
+ "event_count": 64765
+ },
+ {
+ "event_date": "2024-01-02",
+ "pageview_count": 41200,
+ "custom_event_count": 4560,
+ "performance_count": 12880,
+ "outbound_count": 1040,
+ "error_count": 132,
+ "button_click_count": 6710,
+ "copy_count": 455,
+ "form_submit_count": 248,
+ "input_change_count": 1622,
+ "event_count": 68847
+ }
+ ]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/organizations/meta.json b/docs/content/docs/api/organizations/meta.json
index 5fd8600a7..2e0135930 100644
--- a/docs/content/docs/api/organizations/meta.json
+++ b/docs/content/docs/api/organizations/meta.json
@@ -1,4 +1,4 @@
{
"title": "Organizations",
- "pages": ["list", "create-site", "members", "add-member"]
+ "pages": ["list", "sites", "create-site", "members", "add-member", "event-count"]
}
diff --git a/docs/content/docs/api/organizations/sites.mdx b/docs/content/docs/api/organizations/sites.mdx
new file mode 100644
index 000000000..19ccf2212
--- /dev/null
+++ b/docs/content/docs/api/organizations/sites.mdx
@@ -0,0 +1,288 @@
+---
+title: Get Organization Sites
+description: Returns all sites in an organization the caller can access, with usage and subscription info.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/organizations/:organizationId/sites
+```
+
+Returns all sites in an organization the caller can access, with usage and subscription info.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ organizationId: {
+ description: 'Organization ID',
+ type: 'string',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+This endpoint takes no query parameters.
+
+### Response
+
+<TypeTable
+ type={{
+ organization: {
+ description: 'The organization record, or null',
+ type: 'object | null',
+ },
+ sites: {
+ description: 'Array of site objects',
+ type: 'array',
+ },
+ subscription: {
+ description: 'Usage and subscription details for the organization',
+ type: 'object',
+ },
+ }}
+/>
+
+#### Site Object
+
+Each site in the `sites` array contains the following fields. Other site-config fields may also be present:
+
+<TypeTable
+ type={{
+ siteId: {
+ description: 'Site ID',
+ type: 'number',
+ },
+ name: {
+ description: 'Site display name',
+ type: 'string',
+ },
+ domain: {
+ description: 'Site domain',
+ type: 'string',
+ },
+ type: {
+ description: 'Site type',
+ type: 'string',
+ typeDescription: 'e.g. "web"',
+ },
+ public: {
+ description: 'Whether the site dashboard is public',
+ type: 'boolean',
+ },
+ organizationId: {
+ description: 'Organization ID the site belongs to',
+ type: 'string',
+ },
+ sessionsLast24Hours: {
+ description: 'Number of sessions in the last 24 hours',
+ type: 'number',
+ },
+ isOwner: {
+ description: 'Whether the caller owns the site',
+ type: 'boolean',
+ },
+ teams: {
+ description: 'Teams the site belongs to',
+ type: 'array',
+ typeDescription: 'Array of { id, name }',
+ },
+ }}
+/>
+
+#### Subscription Object
+
+<TypeTable
+ type={{
+ monthlyEventCount: {
+ description: 'Events recorded in the current month',
+ type: 'number',
+ },
+ eventLimit: {
+ description: 'Monthly event limit for the plan',
+ type: 'number',
+ },
+ overMonthlyLimit: {
+ description: 'Whether the monthly event limit has been exceeded',
+ type: 'boolean',
+ },
+ planName: {
+ description: 'Name of the active plan',
+ type: 'string',
+ },
+ status: {
+ description: 'Subscription status',
+ type: 'string',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/organizations/org_abc123/sites" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const organizationId = 'org_abc123';
+const response = await fetch(
+ `https://app.rybbit.io/api/organizations/${organizationId}/sites`,
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+organization_id = 'org_abc123'
+response = requests.get(
+ f'https://app.rybbit.io/api/organizations/{organization_id}/sites',
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$organizationId = 'org_abc123';
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/organizations/{$organizationId}/sites");
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+organization_id = 'org_abc123'
+uri = URI("https://app.rybbit.io/api/organizations/#{organization_id}/sites")
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+organizationId := "org_abc123"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/organizations/"+organizationId+"/sites", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let organization_id = "org_abc123";
+let client = reqwest::Client::new();
+let res = client
+ .get(format!("https://app.rybbit.io/api/organizations/{}/sites", organization_id))
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+String organizationId = "org_abc123";
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/organizations/" + organizationId + "/sites"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+var organizationId = "org_abc123";
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync($"https://app.rybbit.io/api/organizations/{organizationId}/sites");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "organization": {
+ "id": "org_abc123",
+ "name": "Acme Inc",
+ "slug": "acme",
+ "createdAt": "2024-01-15T10:30:00.000Z"
+ },
+ "sites": [
+ {
+ "siteId": 123,
+ "name": "Acme Marketing",
+ "domain": "acme.com",
+ "type": "web",
+ "public": false,
+ "organizationId": "org_abc123",
+ "sessionsLast24Hours": 842,
+ "isOwner": true,
+ "teams": [
+ {
+ "id": "team_xyz789",
+ "name": "Growth"
+ }
+ ]
+ }
+ ],
+ "subscription": {
+ "monthlyEventCount": 482910,
+ "eventLimit": 1000000,
+ "overMonthlyLimit": false,
+ "planName": "Pro",
+ "status": "active"
+ }
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/overview/meta.json b/docs/content/docs/api/overview/meta.json
index cf5c45b6a..37e9e6be8 100644
--- a/docs/content/docs/api/overview/meta.json
+++ b/docs/content/docs/api/overview/meta.json
@@ -1,4 +1,4 @@
{
"title": "Overview",
- "pages": ["overview", "time-series", "metric", "live-visitors"]
+ "pages": ["overview", "time-series", "metric", "page-titles", "live-visitors"]
}
diff --git a/docs/content/docs/api/overview/page-titles.mdx b/docs/content/docs/api/overview/page-titles.mdx
new file mode 100644
index 000000000..29954220a
--- /dev/null
+++ b/docs/content/docs/api/overview/page-titles.mdx
@@ -0,0 +1,227 @@
+---
+title: Get Page Titles
+description: Returns page-view metrics aggregated by HTML page title.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/page-titles
+```
+
+Returns page-view metrics aggregated by HTML page title.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) (time and filters).
+
+<TypeTable
+ type={{
+ limit: {
+ description: 'Maximum number of page titles to return',
+ type: 'number',
+ default: 10,
+ },
+ page: {
+ description: 'Page number (1-indexed). When provided, the response is paginated and includes a total count',
+ type: 'number',
+ required: false,
+ },
+ }}
+/>
+
+### Response
+
+<TypeTable
+ type={{
+ value: {
+ description: 'The page title',
+ type: 'string',
+ },
+ pathname: {
+ description: 'A representative path for the title',
+ type: 'string',
+ },
+ count: {
+ description: 'Unique sessions that viewed the title',
+ type: 'number',
+ },
+ percentage: {
+ description: 'Share of total',
+ type: 'number',
+ typeDescription: 'Range: 0-100',
+ },
+ pageviews: {
+ description: 'Total pageviews',
+ type: 'number',
+ },
+ bounce_rate: {
+ description: 'Bounce rate percentage',
+ type: 'number',
+ typeDescription: 'Range: 0-100',
+ },
+ time_on_page_seconds: {
+ description: 'Average time on page in seconds',
+ type: 'number',
+ },
+ }}
+/>
+
+When the `page` parameter is supplied, the response is paginated: `data` becomes an object `{ data: [...], totalCount: number }`.
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/page-titles?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York&limit=10" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/page-titles?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York&limit=10',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/page-titles',
+ params={
+ 'start_date': '2024-01-01',
+ 'end_date': '2024-01-31',
+ 'time_zone': 'America/New_York',
+ 'limit': 10
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/page-titles?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York&limit=10');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/page-titles?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York&limit=10')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/page-titles?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York&limit=10", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/page-titles?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York&limit=10")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/page-titles?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York&limit=10"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/page-titles?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York&limit=10");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "data": [
+ {
+ "value": "Home | Acme",
+ "pathname": "/",
+ "count": 8200,
+ "percentage": 41.2,
+ "pageviews": 12400,
+ "bounce_rate": 38.5,
+ "time_on_page_seconds": 47.2
+ }
+ ]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/overview/time-series.mdx b/docs/content/docs/api/overview/time-series.mdx
index 497d0a9b7..604484fae 100644
--- a/docs/content/docs/api/overview/time-series.mdx
+++ b/docs/content/docs/api/overview/time-series.mdx
@@ -12,7 +12,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
<div>
```
-GET /api/sites/:site/overview-bucketed
+GET /api/sites/:site/overview/time-series
```
Returns time-series analytics data broken down by configurable time buckets. Useful for charting trends over time.
@@ -98,14 +98,14 @@ Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) plu
<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
<Tab value="cURL">
```bash title="Request"
-curl -X GET "https://app.rybbit.io/api/sites/123/overview-bucketed?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York" \
+curl -X GET "https://app.rybbit.io/api/sites/123/overview/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York" \
-H "Authorization: Bearer your_api_key_here"
```
</Tab>
<Tab value="JavaScript">
```javascript title="Request"
const response = await fetch(
- 'https://app.rybbit.io/api/sites/123/overview-bucketed?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York',
+ 'https://app.rybbit.io/api/sites/123/overview/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York',
{
headers: {
'Authorization': 'Bearer your_api_key_here'
@@ -121,7 +121,7 @@ const data = await response.json();
import requests
response = requests.get(
- 'https://app.rybbit.io/api/sites/123/overview-bucketed',
+ 'https://app.rybbit.io/api/sites/123/overview/time-series',
params={
'bucket': 'day',
'start_date': '2024-01-01',
@@ -139,7 +139,7 @@ data = response.json()
<Tab value="PHP">
```php title="Request"
$ch = curl_init();
-curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/overview-bucketed?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York');
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/overview/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer your_api_key_here'
@@ -156,7 +156,7 @@ $data = json_decode($response, true);
require 'net/http'
require 'json'
-uri = URI('https://app.rybbit.io/api/sites/123/overview-bucketed?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York')
+uri = URI('https://app.rybbit.io/api/sites/123/overview/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer your_api_key_here'
@@ -166,7 +166,7 @@ data = JSON.parse(res.body)
</Tab>
<Tab value="Go">
```go title="Request"
-req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/overview-bucketed?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York", nil)
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/overview/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York", nil)
req.Header.Set("Authorization", "Bearer your_api_key_here")
client := &http.Client{}
@@ -181,7 +181,7 @@ json.NewDecoder(resp.Body).Decode(&data)
```rust title="Request"
let client = reqwest::Client::new();
let res = client
- .get("https://app.rybbit.io/api/sites/123/overview-bucketed?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York")
+ .get("https://app.rybbit.io/api/sites/123/overview/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York")
.header("Authorization", "Bearer your_api_key_here")
.send()
.await?;
@@ -193,7 +193,7 @@ let data: serde_json::Value = res.json().await?;
```java title="Request"
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
- .uri(URI.create("https://app.rybbit.io/api/sites/123/overview-bucketed?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York"))
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/overview/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York"))
.header("Authorization", "Bearer your_api_key_here")
.GET()
.build();
@@ -206,7 +206,7 @@ HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.o
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
-var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/overview-bucketed?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York");
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/overview/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=America/New_York");
var data = await response.Content.ReadAsStringAsync();
```
</Tab>
diff --git a/docs/content/docs/api/session-replay/delete.mdx b/docs/content/docs/api/session-replay/delete.mdx
new file mode 100644
index 000000000..191bdf567
--- /dev/null
+++ b/docs/content/docs/api/session-replay/delete.mdx
@@ -0,0 +1,171 @@
+---
+title: Delete Session Replay
+description: Permanently deletes a session replay recording. Requires site write access.
+full: true
+method: DELETE
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+DELETE /api/sites/:site/session-replay/:sessionId
+```
+
+Permanently deletes a session replay recording. Requires site write access.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ sessionId: {
+ description: 'The session to delete',
+ type: 'string',
+ required: true,
+ },
+ }}
+/>
+
+### Response
+
+<TypeTable
+ type={{
+ success: {
+ description: 'Whether the deletion was successful',
+ type: 'boolean',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X DELETE "https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d',
+ {
+ method: 'DELETE',
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.delete(
+ 'https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d',
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d')
+req = Net::HTTP::Delete.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("DELETE", "https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .delete("https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .DELETE()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.DeleteAsync("https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "success": true
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/session-replay/events.mdx b/docs/content/docs/api/session-replay/events.mdx
new file mode 100644
index 000000000..5955ef341
--- /dev/null
+++ b/docs/content/docs/api/session-replay/events.mdx
@@ -0,0 +1,190 @@
+---
+title: Get Session Replay Events
+description: Returns the rrweb events and metadata needed to reconstruct a session replay.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/session-replay/:sessionId
+```
+
+Returns the rrweb events and metadata needed to reconstruct a session replay.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ sessionId: {
+ description: 'The session to fetch',
+ type: 'string',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+This endpoint takes no query parameters.
+
+### Response
+
+<TypeTable
+ type={{
+ events: {
+ description: 'Array of rrweb event objects, replayed in order to reconstruct the session. Each carries a timestamp and rrweb-format payload.',
+ type: 'RRWebEvent[]',
+ },
+ metadata: {
+ description: "The session replay metadata object (same fields as a list item, enriched with the user's traits)",
+ type: 'SessionReplayMetadata',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d',
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/session-replay/a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "events": [
+ {
+ "type": 4,
+ "timestamp": 1705320000000,
+ "data": { }
+ }
+ ],
+ "metadata": {
+ "session_id": "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
+ "duration_ms": 48200,
+ "event_count": 312,
+ "browser": "Chrome",
+ "...": "..."
+ }
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/session-replay/list.mdx b/docs/content/docs/api/session-replay/list.mdx
new file mode 100644
index 000000000..f9a10cef1
--- /dev/null
+++ b/docs/content/docs/api/session-replay/list.mdx
@@ -0,0 +1,303 @@
+---
+title: Get Session Replays
+description: Returns recorded session replays with metadata, newest first.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/session-replay/list
+```
+
+Returns recorded session replays with metadata, newest first.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) (time and filters) plus the following:
+
+<TypeTable
+ type={{
+ limit: {
+ description: 'Number of results to return',
+ type: 'number',
+ default: 50,
+ },
+ offset: {
+ description: 'Number of results to skip',
+ type: 'number',
+ default: 0,
+ },
+ userId: {
+ description: 'Restrict to a single user',
+ type: 'string',
+ required: false,
+ },
+ minDuration: {
+ description: 'Minimum replay duration in seconds',
+ type: 'number',
+ required: false,
+ },
+ }}
+/>
+
+### Response
+
+<TypeTable
+ type={{
+ data: {
+ description: 'Array of session replay objects',
+ type: 'SessionReplay[]',
+ },
+ }}
+/>
+
+#### SessionReplay Object
+
+Identified users are enriched with their `traits`.
+
+<TypeTable
+ type={{
+ session_id: {
+ description: 'Unique session identifier',
+ type: 'string',
+ },
+ user_id: {
+ description: 'Device fingerprint identifier',
+ type: 'string',
+ },
+ identified_user_id: {
+ description: 'Custom user ID when identified',
+ type: 'string',
+ },
+ start_time: {
+ description: 'Replay start time',
+ type: 'string',
+ typeDescription: 'ISO 8601 datetime',
+ },
+ end_time: {
+ description: 'Replay end time',
+ type: 'string',
+ typeDescription: 'ISO 8601 datetime',
+ },
+ duration_ms: {
+ description: 'Duration in milliseconds',
+ type: 'number',
+ },
+ page_url: {
+ description: 'Entry page',
+ type: 'string',
+ },
+ event_count: {
+ description: 'Number of recorded events',
+ type: 'number',
+ },
+ country: {
+ description: 'Country code',
+ type: 'string',
+ },
+ region: {
+ description: 'Region/state',
+ type: 'string',
+ },
+ city: {
+ description: 'City name',
+ type: 'string',
+ },
+ browser: {
+ description: 'Browser name',
+ type: 'string',
+ },
+ browser_version: {
+ description: 'Browser version',
+ type: 'string',
+ },
+ operating_system: {
+ description: 'Operating system',
+ type: 'string',
+ },
+ operating_system_version: {
+ description: 'Operating system version',
+ type: 'string',
+ },
+ device_type: {
+ description: 'Device type',
+ type: 'string',
+ },
+ screen_width: {
+ description: 'Screen width in pixels',
+ type: 'number',
+ },
+ screen_height: {
+ description: 'Screen height in pixels',
+ type: 'number',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/session-replay/list?limit=50&offset=0&start_date=2024-01-01&end_date=2024-01-31" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/session-replay/list?limit=50&offset=0&start_date=2024-01-01&end_date=2024-01-31',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/session-replay/list',
+ params={
+ 'limit': 50,
+ 'offset': 0,
+ 'start_date': '2024-01-01',
+ 'end_date': '2024-01-31'
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/session-replay/list?limit=50&offset=0&start_date=2024-01-01&end_date=2024-01-31');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/session-replay/list?limit=50&offset=0&start_date=2024-01-01&end_date=2024-01-31')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/session-replay/list?limit=50&offset=0&start_date=2024-01-01&end_date=2024-01-31", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/session-replay/list?limit=50&offset=0&start_date=2024-01-01&end_date=2024-01-31")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/session-replay/list?limit=50&offset=0&start_date=2024-01-01&end_date=2024-01-31"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/session-replay/list?limit=50&offset=0&start_date=2024-01-01&end_date=2024-01-31");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "data": [
+ {
+ "session_id": "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
+ "user_id": "dev_xyz789",
+ "identified_user_id": "[email protected]",
+ "start_time": "2024-01-31T14:00:00.000Z",
+ "end_time": "2024-01-31T14:00:48.200Z",
+ "duration_ms": 48200,
+ "page_url": "/",
+ "event_count": 312,
+ "country": "US",
+ "region": "California",
+ "city": "San Francisco",
+ "browser": "Chrome",
+ "browser_version": "120.0.0",
+ "operating_system": "macOS",
+ "operating_system_version": "14.2",
+ "device_type": "desktop",
+ "screen_width": 1920,
+ "screen_height": 1080
+ }
+ ]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/session-replay/meta.json b/docs/content/docs/api/session-replay/meta.json
new file mode 100644
index 000000000..dd5bc415f
--- /dev/null
+++ b/docs/content/docs/api/session-replay/meta.json
@@ -0,0 +1,4 @@
+{
+ "title": "Session Replay",
+ "pages": ["list", "events", "delete"]
+}
diff --git a/docs/content/docs/api/sessions/locations.mdx b/docs/content/docs/api/sessions/locations.mdx
index eaf441949..2f59e9518 100644
--- a/docs/content/docs/api/sessions/locations.mdx
+++ b/docs/content/docs/api/sessions/locations.mdx
@@ -12,7 +12,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
<div>
```
-GET /api/sites/:site/session-locations
+GET /api/sites/:site/sessions/locations
```
Returns aggregated session locations with coordinates for map visualization.
@@ -77,14 +77,14 @@ Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) (ti
<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
<Tab value="cURL">
```bash title="Request"
-curl -X GET "https://app.rybbit.io/api/sites/1/session-locations?start_date=2024-01-01&end_date=2024-01-31" \
+curl -X GET "https://app.rybbit.io/api/sites/1/sessions/locations?start_date=2024-01-01&end_date=2024-01-31" \
-H "Authorization: Bearer your_api_key_here"
```
</Tab>
<Tab value="JavaScript">
```javascript title="Request"
const response = await fetch(
- 'https://app.rybbit.io/api/sites/1/session-locations?start_date=2024-01-01&end_date=2024-01-31',
+ 'https://app.rybbit.io/api/sites/1/sessions/locations?start_date=2024-01-01&end_date=2024-01-31',
{
headers: {
'Authorization': 'Bearer your_api_key_here'
@@ -100,7 +100,7 @@ const data = await response.json();
import requests
response = requests.get(
- 'https://app.rybbit.io/api/sites/1/session-locations',
+ 'https://app.rybbit.io/api/sites/1/sessions/locations',
params={
'start_date': '2024-01-01',
'end_date': '2024-01-31'
@@ -116,7 +116,7 @@ data = response.json()
<Tab value="PHP">
```php title="Request"
$ch = curl_init();
-curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/session-locations?start_date=2024-01-01&end_date=2024-01-31');
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/sessions/locations?start_date=2024-01-01&end_date=2024-01-31');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer your_api_key_here'
@@ -133,7 +133,7 @@ $data = json_decode($response, true);
require 'net/http'
require 'json'
-uri = URI('https://app.rybbit.io/api/sites/1/session-locations?start_date=2024-01-01&end_date=2024-01-31')
+uri = URI('https://app.rybbit.io/api/sites/1/sessions/locations?start_date=2024-01-01&end_date=2024-01-31')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer your_api_key_here'
@@ -143,7 +143,7 @@ data = JSON.parse(res.body)
</Tab>
<Tab value="Go">
```go title="Request"
-req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/1/session-locations?start_date=2024-01-01&end_date=2024-01-31", nil)
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/1/sessions/locations?start_date=2024-01-01&end_date=2024-01-31", nil)
req.Header.Set("Authorization", "Bearer your_api_key_here")
client := &http.Client{}
@@ -158,7 +158,7 @@ json.NewDecoder(resp.Body).Decode(&data)
```rust title="Request"
let client = reqwest::Client::new();
let res = client
- .get("https://app.rybbit.io/api/sites/1/session-locations?start_date=2024-01-01&end_date=2024-01-31")
+ .get("https://app.rybbit.io/api/sites/1/sessions/locations?start_date=2024-01-01&end_date=2024-01-31")
.header("Authorization", "Bearer your_api_key_here")
.send()
.await?;
@@ -170,7 +170,7 @@ let data: serde_json::Value = res.json().await?;
```java title="Request"
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
- .uri(URI.create("https://app.rybbit.io/api/sites/1/session-locations?start_date=2024-01-01&end_date=2024-01-31"))
+ .uri(URI.create("https://app.rybbit.io/api/sites/1/sessions/locations?start_date=2024-01-01&end_date=2024-01-31"))
.header("Authorization", "Bearer your_api_key_here")
.GET()
.build();
@@ -183,7 +183,7 @@ HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.o
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
-var response = await client.GetAsync("https://app.rybbit.io/api/sites/1/session-locations?start_date=2024-01-01&end_date=2024-01-31");
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/1/sessions/locations?start_date=2024-01-01&end_date=2024-01-31");
var data = await response.Content.ReadAsStringAsync();
```
</Tab>
diff --git a/docs/content/docs/api/sites/excluded-hostnames.mdx b/docs/content/docs/api/sites/excluded-hostnames.mdx
new file mode 100644
index 000000000..85f1321b7
--- /dev/null
+++ b/docs/content/docs/api/sites/excluded-hostnames.mdx
@@ -0,0 +1,173 @@
+---
+title: Get Excluded Hostnames
+description: Returns the list of hostnames excluded from analytics.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/excluded-hostnames
+```
+
+Returns the list of hostnames excluded from analytics.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ siteId: {
+ description: 'Site ID',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+This endpoint takes no query parameters.
+
+### Response
+
+<TypeTable
+ type={{
+ success: {
+ description: 'Whether the request was successful',
+ type: 'boolean',
+ },
+ excludedHostnames: {
+ description: 'Array of excluded hostnames',
+ type: 'string[]',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/excluded-hostnames" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/excluded-hostnames',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/excluded-hostnames',
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/excluded-hostnames');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/excluded-hostnames')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/excluded-hostnames", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/excluded-hostnames")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/excluded-hostnames"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/excluded-hostnames");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "success": true,
+ "excludedHostnames": [
+ "staging.example.com"
+ ]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/sites/excluded-paths.mdx b/docs/content/docs/api/sites/excluded-paths.mdx
new file mode 100644
index 000000000..0cc4bbdb3
--- /dev/null
+++ b/docs/content/docs/api/sites/excluded-paths.mdx
@@ -0,0 +1,174 @@
+---
+title: Get Excluded Paths
+description: Returns the list of URL paths excluded from analytics.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/excluded-paths
+```
+
+Returns the list of URL paths excluded from analytics.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ siteId: {
+ description: 'Site ID',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+This endpoint takes no query parameters.
+
+### Response
+
+<TypeTable
+ type={{
+ success: {
+ description: 'Whether the request was successful',
+ type: 'boolean',
+ },
+ excludedPaths: {
+ description: 'Array of excluded URL paths',
+ type: 'string[]',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/excluded-paths" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/excluded-paths',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/excluded-paths',
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/excluded-paths');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/excluded-paths')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/excluded-paths", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/excluded-paths")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/excluded-paths"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/excluded-paths");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "success": true,
+ "excludedPaths": [
+ "/admin",
+ "/internal/*"
+ ]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/sites/excluded-user-agents.mdx b/docs/content/docs/api/sites/excluded-user-agents.mdx
new file mode 100644
index 000000000..ecda220db
--- /dev/null
+++ b/docs/content/docs/api/sites/excluded-user-agents.mdx
@@ -0,0 +1,173 @@
+---
+title: Get Excluded User Agents
+description: Returns the list of user-agent patterns excluded from analytics.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/excluded-user-agents
+```
+
+Returns the list of user-agent patterns excluded from analytics.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ siteId: {
+ description: 'Site ID',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+This endpoint takes no query parameters.
+
+### Response
+
+<TypeTable
+ type={{
+ success: {
+ description: 'Whether the request was successful',
+ type: 'boolean',
+ },
+ excludedUserAgents: {
+ description: 'Array of excluded user-agent patterns',
+ type: 'string[]',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/excluded-user-agents" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/excluded-user-agents',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/excluded-user-agents',
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/excluded-user-agents');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/excluded-user-agents')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/excluded-user-agents", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/excluded-user-agents")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/excluded-user-agents"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/excluded-user-agents");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "success": true,
+ "excludedUserAgents": [
+ "*HeadlessChrome*"
+ ]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/sites/export-pdf.mdx b/docs/content/docs/api/sites/export-pdf.mdx
new file mode 100644
index 000000000..97dcc70a0
--- /dev/null
+++ b/docs/content/docs/api/sites/export-pdf.mdx
@@ -0,0 +1,188 @@
+---
+title: Export PDF Report
+description: Generates a downloadable PDF analytics report for a date range.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/export/pdf
+```
+
+Generates a downloadable PDF analytics report for a date range.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+<TypeTable
+ type={{
+ start_date: {
+ description: 'Start of the date range',
+ type: 'string',
+ typeDescription: 'YYYY-MM-DD',
+ required: true,
+ },
+ end_date: {
+ description: 'End of the date range',
+ type: 'string',
+ typeDescription: 'YYYY-MM-DD',
+ required: true,
+ },
+ time_zone: {
+ description: 'IANA timezone',
+ type: 'string',
+ required: true,
+ },
+ filters: {
+ description: 'JSON-encoded filter array (same format as the Common Parameters filters)',
+ type: 'string',
+ },
+ }}
+/>
+
+### Response
+
+Returns a binary PDF file (`Content-Type: application/pdf`). Save the response body to a `.pdf` file rather than parsing it as JSON.
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/export/pdf?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York" \
+ -H "Authorization: Bearer your_api_key_here" \
+ -o report.pdf
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/export/pdf?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const blob = await response.blob();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/export/pdf',
+ params={
+ 'start_date': '2024-01-01',
+ 'end_date': '2024-01-31',
+ 'time_zone': 'America/New_York'
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+with open('report.pdf', 'wb') as f:
+ f.write(response.content)
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/export/pdf?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+file_put_contents('report.pdf', $response);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+
+uri = URI('https://app.rybbit.io/api/sites/123/export/pdf?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+File.binwrite('report.pdf', res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/export/pdf?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+out, _ := os.Create("report.pdf")
+defer out.Close()
+io.Copy(out, resp.Body)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/export/pdf?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let bytes = res.bytes().await?;
+std::fs::write("report.pdf", &bytes)?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/export/pdf?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<Path> response = client.send(request, HttpResponse.BodyHandlers.ofFile(Path.of("report.pdf")));
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/export/pdf?start_date=2024-01-01&end_date=2024-01-31&time_zone=America/New_York");
+var bytes = await response.Content.ReadAsByteArrayAsync();
+File.WriteAllBytes("report.pdf", bytes);
+```
+ </Tab>
+</Tabs>
+
+</div>
+</div>
diff --git a/docs/content/docs/api/sites/has-data.mdx b/docs/content/docs/api/sites/has-data.mdx
new file mode 100644
index 000000000..3048a8198
--- /dev/null
+++ b/docs/content/docs/api/sites/has-data.mdx
@@ -0,0 +1,166 @@
+---
+title: Get Site Has Data
+description: Returns whether the site has received any analytics events.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/has-data
+```
+
+Returns whether the site has received any analytics events.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ siteId: {
+ description: 'Site ID',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+This endpoint takes no query parameters.
+
+### Response
+
+<TypeTable
+ type={{
+ hasData: {
+ description: 'Whether the site has received any analytics events',
+ type: 'boolean',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/has-data" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/has-data',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/has-data',
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/has-data');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/has-data')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/has-data", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/has-data")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/has-data"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/has-data");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "hasData": true
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/sites/is-public.mdx b/docs/content/docs/api/sites/is-public.mdx
new file mode 100644
index 000000000..11de4cfa5
--- /dev/null
+++ b/docs/content/docs/api/sites/is-public.mdx
@@ -0,0 +1,166 @@
+---
+title: Get Site Public Status
+description: Returns whether the site's analytics are publicly accessible.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/is-public
+```
+
+Returns whether the site's analytics are publicly accessible.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ siteId: {
+ description: 'Site ID',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+This endpoint takes no query parameters.
+
+### Response
+
+<TypeTable
+ type={{
+ isPublic: {
+ description: "Whether the site's analytics are publicly accessible",
+ type: 'boolean',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/is-public" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/is-public',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/is-public',
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/is-public');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/is-public')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/is-public", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/is-public")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/is-public"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/is-public");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "isPublic": false
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/sites/meta.json b/docs/content/docs/api/sites/meta.json
index b0e835520..8322d6bd0 100644
--- a/docs/content/docs/api/sites/meta.json
+++ b/docs/content/docs/api/sites/meta.json
@@ -1,4 +1,4 @@
{
"title": "Sites",
- "pages": ["get", "delete", "update-config", "excluded-ips", "excluded-countries", "get-private-link", "update-private-link"]
+ "pages": ["get", "has-data", "is-public", "delete", "update-config", "excluded-ips", "excluded-countries", "excluded-paths", "excluded-hostnames", "excluded-user-agents", "get-private-link", "update-private-link", "export-pdf"]
}
diff --git a/docs/content/docs/api/teams/create.mdx b/docs/content/docs/api/teams/create.mdx
new file mode 100644
index 000000000..b907f78a7
--- /dev/null
+++ b/docs/content/docs/api/teams/create.mdx
@@ -0,0 +1,274 @@
+---
+title: Create Team
+description: Creates a team in an organization. Requires admin/owner role.
+full: true
+method: POST
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+POST /api/organizations/:organizationId/teams
+```
+
+Creates a team in an organization. Requires admin/owner role.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ organizationId: {
+ description: 'Organization ID',
+ type: 'string',
+ required: true,
+ },
+ }}
+/>
+
+### Request Body
+
+<TypeTable
+ type={{
+ name: {
+ description: 'Team name',
+ type: 'string',
+ required: true,
+ },
+ memberUserIds: {
+ description: 'User IDs to add to the team (must be members of the organization)',
+ type: 'string[]',
+ required: false,
+ },
+ siteIds: {
+ description: 'Site IDs the team can access (must belong to the organization)',
+ type: 'number[]',
+ required: false,
+ },
+ }}
+/>
+
+### Response
+
+Returns the created team with HTTP 201.
+
+<TypeTable
+ type={{
+ id: {
+ description: 'Team ID',
+ type: 'string',
+ },
+ name: {
+ description: 'Team name',
+ type: 'string',
+ },
+ organizationId: {
+ description: 'Organization ID the team belongs to',
+ type: 'string',
+ },
+ createdAt: {
+ description: 'Timestamp when the team was created',
+ type: 'string',
+ typeDescription: 'ISO 8601 datetime',
+ },
+ updatedAt: {
+ description: 'Timestamp when the team was last updated',
+ type: 'string',
+ typeDescription: 'ISO 8601 datetime',
+ },
+ members: {
+ description: 'Array of added user IDs',
+ type: 'string[]',
+ },
+ siteIds: {
+ description: 'Array of granted site IDs',
+ type: 'number[]',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X POST "https://app.rybbit.io/api/organizations/org_abc123/teams" \
+ -H "Authorization: Bearer your_api_key_here" \
+ -H "Content-Type: application/json" \
+ -d '{"name": "Marketing", "memberUserIds": ["user_123"], "siteIds": [123]}'
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const organizationId = 'org_abc123';
+const response = await fetch(
+ `https://app.rybbit.io/api/organizations/${organizationId}/teams`,
+ {
+ method: 'POST',
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here',
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ name: 'Marketing',
+ memberUserIds: ['user_123'],
+ siteIds: [123]
+ })
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+organization_id = 'org_abc123'
+response = requests.post(
+ f'https://app.rybbit.io/api/organizations/{organization_id}/teams',
+ json={
+ 'name': 'Marketing',
+ 'memberUserIds': ['user_123'],
+ 'siteIds': [123]
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$organizationId = 'org_abc123';
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/organizations/{$organizationId}/teams");
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_POST, true);
+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
+ 'name' => 'Marketing',
+ 'memberUserIds' => ['user_123'],
+ 'siteIds' => [123]
+]));
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here',
+ 'Content-Type: application/json'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+organization_id = 'org_abc123'
+uri = URI("https://app.rybbit.io/api/organizations/#{organization_id}/teams")
+req = Net::HTTP::Post.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+req['Content-Type'] = 'application/json'
+req.body = {
+ name: 'Marketing',
+ memberUserIds: ['user_123'],
+ siteIds: [123]
+}.to_json
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+organizationId := "org_abc123"
+body := bytes.NewBuffer([]byte(`{
+ "name": "Marketing",
+ "memberUserIds": ["user_123"],
+ "siteIds": [123]
+}`))
+req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/organizations/"+organizationId+"/teams", body)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+req.Header.Set("Content-Type", "application/json")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let organization_id = "org_abc123";
+let client = reqwest::Client::new();
+let res = client
+ .post(format!("https://app.rybbit.io/api/organizations/{}/teams", organization_id))
+ .header("Authorization", "Bearer your_api_key_here")
+ .json(&serde_json::json!({
+ "name": "Marketing",
+ "memberUserIds": ["user_123"],
+ "siteIds": [123]
+ }))
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+String organizationId = "org_abc123";
+HttpClient client = HttpClient.newHttpClient();
+String json = "{\"name\": \"Marketing\", \"memberUserIds\": [\"user_123\"], \"siteIds\": [123]}";
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/organizations/" + organizationId + "/teams"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .header("Content-Type", "application/json")
+ .POST(HttpRequest.BodyPublishers.ofString(json))
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+var organizationId = "org_abc123";
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var content = new StringContent(
+ "{\"name\": \"Marketing\", \"memberUserIds\": [\"user_123\"], \"siteIds\": [123]}",
+ Encoding.UTF8,
+ "application/json"
+);
+
+var response = await client.PostAsync($"https://app.rybbit.io/api/organizations/{organizationId}/teams", content);
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "id": "team_xyz789",
+ "name": "Marketing",
+ "organizationId": "org_abc123",
+ "createdAt": "2024-01-15T10:30:00.000Z",
+ "updatedAt": "2024-01-15T10:30:00.000Z",
+ "members": ["user_123"],
+ "siteIds": [123]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/teams/delete.mdx b/docs/content/docs/api/teams/delete.mdx
new file mode 100644
index 000000000..b64263d11
--- /dev/null
+++ b/docs/content/docs/api/teams/delete.mdx
@@ -0,0 +1,174 @@
+---
+title: Delete Team
+description: Deletes a team. Requires admin/owner role.
+full: true
+method: DELETE
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+DELETE /api/organizations/:organizationId/teams/:teamId
+```
+
+Deletes a team. Requires admin/owner role.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ organizationId: {
+ description: 'Organization ID',
+ type: 'string',
+ required: true,
+ },
+ teamId: {
+ description: 'ID of the team to delete',
+ type: 'string',
+ required: true,
+ },
+ }}
+/>
+
+### Response
+
+<TypeTable
+ type={{
+ success: {
+ description: 'Whether the team was deleted',
+ type: 'boolean',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X DELETE "https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789',
+ {
+ method: 'DELETE',
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.delete(
+ 'https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789',
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789')
+request = Net::HTTP::Delete.new(uri)
+request['Authorization'] = 'Bearer your_api_key_here'
+
+response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
+ http.request(request)
+end
+
+data = JSON.parse(response.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("DELETE", "https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .delete("https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .DELETE()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.DeleteAsync("https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "success": true
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/teams/list.mdx b/docs/content/docs/api/teams/list.mdx
new file mode 100644
index 000000000..513c57015
--- /dev/null
+++ b/docs/content/docs/api/teams/list.mdx
@@ -0,0 +1,277 @@
+---
+title: Get Teams
+description: Returns the teams in an organization, with their members and accessible sites.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/organizations/:organizationId/teams
+```
+
+Returns the teams in an organization, with their members and accessible sites.
+
+Any organization member may call this. Members who are not an admin/owner only see the teams they belong to.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ organizationId: {
+ description: 'Organization ID',
+ type: 'string',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+This endpoint takes no query parameters.
+
+### Response
+
+<TypeTable
+ type={{
+ teams: {
+ description: 'Array of teams in the organization',
+ type: 'array',
+ },
+ }}
+/>
+
+#### Team Object
+
+Each team in the `teams` array contains:
+
+<TypeTable
+ type={{
+ id: {
+ description: 'Team ID',
+ type: 'string',
+ },
+ name: {
+ description: 'Team name',
+ type: 'string',
+ },
+ organizationId: {
+ description: 'Organization ID the team belongs to',
+ type: 'string',
+ },
+ createdAt: {
+ description: 'Timestamp when the team was created',
+ type: 'string',
+ typeDescription: 'ISO 8601 datetime',
+ },
+ updatedAt: {
+ description: 'Timestamp when the team was last updated',
+ type: 'string',
+ typeDescription: 'ISO 8601 datetime',
+ },
+ members: {
+ description: 'Members of the team',
+ type: 'array',
+ },
+ sites: {
+ description: 'Sites the team can access',
+ type: 'array',
+ },
+ }}
+/>
+
+#### Member Object
+
+<TypeTable
+ type={{
+ userId: {
+ description: 'User ID',
+ type: 'string',
+ },
+ userName: {
+ description: 'User display name',
+ type: 'string',
+ },
+ userEmail: {
+ description: 'User email address',
+ type: 'string',
+ },
+ }}
+/>
+
+#### Site Object
+
+<TypeTable
+ type={{
+ siteId: {
+ description: 'Site ID',
+ type: 'number',
+ },
+ domain: {
+ description: 'Site domain',
+ type: 'string',
+ },
+ name: {
+ description: 'Site name',
+ type: 'string',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/organizations/org_abc123/teams" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const organizationId = 'org_abc123';
+const response = await fetch(
+ `https://app.rybbit.io/api/organizations/${organizationId}/teams`,
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+organization_id = 'org_abc123'
+response = requests.get(
+ f'https://app.rybbit.io/api/organizations/{organization_id}/teams',
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$organizationId = 'org_abc123';
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/organizations/{$organizationId}/teams");
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+organization_id = 'org_abc123'
+uri = URI("https://app.rybbit.io/api/organizations/#{organization_id}/teams")
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+organizationId := "org_abc123"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/organizations/"+organizationId+"/teams", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let organization_id = "org_abc123";
+let client = reqwest::Client::new();
+let res = client
+ .get(format!("https://app.rybbit.io/api/organizations/{}/teams", organization_id))
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+String organizationId = "org_abc123";
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/organizations/" + organizationId + "/teams"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+var organizationId = "org_abc123";
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync($"https://app.rybbit.io/api/organizations/{organizationId}/teams");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "teams": [
+ {
+ "id": "team_xyz789",
+ "name": "Marketing",
+ "organizationId": "org_abc123",
+ "createdAt": "2024-01-15T10:30:00.000Z",
+ "updatedAt": "2024-02-20T14:15:00.000Z",
+ "members": [
+ {
+ "userId": "user_123",
+ "userName": "John Doe",
+ "userEmail": "[email protected]"
+ }
+ ],
+ "sites": [
+ {
+ "siteId": 123,
+ "domain": "example.com",
+ "name": "Example Site"
+ }
+ ]
+ }
+ ]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/teams/meta.json b/docs/content/docs/api/teams/meta.json
new file mode 100644
index 000000000..8803858b2
--- /dev/null
+++ b/docs/content/docs/api/teams/meta.json
@@ -0,0 +1,4 @@
+{
+ "title": "Teams",
+ "pages": ["list", "create", "update", "delete"]
+}
diff --git a/docs/content/docs/api/teams/update.mdx b/docs/content/docs/api/teams/update.mdx
new file mode 100644
index 000000000..e830258ea
--- /dev/null
+++ b/docs/content/docs/api/teams/update.mdx
@@ -0,0 +1,256 @@
+---
+title: Update Team
+description: Updates a team's name, members, or site access. Requires admin/owner role.
+full: true
+method: PUT
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+PUT /api/organizations/:organizationId/teams/:teamId
+```
+
+Updates a team's name, members, or site access. Requires admin/owner role.
+
+When `memberUserIds` or `siteIds` is provided, it **replaces** the team's entire existing set (it is not merged). Omit a field to leave it unchanged.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ organizationId: {
+ description: 'Organization ID',
+ type: 'string',
+ required: true,
+ },
+ teamId: {
+ description: 'ID of the team to update',
+ type: 'string',
+ required: true,
+ },
+ }}
+/>
+
+### Request Body
+
+<TypeTable
+ type={{
+ name: {
+ description: 'Updated team name',
+ type: 'string',
+ required: false,
+ },
+ memberUserIds: {
+ description: 'User IDs to set as the team members (replaces the existing set)',
+ type: 'string[]',
+ required: false,
+ },
+ siteIds: {
+ description: 'Site IDs to set as the team site access (replaces the existing set)',
+ type: 'number[]',
+ required: false,
+ },
+ }}
+/>
+
+### Response
+
+<TypeTable
+ type={{
+ success: {
+ description: 'Whether the team was updated',
+ type: 'boolean',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X PUT "https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789" \
+ -H "Authorization: Bearer your_api_key_here" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name": "Growth",
+ "memberUserIds": ["user_123", "user_456"]
+ }'
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789',
+ {
+ method: 'PUT',
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here',
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ name: 'Growth',
+ memberUserIds: ['user_123', 'user_456']
+ })
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.put(
+ 'https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789',
+ json={
+ 'name': 'Growth',
+ 'memberUserIds': ['user_123', 'user_456']
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$body = [
+ 'name' => 'Growth',
+ 'memberUserIds' => ['user_123', 'user_456']
+];
+
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here',
+ 'Content-Type: application/json'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789')
+request = Net::HTTP::Put.new(uri)
+request['Authorization'] = 'Bearer your_api_key_here'
+request['Content-Type'] = 'application/json'
+request.body = {
+ name: 'Growth',
+ memberUserIds: ['user_123', 'user_456']
+}.to_json
+
+response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
+ http.request(request)
+end
+
+data = JSON.parse(response.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+body := map[string]interface{}{
+ "name": "Growth",
+ "memberUserIds": []string{"user_123", "user_456"},
+}
+jsonBody, _ := json.Marshal(body)
+
+req, _ := http.NewRequest("PUT", "https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789", bytes.NewBuffer(jsonBody))
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+req.Header.Set("Content-Type", "application/json")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let body = serde_json::json!({
+ "name": "Growth",
+ "memberUserIds": ["user_123", "user_456"]
+});
+
+let client = reqwest::Client::new();
+let res = client
+ .put("https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789")
+ .header("Authorization", "Bearer your_api_key_here")
+ .json(&body)
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+String json = """
+{
+ "name": "Growth",
+ "memberUserIds": ["user_123", "user_456"]
+}
+""";
+
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .header("Content-Type", "application/json")
+ .PUT(HttpRequest.BodyPublishers.ofString(json))
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+var body = new
+{
+ name = "Growth",
+ memberUserIds = new[] { "user_123", "user_456" }
+};
+
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var content = new StringContent(
+ JsonSerializer.Serialize(body),
+ Encoding.UTF8,
+ "application/json");
+
+var response = await client.PutAsync("https://app.rybbit.io/api/organizations/org_abc123/teams/team_xyz789", content);
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "success": true
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/user-traits/keys.mdx b/docs/content/docs/api/user-traits/keys.mdx
new file mode 100644
index 000000000..d45459668
--- /dev/null
+++ b/docs/content/docs/api/user-traits/keys.mdx
@@ -0,0 +1,186 @@
+---
+title: Get User Trait Keys
+description: Returns the known user trait keys with the number of users that have each.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/user-traits/keys
+```
+
+Returns the known user trait keys with the number of users that have each.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+This endpoint takes no query parameters.
+
+### Response
+
+<TypeTable
+ type={{
+ keys: {
+ description: 'Array of user trait keys',
+ type: 'TraitKey[]',
+ },
+ }}
+/>
+
+#### TraitKey Object
+
+<TypeTable
+ type={{
+ key: {
+ description: 'The trait name',
+ type: 'string',
+ },
+ userCount: {
+ description: 'Number of users that have this trait',
+ type: 'number',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/user-traits/keys" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/user-traits/keys',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/user-traits/keys',
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/user-traits/keys');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/user-traits/keys')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/user-traits/keys", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/user-traits/keys")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/user-traits/keys"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/user-traits/keys");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "keys": [
+ { "key": "plan", "userCount": 1240 },
+ { "key": "company", "userCount": 860 }
+ ]
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/user-traits/meta.json b/docs/content/docs/api/user-traits/meta.json
new file mode 100644
index 000000000..c09148c20
--- /dev/null
+++ b/docs/content/docs/api/user-traits/meta.json
@@ -0,0 +1,4 @@
+{
+ "title": "User Traits",
+ "pages": ["keys", "values", "users"]
+}
diff --git a/docs/content/docs/api/user-traits/users.mdx b/docs/content/docs/api/user-traits/users.mdx
new file mode 100644
index 000000000..1dac8cd25
--- /dev/null
+++ b/docs/content/docs/api/user-traits/users.mdx
@@ -0,0 +1,265 @@
+---
+title: Get Users by Trait
+description: Returns users matching a specific trait key and value, with location and session metadata.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/user-traits/users
+```
+
+Returns users matching a specific trait key and value, with location and session metadata.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+<TypeTable
+ type={{
+ key: {
+ description: 'The trait key to match on',
+ type: 'string',
+ required: true,
+ },
+ value: {
+ description: 'The trait value to match on',
+ type: 'string',
+ required: true,
+ },
+ limit: {
+ description: 'Maximum number of users to return',
+ type: 'number',
+ default: '50',
+ },
+ offset: {
+ description: 'Number of users to skip',
+ type: 'number',
+ default: '0',
+ },
+ }}
+/>
+
+### Response
+
+<TypeTable
+ type={{
+ users: {
+ description: 'Array of matching users',
+ type: 'TraitUser[]',
+ },
+ total: {
+ description: 'Total number of matching users',
+ type: 'number',
+ },
+ hasMore: {
+ description: 'Whether more users are available beyond this page',
+ type: 'boolean',
+ },
+ }}
+/>
+
+#### TraitUser Object
+
+<TypeTable
+ type={{
+ user_id: {
+ description: 'Device fingerprint identifier',
+ type: 'string',
+ },
+ identified_user_id: {
+ description: 'Custom user ID when identified',
+ type: 'string',
+ },
+ traits: {
+ description: "The user's full traits map",
+ type: 'object',
+ },
+ country: {
+ description: 'Country code',
+ type: 'string',
+ },
+ region: {
+ description: 'Region/state',
+ type: 'string',
+ },
+ city: {
+ description: 'City name',
+ type: 'string',
+ },
+ browser: {
+ description: 'Browser name',
+ type: 'string',
+ },
+ operating_system: {
+ description: 'Operating system name',
+ type: 'string',
+ },
+ device_type: {
+ description: 'Device type',
+ type: 'string',
+ },
+ sessions: {
+ description: 'Total number of sessions',
+ type: 'number',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/user-traits/users',
+ params={
+ 'key': 'plan',
+ 'value': 'pro'
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "users": [
+ {
+ "user_id": "a1b2c3",
+ "identified_user_id": "user_987",
+ "traits": { "plan": "pro", "company": "Acme" },
+ "country": "US",
+ "region": "California",
+ "city": "CA-San Francisco",
+ "browser": "Chrome",
+ "operating_system": "macOS",
+ "device_type": "desktop",
+ "sessions": 14
+ }
+ ],
+ "total": 1,
+ "hasMore": false
+}
+```
+
+</div>
+</div>
diff --git a/docs/content/docs/api/user-traits/values.mdx b/docs/content/docs/api/user-traits/values.mdx
new file mode 100644
index 000000000..e8b8b0d85
--- /dev/null
+++ b/docs/content/docs/api/user-traits/values.mdx
@@ -0,0 +1,217 @@
+---
+title: Get User Trait Values
+description: Returns the distinct values for a given trait key, with user counts.
+full: true
+method: GET
+---
+
+import { TypeTable } from 'fumadocs-ui/components/type-table';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">
+<div>
+
+```
+GET /api/sites/:site/user-traits/values
+```
+
+Returns the distinct values for a given trait key, with user counts.
+
+### Path Parameters
+
+<TypeTable
+ type={{
+ site: {
+ description: 'Site ID or site identifier',
+ type: 'string | number',
+ required: true,
+ },
+ }}
+/>
+
+### Query Parameters
+
+<TypeTable
+ type={{
+ key: {
+ description: 'The trait key to list values for',
+ type: 'string',
+ required: true,
+ },
+ limit: {
+ description: 'Maximum number of values to return',
+ type: 'number',
+ default: '1000',
+ },
+ offset: {
+ description: 'Number of values to skip',
+ type: 'number',
+ default: '0',
+ },
+ }}
+/>
+
+### Response
+
+<TypeTable
+ type={{
+ values: {
+ description: 'Array of distinct trait values',
+ type: 'TraitValue[]',
+ },
+ total: {
+ description: 'Total number of distinct values',
+ type: 'number',
+ },
+ hasMore: {
+ description: 'Whether more values are available beyond this page',
+ type: 'boolean',
+ },
+ }}
+/>
+
+#### TraitValue Object
+
+<TypeTable
+ type={{
+ value: {
+ description: 'The trait value',
+ type: 'string',
+ },
+ userCount: {
+ description: 'Number of users with this value',
+ type: 'number',
+ },
+ }}
+/>
+
+</div>
+<div className="flex flex-col gap-4">
+
+<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>
+ <Tab value="cURL">
+```bash title="Request"
+curl -X GET "https://app.rybbit.io/api/sites/123/user-traits/values?key=plan" \
+ -H "Authorization: Bearer your_api_key_here"
+```
+ </Tab>
+ <Tab value="JavaScript">
+```javascript title="Request"
+const response = await fetch(
+ 'https://app.rybbit.io/api/sites/123/user-traits/values?key=plan',
+ {
+ headers: {
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+ }
+);
+
+const data = await response.json();
+```
+ </Tab>
+ <Tab value="Python">
+```python title="Request"
+import requests
+
+response = requests.get(
+ 'https://app.rybbit.io/api/sites/123/user-traits/values',
+ params={
+ 'key': 'plan'
+ },
+ headers={
+ 'Authorization': 'Bearer your_api_key_here'
+ }
+)
+
+data = response.json()
+```
+ </Tab>
+ <Tab value="PHP">
+```php title="Request"
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/user-traits/values?key=plan');
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_HTTPHEADER, [
+ 'Authorization: Bearer your_api_key_here'
+]);
+
+$response = curl_exec($ch);
+curl_close($ch);
+
+$data = json_decode($response, true);
+```
+ </Tab>
+ <Tab value="Ruby">
+```ruby title="Request"
+require 'net/http'
+require 'json'
+
+uri = URI('https://app.rybbit.io/api/sites/123/user-traits/values?key=plan')
+req = Net::HTTP::Get.new(uri)
+req['Authorization'] = 'Bearer your_api_key_here'
+
+res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
+data = JSON.parse(res.body)
+```
+ </Tab>
+ <Tab value="Go">
+```go title="Request"
+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/user-traits/values?key=plan", nil)
+req.Header.Set("Authorization", "Bearer your_api_key_here")
+
+client := &http.Client{}
+resp, _ := client.Do(req)
+defer resp.Body.Close()
+
+var data map[string]interface{}
+json.NewDecoder(resp.Body).Decode(&data)
+```
+ </Tab>
+ <Tab value="Rust">
+```rust title="Request"
+let client = reqwest::Client::new();
+let res = client
+ .get("https://app.rybbit.io/api/sites/123/user-traits/values?key=plan")
+ .header("Authorization", "Bearer your_api_key_here")
+ .send()
+ .await?;
+
+let data: serde_json::Value = res.json().await?;
+```
+ </Tab>
+ <Tab value="Java">
+```java title="Request"
+HttpClient client = HttpClient.newHttpClient();
+HttpRequest request = HttpRequest.newBuilder()
+ .uri(URI.create("https://app.rybbit.io/api/sites/123/user-traits/values?key=plan"))
+ .header("Authorization", "Bearer your_api_key_here")
+ .GET()
+ .build();
+
+HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+```
+ </Tab>
+ <Tab value=".NET">
+```csharp title="Request"
+using var client = new HttpClient();
+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
+
+var response = await client.GetAsync("https://app.rybbit.io/api/sites/123/user-traits/values?key=plan");
+var data = await response.Content.ReadAsStringAsync();
+```
+ </Tab>
+</Tabs>
+
+```json title="Response"
+{
+ "values": [
+ { "value": "pro", "userCount": 340 },
+ { "value": "free", "userCount": 900 }
+ ],
+ "total": 2,
+ "hasMore": false
+}
+```
+
+</div>
+</div>
diff --git a/server/src/index.ts b/server/src/index.ts
index dbbf5889e..add86866d 100644
--- a/server/src/index.ts
+++ b/server/src/index.ts
@@ -273,22 +273,22 @@ async function analyticsRoutes(fastify: FastifyInstance) {
// This endpoint gets called a lot so we don't want to log it
fastify.get("/sites/:siteId/live-user-count", { logLevel: "silent", ...publicSite }, getLiveUsercount);
fastify.get("/sites/:siteId/overview", publicSite, getOverview);
- fastify.get("/sites/:siteId/overview-bucketed", publicSite, getOverviewBucketed);
+ fastify.get("/sites/:siteId/overview/time-series", publicSite, getOverviewBucketed);
fastify.get("/sites/:siteId/overview-lite", publicSite, getOverviewLite);
fastify.get("/sites/:siteId/overview-bucketed-lite", publicSite, getOverviewBucketedLite);
fastify.get("/sites/:siteId/metric-lite", publicSite, getMetricLite);
fastify.get("/sites/:siteId/metric", publicSite, getMetric);
fastify.get("/sites/:siteId/page-titles", publicSite, getPageTitles);
- fastify.get("/sites/:siteId/error-names", publicSite, getErrorNames);
- fastify.get("/sites/:siteId/error-events", publicSite, getErrorEvents);
- fastify.get("/sites/:siteId/error-bucketed", publicSite, getErrorBucketed);
+ fastify.get("/sites/:siteId/errors/names", publicSite, getErrorNames);
+ fastify.get("/sites/:siteId/errors/events", publicSite, getErrorEvents);
+ fastify.get("/sites/:siteId/errors/time-series", publicSite, getErrorBucketed);
fastify.get("/sites/:siteId/retention", publicSite, getRetention);
fastify.get("/sites/:siteId/has-data", publicSite, getSiteHasData);
fastify.get("/sites/:siteId/is-public", publicSite, getSiteIsPublic);
fastify.get("/sites/:siteId/sessions", publicSite, getSessions);
fastify.get("/sites/:siteId/sessions/:sessionId", publicSite, getSession);
fastify.get("/sites/:siteId/events", publicSite, getEvents);
- fastify.get("/sites/:siteId/events/bucketed", publicSite, getEventBucketed);
+ fastify.get("/sites/:siteId/events/time-series", publicSite, getEventBucketed);
fastify.get("/sites/:siteId/events/count", publicSite, getSiteEventCount);
fastify.get("/sites/:siteId/users", publicSite, getUsers);
@@ -297,7 +297,7 @@ async function analyticsRoutes(fastify: FastifyInstance) {
fastify.get("/sites/:siteId/user-traits/keys", publicSite, getUserTraitKeys);
fastify.get("/sites/:siteId/user-traits/values", publicSite, getUserTraitValues);
fastify.get("/sites/:siteId/user-traits/users", publicSite, getUserTraitValueUsers);
- fastify.get("/sites/:siteId/session-locations", publicSite, getSessionLocations);
+ fastify.get("/sites/:siteId/sessions/locations", publicSite, getSessionLocations);
fastify.get("/sites/:siteId/funnels", publicSite, getFunnels);
fastify.get("/sites/:siteId/journeys", publicSite, getJourneys);
fastify.post("/sites/:siteId/funnels/analyze", publicSite, getFunnel);
@@ -305,7 +305,7 @@ async function analyticsRoutes(fastify: FastifyInstance) {
fastify.post("/sites/:siteId/funnels", authSite, createFunnel);
fastify.delete("/sites/:siteId/funnels/:funnelId", authSite, deleteFunnel);
fastify.get("/sites/:siteId/goals", publicSite, getGoals);
- fastify.get("/sites/:siteId/goals/bucketed", publicSite, getGoalTimeSeries);
+ fastify.get("/sites/:siteId/goals/time-series", publicSite, getGoalTimeSeries);
fastify.get("/sites/:siteId/goals/:goalId/sessions", publicSite, getGoalSessions);
fastify.post("/sites/:siteId/goals", authSite, createGoal);
fastify.delete("/sites/:siteId/goals/:goalId", authSite, deleteGoal);