🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Remove outdated API documentation files for organizations, sites, errors, events, funnels, goals, and miscellaneous statistics. This cleanup enhances the overall documentation structure and eliminates redundancy, ensuring a more streamlined user experience.
Bill Yang0c2368c5a9c0
diff --git a/client/src/app/[site]/goals/components/GoalCard.tsx b/client/src/app/[site]/goals/components/GoalCard.tsxindex ff57e5594..acb4ffac6 100644--- a/client/src/app/[site]/goals/components/GoalCard.tsx+++ b/client/src/app/[site]/goals/components/GoalCard.tsx@@ -117,7 +117,7 @@ function GoalMetricBarChart({const metricLabel = metric === "conversions" ? t("Conversions") : t("Conversion Rate");return (- <div className="hidden md:flex h-8 w-48 shrink-0 items-end gap-px">+ <div className="hidden lg:flex h-8 w-32 xl:w-44 shrink-0 items-end gap-px">{bars.map((bar, index) => {const height = max > 0 ? Math.max(10, (bar.value / max) * 100) : 10;@@ -202,7 +202,7 @@ export default function GoalCard({ goal, siteId, timeSeries, isLoadingTimeSeriesonClick={toggleExpansion}>{/* Left section - Title and type */}- <div className="w-full min-w-0 md:flex-1 md:pr-4">+ <div className=" min-w-0 md:flex-1 md:pr-4"><h3 className="font-medium text-base flex items-center gap-2 min-w-0">{goal.goalType === "path" ? (<Tooltip>@@ -243,8 +243,8 @@ export default function GoalCard({ goal, siteId, timeSeries, isLoadingTimeSeries</div></div>{/* Center section - Stats */}- <div className="w-full md:flex-1 flex justify-start md:justify-center">- <div className="grid w-full grid-cols-1 gap-3 sm:grid-cols-2 md:w-auto md:gap-4">+ <div className="w-full min-w-0 md:flex-1 flex justify-start md:justify-center">+ <div className="flex w-full flex-col gap-3 sm:w-auto sm:flex-row sm:items-center sm:gap-4 md:gap-6"><div className="flex items-center gap-3"><GoalMetricBarChart data={timeSeries} metric="conversions" isLoading={isLoadingTimeSeries} /><div className="min-w-[86px] text-left">diff --git a/docs/content/docs/api/errors/events.mdx b/docs/content/docs/api/errors/events.mdxnew file mode 100644index 000000000..6db1883be--- /dev/null+++ b/docs/content/docs/api/errors/events.mdx@@ -0,0 +1,278 @@+---+title: Get Error Events+description: Returns individual error occurrences for a specific error message, with full context including stack traces.+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/error-events+```++Returns individual error occurrences for a specific error message, with full context including stack traces.++### 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) plus the following:++<TypeTable+ type={{+ errorMessage: {+ description: 'The error message to filter by',+ type: 'string',+ required: true,+ },+ page: {+ description: 'Page number (1-indexed)',+ type: 'number',+ required: false,+ },+ limit: {+ description: 'Number of results per page',+ type: 'number',+ default: 20,+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of error event objects',+ type: 'ErrorEvent[]',+ },+ }}+/>++#### ErrorEvent Object++<TypeTable+ type={{+ timestamp: {+ description: 'When the error occurred',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ session_id: {+ description: 'Session identifier',+ type: 'string',+ },+ user_id: {+ description: 'User identifier',+ type: 'string | null',+ },+ pathname: {+ description: 'Page where error occurred',+ type: 'string',+ },+ hostname: {+ description: 'Hostname',+ type: 'string',+ },+ browser: {+ description: 'Browser name',+ type: 'string',+ },+ browser_version: {+ description: 'Browser version',+ type: 'string',+ },+ operating_system: {+ description: 'Operating system',+ type: 'string',+ },+ device_type: {+ description: 'Device type',+ type: 'string',+ },+ country: {+ description: 'Country code',+ type: 'string',+ },+ message: {+ description: 'Error message',+ type: 'string',+ },+ stack: {+ description: 'Stack trace',+ type: 'string | null',+ },+ fileName: {+ description: 'Source file name',+ type: 'string | null',+ },+ lineNumber: {+ description: 'Line number in source',+ type: 'number | null',+ },+ columnNumber: {+ description: 'Column number in source',+ type: 'number | null',+ },+ }}+/>++</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/1/error-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`,+ {+ 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/1/error-events',+ params={+ 'errorMessage': "Cannot read property 'map' of undefined",+ '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/1/error-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'+]);++$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/1/error-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'++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/1/error-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{}+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/1/error-events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&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/1/error-events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&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/1/error-events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "timestamp": "2024-01-31T14:22:00.000Z",+ "session_id": "sess_abc123",+ "user_id": "user_xyz789",+ "pathname": "/dashboard",+ "hostname": "app.example.com",+ "browser": "Chrome",+ "browser_version": "120.0.0",+ "operating_system": "macOS",+ "device_type": "desktop",+ "country": "US",+ "message": "Cannot read property 'map' of undefined",+ "stack": "TypeError: Cannot read property 'map' of undefined\n at Dashboard (dashboard.js:42:15)\n at renderWithHooks (react-dom.js:1234:22)",+ "fileName": "dashboard.js",+ "lineNumber": 42,+ "columnNumber": 15+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/errors/meta.json b/docs/content/docs/api/errors/meta.jsonnew file mode 100644index 000000000..e5652b01b--- /dev/null+++ b/docs/content/docs/api/errors/meta.json@@ -0,0 +1,4 @@+{+ "title": "Errors",+ "pages": ["names", "events", "time-series"]+}diff --git a/docs/content/docs/api/errors/names.mdx b/docs/content/docs/api/errors/names.mdxnew file mode 100644index 000000000..ec922cb3e--- /dev/null+++ b/docs/content/docs/api/errors/names.mdx@@ -0,0 +1,236 @@+---+title: Get Error Names+description: Returns a list of unique error messages with occurrence counts and affected session 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/error-names+```++Returns a list of unique error messages with occurrence counts and affected session counts.++### 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) plus the following:++<TypeTable+ type={{+ page: {+ description: 'Page number (1-indexed). Enables paginated response format.',+ type: 'number',+ required: false,+ },+ limit: {+ description: 'Number of results per page',+ type: 'number',+ default: 10,+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of error objects (or paginated wrapper)',+ type: 'Error[] | PaginatedResponse',+ },+ }}+/>++#### Error Object++<TypeTable+ type={{+ value: {+ description: 'Error message',+ type: 'string',+ },+ errorName: {+ description: 'Error type (TypeError, ReferenceError, etc.)',+ type: 'string',+ },+ count: {+ description: 'Total occurrences',+ type: 'number',+ },+ sessionCount: {+ description: 'Unique sessions affected',+ type: 'number',+ },+ percentage: {+ description: 'Percentage of total error 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/1/error-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',+ {+ 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/1/error-names23',+ params={+ '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/1/error-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'+]);++$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/1/error-names?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/1/error-names?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/1/error-names?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/1/error-names?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/1/error-names?start_date=2024-01-01&end_date=2024-01-31");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "value": "Cannot read property 'map' of undefined",+ "errorName": "TypeError",+ "count": 156,+ "sessionCount": 89,+ "percentage": 34.5+ },+ {+ "value": "NetworkError when attempting to fetch resource",+ "errorName": "TypeError",+ "count": 98,+ "sessionCount": 72,+ "percentage": 27.9+ },+ {+ "value": "foo is not defined",+ "errorName": "ReferenceError",+ "count": 45,+ "sessionCount": 38,+ "percentage": 14.7+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/errors/time-series.mdx b/docs/content/docs/api/errors/time-series.mdxnew file mode 100644index 000000000..a2f210480--- /dev/null+++ b/docs/content/docs/api/errors/time-series.mdx@@ -0,0 +1,229 @@+---+title: Get Error Time Series+description: Returns error occurrence counts over time for a specific error message. Useful for tracking error trends and identifying when issues started.+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/error-bucketed+```++Returns error occurrence counts over time for a specific error message. Useful for tracking error trends and identifying when issues started.++### 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) plus the following:++<TypeTable+ type={{+ errorMessage: {+ description: 'The error message to filter by',+ type: 'string',+ required: true,+ },+ bucket: {+ description: 'Time bucket size for grouping data',+ type: 'TimeBucket',+ typeDescription: '"minute" | "five_minutes" | "hour" | "day" | "week" | "month"',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ success: {+ description: 'Whether the request succeeded',+ type: 'boolean',+ },+ data: {+ description: 'Array of time-bucketed counts',+ type: 'ErrorBucket[]',+ },+ }}+/>++#### ErrorBucket Object++<TypeTable+ type={{+ time: {+ description: 'Start of the time bucket',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ error_count: {+ description: 'Number of errors 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/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" \+ -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`,+ {+ 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/1/error-bucketed',+ params={+ 'errorMessage': "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'+ }+)++data = response.json()+```+ </Tab>+ <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_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/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')+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/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.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/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")+ .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/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"))+ .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/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 data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true,+ "data": [+ {+ "time": "2024-01-30T00:00:00.000Z",+ "error_count": 5+ },+ {+ "time": "2024-01-30T01:00:00.000Z",+ "error_count": 3+ },+ {+ "time": "2024-01-30T02:00:00.000Z",+ "error_count": 8+ },+ {+ "time": "2024-01-30T03:00:00.000Z",+ "error_count": 2+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/events/list.mdx b/docs/content/docs/api/events/list.mdxnew file mode 100644index 000000000..030dc3953--- /dev/null+++ b/docs/content/docs/api/events/list.mdx@@ -0,0 +1,363 @@+---+title: Get Events+description: Returns a paginated list of events (pageviews, custom events, and outbound clicks).+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+```++Returns a paginated list of events (pageviews, custom events, and outbound clicks).++### 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) plus the following:++<TypeTable+ type={{+ page_size: {+ description: 'Number of results per page',+ type: 'number',+ default: 50,+ },+ since_timestamp: {+ description: 'Poll for new events after this timestamp (ISO 8601). Used for realtime polling. Returns up to 500 events.',+ type: 'string',+ },+ before_timestamp: {+ description: 'Fetch events before this timestamp (ISO 8601). Used for cursor-based pagination (scrolling back).',+ type: 'string',+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of event objects',+ type: 'Event[]',+ },+ cursor: {+ description: 'Cursor metadata for pagination (only present when not using since_timestamp)',+ type: '{ hasMore: boolean, oldestTimestamp: string | null }',+ },+ }}+/>++#### Event Object++<TypeTable+ type={{+ timestamp: {+ description: 'Event timestamp',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ type: {+ description: 'Event type',+ type: 'string',+ typeDescription: '"pageview" | "custom_event" | "outbound" | "button_click" | "copy" | "form_submit" | "input_change"',+ },+ event_name: {+ description: 'Custom event name',+ type: 'string',+ },+ properties: {+ description: 'Event properties as JSON string',+ type: 'string',+ },+ session_id: {+ description: 'Session identifier',+ type: 'string',+ },+ user_id: {+ description: 'User identifier',+ type: 'string',+ },+ identified_user_id: {+ description: 'Identified user ID (if user has been identified)',+ type: 'string',+ },+ pathname: {+ description: 'Page path',+ type: 'string',+ },+ querystring: {+ description: 'URL query string',+ type: 'string',+ },+ hostname: {+ description: 'Hostname',+ type: 'string',+ },+ page_title: {+ description: 'Page title',+ type: 'string',+ },+ referrer: {+ description: 'Referrer URL',+ 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',+ },+ language: {+ description: 'Browser language',+ type: 'string',+ },+ country: {+ description: 'Country code',+ type: 'string',+ },+ region: {+ description: 'Region/state',+ type: 'string',+ },+ city: {+ description: 'City name',+ type: 'string',+ },+ lat: {+ description: 'Latitude',+ type: 'number',+ },+ lon: {+ description: 'Longitude',+ type: 'number',+ },+ screen_width: {+ description: 'Screen width in pixels',+ type: 'number',+ },+ screen_height: {+ description: 'Screen height in pixels',+ type: 'number',+ },+ device_type: {+ description: 'Device type',+ 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/1/events?page_size=50&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/events?page_size=50&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/1/events',+ params={+ 'page_size': 50,+ '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/1/events?page_size=50&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/1/events?page_size=50&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/1/events?page_size=50&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/1/events?page_size=50&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/1/events?page_size=50&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/1/events?page_size=50&start_date=2024-01-01&end_date=2024-01-31");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "timestamp": "2024-01-31T14:22:00.000Z",+ "type": "custom_event",+ "event_name": "signup",+ "properties": "{\"plan\":\"pro\",\"source\":\"homepage\"}",+ "session_id": "abc123def456",+ "user_id": "user_abc123",+ "identified_user_id": "",+ "pathname": "/signup",+ "querystring": "",+ "hostname": "example.com",+ "page_title": "Sign Up",+ "referrer": "https://google.com",+ "browser": "Chrome",+ "browser_version": "120.0",+ "operating_system": "macOS",+ "operating_system_version": "14.0",+ "language": "en-US",+ "country": "US",+ "region": "California",+ "city": "San Francisco",+ "lat": 37.7749,+ "lon": -122.4194,+ "screen_width": 1920,+ "screen_height": 1080,+ "device_type": "desktop"+ },+ {+ "timestamp": "2024-01-31T14:21:00.000Z",+ "type": "pageview",+ "event_name": "",+ "properties": "{}",+ "session_id": "abc123def456",+ "user_id": "user_abc123",+ "identified_user_id": "",+ "pathname": "/pricing",+ "querystring": "",+ "hostname": "example.com",+ "page_title": "Pricing",+ "referrer": "https://example.com/",+ "browser": "Chrome",+ "browser_version": "120.0",+ "operating_system": "macOS",+ "operating_system_version": "14.0",+ "language": "en-US",+ "country": "US",+ "region": "California",+ "city": "San Francisco",+ "lat": 37.7749,+ "lon": -122.4194,+ "screen_width": 1920,+ "screen_height": 1080,+ "device_type": "desktop"+ }+ ],+ "cursor": {+ "hasMore": true,+ "oldestTimestamp": "2024-01-31T14:21:00.000Z"+ }+}+```++</div>+</div>diff --git a/docs/content/docs/api/events/meta.json b/docs/content/docs/api/events/meta.jsonnew file mode 100644index 000000000..a097307f0--- /dev/null+++ b/docs/content/docs/api/events/meta.json@@ -0,0 +1,4 @@+{+ "title": "Events",+ "pages": ["list", "names", "properties", "outbound"]+}diff --git a/docs/content/docs/api/events/names.mdx b/docs/content/docs/api/events/names.mdxnew file mode 100644index 000000000..018ed4cfb--- /dev/null+++ b/docs/content/docs/api/events/names.mdx@@ -0,0 +1,204 @@+---+title: Get Event Names+description: Returns a list of unique custom event names with their occurrence 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/events/names+```++Returns a list of unique custom event names with their occurrence counts.++### 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).++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of event name objects',+ type: 'EventName[]',+ },+ }}+/>++#### EventName Object++<TypeTable+ type={{+ eventName: {+ description: 'Name of the custom event',+ type: 'string',+ },+ count: {+ description: 'Number of occurrences',+ 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/1/events/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/events/names?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/1/events/names',+ params={+ '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/1/events/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'+]);++$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/1/events/names?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/1/events/names?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/1/events/names?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/1/events/names?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/1/events/names?start_date=2024-01-01&end_date=2024-01-31");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "eventName": "signup",+ "count": 1250+ },+ {+ "eventName": "purchase",+ "count": 320+ },+ {+ "eventName": "add_to_cart",+ "count": 890+ },+ {+ "eventName": "newsletter_subscribe",+ "count": 456+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/events/outbound.mdx b/docs/content/docs/api/events/outbound.mdxnew file mode 100644index 000000000..631e27955--- /dev/null+++ b/docs/content/docs/api/events/outbound.mdx@@ -0,0 +1,208 @@+---+title: Get Outbound Links+description: Returns a list of outbound link clicks with their occurrence 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/events/outbound+```++Returns a list of outbound link clicks with their occurrence counts.++### 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).++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of outbound link objects',+ type: 'OutboundLink[]',+ },+ }}+/>++#### OutboundLink Object++<TypeTable+ type={{+ url: {+ description: 'The outbound URL that was clicked',+ type: 'string',+ },+ count: {+ description: 'Number of clicks',+ type: 'number',+ },+ lastClicked: {+ description: 'Most recent click timestamp',+ type: 'string',+ 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/1/events/outbound?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/events/outbound?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/1/events/outbound',+ params={+ '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/1/events/outbound?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/1/events/outbound?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/1/events/outbound?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/1/events/outbound?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/1/events/outbound?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/1/events/outbound?start_date=2024-01-01&end_date=2024-01-31");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "url": "https://github.com/example/repo",+ "count": 245,+ "lastClicked": "2024-01-31T14:22:00.000Z"+ },+ {+ "url": "https://twitter.com/example",+ "count": 189,+ "lastClicked": "2024-01-31T12:15:00.000Z"+ },+ {+ "url": "https://docs.example.com",+ "count": 156,+ "lastClicked": "2024-01-31T10:30:00.000Z"+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/events/properties.mdx b/docs/content/docs/api/events/properties.mdxnew file mode 100644index 000000000..b44bf2858--- /dev/null+++ b/docs/content/docs/api/events/properties.mdx@@ -0,0 +1,228 @@+---+title: Get Event Properties+description: Returns property key-value pairs for a specific event name with their occurrence 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/events/properties+```++Returns property key-value pairs for a specific event name with their occurrence counts.++### 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) plus the following:++<TypeTable+ type={{+ event_name: {+ description: 'Event name to get properties for',+ type: 'string',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of property objects',+ type: 'EventProperty[]',+ },+ }}+/>++#### EventProperty Object++<TypeTable+ type={{+ propertyKey: {+ description: 'Property key name',+ type: 'string',+ },+ propertyValue: {+ description: 'Property value',+ type: 'string',+ },+ count: {+ description: 'Number of occurrences',+ 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/1/events/properties?event_name=signup&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/events/properties?event_name=signup&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/1/events/properties',+ params={+ 'event_name': 'signup',+ '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/1/events/properties?event_name=signup&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/1/events/properties?event_name=signup&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/1/events/properties?event_name=signup&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/1/events/properties?event_name=signup&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/1/events/properties?event_name=signup&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/1/events/properties?event_name=signup&start_date=2024-01-01&end_date=2024-01-31");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "propertyKey": "plan",+ "propertyValue": "pro",+ "count": 520+ },+ {+ "propertyKey": "plan",+ "propertyValue": "starter",+ "count": 430+ },+ {+ "propertyKey": "plan",+ "propertyValue": "enterprise",+ "count": 300+ },+ {+ "propertyKey": "source",+ "propertyValue": "homepage",+ "count": 650+ },+ {+ "propertyKey": "source",+ "propertyValue": "pricing",+ "count": 600+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/funnels/analyze.mdx b/docs/content/docs/api/funnels/analyze.mdxnew file mode 100644index 000000000..f4ac6c6b5--- /dev/null+++ b/docs/content/docs/api/funnels/analyze.mdx@@ -0,0 +1,415 @@+---+title: Analyze Funnel+description: Analyzes a funnel and returns step-by-step conversion data. Sessions must complete steps in order (step 2 must occur after step 1, etc.).+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/funnels/analyze+```++Analyzes a funnel and returns step-by-step conversion data. Sessions must complete steps in order (step 2 must occur after step 1, etc.).++### 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).++### Request Body++<TypeTable+ type={{+ steps: {+ description: 'Array of funnel steps (minimum 2)',+ type: 'FunnelStep[]',+ required: true,+ },+ }}+/>++#### FunnelStep Object++<TypeTable+ type={{+ type: {+ description: 'Step type',+ type: 'string',+ typeDescription: '"page" | "event"',+ required: true,+ },+ value: {+ description: 'Page path pattern or event name',+ type: 'string',+ required: true,+ },+ name: {+ description: 'Display name for the step',+ type: 'string',+ required: false,+ },+ hostname: {+ description: 'Filter by specific hostname',+ type: 'string',+ required: false,+ },+ eventPropertyKey: {+ description: 'Event property key to match (for event steps)',+ type: 'string',+ required: false,+ },+ eventPropertyValue: {+ description: 'Event property value to match',+ type: 'string | number | boolean',+ required: false,+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of step results',+ type: 'FunnelStepResult[]',+ },+ }}+/>++#### FunnelStepResult Object++<TypeTable+ type={{+ step_number: {+ description: 'Step number (1-indexed)',+ type: 'number',+ },+ step_name: {+ description: 'Step name',+ type: 'string',+ },+ visitors: {+ description: 'Number of sessions that reached this step',+ type: 'number',+ },+ conversion_rate: {+ description: 'Percentage of step 1 visitors who reached this step',+ type: 'number',+ typeDescription: 'Range: 0-100',+ },+ dropoff_rate: {+ description: 'Percentage who dropped off from the previous step',+ 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 POST "https://app.rybbit.io/api/sites/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31" \+ -H "Authorization: Bearer your_api_key_here" \+ -H "Content-Type: application/json" \+ -d '{+ "steps": [+ { "type": "page", "value": "/", "name": "Homepage" },+ { "type": "page", "value": "/pricing", "name": "Pricing" },+ { "type": "page", "value": "/signup", "name": "Signup" },+ { "type": "event", "value": "signup_complete", "name": "Complete" }+ ]+ }'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const response = await fetch(+ 'https://app.rybbit.io/api/sites/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31',+ {+ method: 'POST',+ headers: {+ 'Authorization': 'Bearer your_api_key_here',+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ steps: [+ { type: 'page', value: '/', name: 'Homepage' },+ { type: 'page', value: '/pricing', name: 'Pricing' },+ { type: 'page', value: '/signup', name: 'Signup' },+ { type: 'event', value: 'signup_complete', name: 'Complete' }+ ]+ })+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++response = requests.post(+ 'https://app.rybbit.io/api/sites/1/funnels/analyze',+ params={+ 'start_date': '2024-01-01',+ 'end_date': '2024-01-31'+ },+ json={+ 'steps': [+ { 'type': 'page', 'value': '/', 'name': 'Homepage' },+ { 'type': 'page', 'value': '/pricing', 'name': 'Pricing' },+ { 'type': 'page', 'value': '/signup', 'name': 'Signup' },+ { 'type': 'event', 'value': 'signup_complete', 'name': 'Complete' }+ ]+ },+ headers={+ 'Authorization': 'Bearer your_api_key_here'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$body = [+ 'steps' => [+ ['type' => 'page', 'value' => '/', 'name' => 'Homepage'],+ ['type' => 'page', 'value' => '/pricing', 'name' => 'Pricing'],+ ['type' => 'page', 'value' => '/signup', 'name' => 'Signup'],+ ['type' => 'event', 'value' => 'signup_complete', 'name' => 'Complete']+ ]+];++$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31');+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/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31')+request = Net::HTTP::Post.new(uri)+request['Authorization'] = 'Bearer your_api_key_here'+request['Content-Type'] = 'application/json'+request.body = {+ steps: [+ { type: 'page', value: '/', name: 'Homepage' },+ { type: 'page', value: '/pricing', name: 'Pricing' },+ { type: 'page', value: '/signup', name: 'Signup' },+ { type: 'event', value: 'signup_complete', name: 'Complete' }+ ]+}.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"+package main++import (+ "bytes"+ "encoding/json"+ "io"+ "net/http"+)++func main() {+ body := map[string]interface{}{+ "steps": []map[string]string{+ {"type": "page", "value": "/", "name": "Homepage"},+ {"type": "page", "value": "/pricing", "name": "Pricing"},+ {"type": "page", "value": "/signup", "name": "Signup"},+ {"type": "event", "value": "signup_complete", "name": "Complete"},+ },+ }+ jsonBody, _ := json.Marshal(body)++ client := &http.Client{}+ req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/sites/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31", bytes.NewBuffer(jsonBody))+ req.Header.Set("Authorization", "Bearer your_api_key_here")+ req.Header.Set("Content-Type", "application/json")++ resp, _ := client.Do(req)+ defer resp.Body.Close()++ respBody, _ := io.ReadAll(resp.Body)+ var data map[string]interface{}+ json.Unmarshal(respBody, &data)+}+```+ </Tab>+ <Tab value="Rust">+```rust title="Request"+use reqwest;+use serde_json::{json, Value};++#[tokio::main]+async fn main() -> Result<(), Box<dyn std::error::Error>> {+ let body = json!({+ "steps": [+ {"type": "page", "value": "/", "name": "Homepage"},+ {"type": "page", "value": "/pricing", "name": "Pricing"},+ {"type": "page", "value": "/signup", "name": "Signup"},+ {"type": "event", "value": "signup_complete", "name": "Complete"}+ ]+ });++ let client = reqwest::Client::new();+ let response = client+ .post("https://app.rybbit.io/api/sites/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31")+ .header("Authorization", "Bearer your_api_key_here")+ .header("Content-Type", "application/json")+ .json(&body)+ .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;++String json = """+{+ "steps": [+ {"type": "page", "value": "/", "name": "Homepage"},+ {"type": "page", "value": "/pricing", "name": "Pricing"},+ {"type": "page", "value": "/signup", "name": "Signup"},+ {"type": "event", "value": "signup_complete", "name": "Complete"}+ ]+}+""";++HttpClient client = HttpClient.newHttpClient();+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/sites/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31"))+ .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());+String data = response.body();+```+ </Tab>+ <Tab value=".NET">+```csharp title="Request"+using System.Net.Http;+using System.Net.Http.Headers;+using System.Text;+using System.Text.Json;++var body = new+{+ steps = new[]+ {+ new { type = "page", value = "/", name = "Homepage" },+ new { type = "page", value = "/pricing", name = "Pricing" },+ new { type = "page", value = "/signup", name = "Signup" },+ new { type = "event", value = "signup_complete", name = "Complete" }+ }+};++var client = new HttpClient();+client.DefaultRequestHeaders.Authorization =+ new AuthenticationHeaderValue("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/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31",+ content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "step_number": 1,+ "step_name": "Homepage",+ "visitors": 10000,+ "conversion_rate": 100,+ "dropoff_rate": 0+ },+ {+ "step_number": 2,+ "step_name": "Pricing",+ "visitors": 4500,+ "conversion_rate": 45,+ "dropoff_rate": 55+ },+ {+ "step_number": 3,+ "step_name": "Signup",+ "visitors": 1800,+ "conversion_rate": 18,+ "dropoff_rate": 60+ },+ {+ "step_number": 4,+ "step_name": "Complete",+ "visitors": 720,+ "conversion_rate": 7.2,+ "dropoff_rate": 60+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/funnels/create.mdx b/docs/content/docs/api/funnels/create.mdxnew file mode 100644index 000000000..be9fe2980--- /dev/null+++ b/docs/content/docs/api/funnels/create.mdx@@ -0,0 +1,301 @@+---+title: Create Funnel+description: Creates or updates a saved funnel. If `reportId` is provided, updates the existing funnel.+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/funnels+```++Creates or updates a saved funnel. If `reportId` is provided, updates the existing funnel.++### Path Parameters++<TypeTable+ type={{+ site: {+ description: 'Site ID or site identifier',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Request Body++<TypeTable+ type={{+ name: {+ description: 'Funnel name',+ type: 'string',+ required: true,+ },+ steps: {+ description: 'Array of funnel steps (minimum 2)',+ type: 'FunnelStep[]',+ required: true,+ },+ reportId: {+ description: 'Existing funnel ID to update (optional)',+ type: 'number',+ required: false,+ },+ }}+/>++### Response++<TypeTable+ type={{+ success: {+ description: 'Whether the funnel was created/updated',+ type: 'boolean',+ },+ funnelId: {+ description: 'ID of the created/updated funnel',+ 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="Create New Funnel"+curl -X POST "https://app.rybbit.io/api/sites/1/funnels23" \+ -H "Authorization: Bearer your_api_key_here" \+ -H "Content-Type: application/json" \+ -d '{+ "name": "Checkout Funnel",+ "steps": [+ { "type": "page", "value": "/products/*", "name": "Product Page" },+ { "type": "page", "value": "/cart", "name": "Cart" },+ { "type": "page", "value": "/checkout", "name": "Checkout" },+ { "type": "event", "value": "purchase", "name": "Purchase" }+ ]+ }'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Update Existing Funnel"+const response = await fetch(+ 'https://app.rybbit.io/api/sites/1/funnels23',+ {+ method: 'POST',+ headers: {+ 'Authorization': 'Bearer your_api_key_here',+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ reportId: 1, // Update existing funnel+ name: 'Checkout Funnel (Updated)',+ steps: [+ { type: 'page', value: '/products/*', name: 'Product Page' },+ { type: 'page', value: '/cart', name: 'Cart' },+ { type: 'page', value: '/checkout', name: 'Checkout' },+ { type: 'page', value: '/checkout/success', name: 'Success' }+ ]+ })+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++response = requests.post(+ 'https://app.rybbit.io/api/sites/1/funnels23',+ json={+ 'name': 'Onboarding Funnel',+ 'steps': [+ { 'type': 'page', 'value': '/signup', 'name': 'Signup' },+ { 'type': 'event', 'value': 'account_created', 'name': 'Account Created' },+ { 'type': 'page', 'value': '/onboarding/*', 'name': 'Onboarding' },+ { 'type': 'event', 'value': 'onboarding_complete', 'name': 'Complete' }+ ]+ },+ headers={+ 'Authorization': 'Bearer your_api_key_here'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$body = [+ 'name' => 'Checkout Funnel',+ 'steps' => [+ ['type' => 'page', 'value' => '/products/*', 'name' => 'Product Page'],+ ['type' => 'page', 'value' => '/cart', 'name' => 'Cart'],+ ['type' => 'page', 'value' => '/checkout', 'name' => 'Checkout'],+ ['type' => 'event', 'value' => 'purchase', 'name' => 'Purchase']+ ]+];++$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/funnels23');+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/1/funnels23')+request = Net::HTTP::Post.new(uri)+request['Authorization'] = 'Bearer your_api_key_here'+request['Content-Type'] = 'application/json'+request.body = {+ name: 'Checkout Funnel',+ steps: [+ { type: 'page', value: '/products/*', name: 'Product Page' },+ { type: 'page', value: '/cart', name: 'Cart' },+ { type: 'page', value: '/checkout', name: 'Checkout' },+ { type: 'event', value: 'purchase', name: 'Purchase' }+ ]+}.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": "Checkout Funnel",+ "steps": []map[string]string{+ {"type": "page", "value": "/products/*", "name": "Product Page"},+ {"type": "page", "value": "/cart", "name": "Cart"},+ {"type": "page", "value": "/checkout", "name": "Checkout"},+ {"type": "event", "value": "purchase", "name": "Purchase"},+ },+}+jsonBody, _ := json.Marshal(body)++req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/sites/1/funnels23", 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": "Checkout Funnel",+ "steps": [+ {"type": "page", "value": "/products/*", "name": "Product Page"},+ {"type": "page", "value": "/cart", "name": "Cart"},+ {"type": "page", "value": "/checkout", "name": "Checkout"},+ {"type": "event", "value": "purchase", "name": "Purchase"}+ ]+});++let client = reqwest::Client::new();+let res = client+ .post("https://app.rybbit.io/api/sites/1/funnels23")+ .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": "Checkout Funnel",+ "steps": [+ {"type": "page", "value": "/products/*", "name": "Product Page"},+ {"type": "page", "value": "/cart", "name": "Cart"},+ {"type": "page", "value": "/checkout", "name": "Checkout"},+ {"type": "event", "value": "purchase", "name": "Purchase"}+ ]+}+""";++HttpClient client = HttpClient.newHttpClient();+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/sites/1/funnels23"))+ .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+{+ name = "Checkout Funnel",+ steps = new[]+ {+ new { type = "page", value = "/products/*", name = "Product Page" },+ new { type = "page", value = "/cart", name = "Cart" },+ new { type = "page", value = "/checkout", name = "Checkout" },+ new { type = "event", value = "purchase", name = "Purchase" }+ }+};++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/1/funnels23", content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true,+ "funnelId": 2+}+```++</div>+</div>diff --git a/docs/content/docs/api/funnels/delete.mdx b/docs/content/docs/api/funnels/delete.mdxnew file mode 100644index 000000000..5045356ec--- /dev/null+++ b/docs/content/docs/api/funnels/delete.mdx@@ -0,0 +1,174 @@+---+title: Delete Funnel+description: Deletes a saved funnel. This action cannot be undone.+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/funnels/:funnelId+```++Deletes a saved funnel. This action cannot be undone.++### Path Parameters++<TypeTable+ type={{+ funnelId: {+ description: 'ID of the funnel to delete',+ type: 'string | number',+ required: true,+ },+ site: {+ description: 'Site ID or site identifier',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ success: {+ description: 'Whether the funnel 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/sites/1/funnels/123" \+ -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/funnels/123',+ {+ 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/1/funnels/123',+ 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/1/funnels/123');+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/1/funnels/123')+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/sites/1/funnels/123", 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/1/funnels/123")+ .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/1/funnels/123"))+ .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/1/funnels/123");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true+}+```++</div>+</div>diff --git a/docs/content/docs/api/funnels/list.mdx b/docs/content/docs/api/funnels/list.mdxnew file mode 100644index 000000000..50e593eb5--- /dev/null+++ b/docs/content/docs/api/funnels/list.mdx@@ -0,0 +1,239 @@+---+title: Get Funnels+description: Returns all saved funnels for a site.+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/funnels+```++Returns all saved funnels for a site.++### Path Parameters++<TypeTable+ type={{+ site: {+ description: 'Site ID or site identifier',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of saved funnels',+ type: 'Funnel[]',+ },+ }}+/>++#### Funnel Object++<TypeTable+ type={{+ id: {+ description: 'Unique funnel identifier',+ type: 'number',+ },+ name: {+ description: 'Funnel name',+ type: 'string',+ },+ steps: {+ description: 'Array of funnel steps',+ type: 'FunnelStep[]',+ },+ createdAt: {+ description: 'Creation timestamp',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ updatedAt: {+ description: 'Last update timestamp',+ type: 'string',+ 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/1/funnels23" \+ -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/funnels23',+ {+ 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/1/funnels23',+ 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/1/funnels23');+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/1/funnels23')+request = Net::HTTP::Get.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"+package main++import (+ "encoding/json"+ "io"+ "net/http"+)++func main() {+ client := &http.Client{}+ req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/1/funnels23", nil)+ req.Header.Set("Authorization", "Bearer your_api_key_here")++ 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/1/funnels23")+ .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;++HttpClient client = HttpClient.newHttpClient();+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/sites/1/funnels23"))+ .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.Net.Http;+using System.Net.Http.Headers;++var client = new HttpClient();+client.DefaultRequestHeaders.Authorization =+ new AuthenticationHeaderValue("Bearer", "your_api_key_here");++var response = await client.GetAsync(+ "https://app.rybbit.io/api/sites/1/funnels23");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "id": 1,+ "name": "Signup Funnel",+ "steps": [+ { "type": "page", "value": "/", "name": "Homepage" },+ { "type": "page", "value": "/pricing", "name": "Pricing" },+ { "type": "page", "value": "/signup", "name": "Signup" },+ { "type": "page", "value": "/signup/complete", "name": "Complete" }+ ],+ "createdAt": "2024-01-10T12:00:00.000Z",+ "updatedAt": "2024-01-15T09:30:00.000Z"+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/funnels/meta.json b/docs/content/docs/api/funnels/meta.jsonnew file mode 100644index 000000000..8df5fb577--- /dev/null+++ b/docs/content/docs/api/funnels/meta.json@@ -0,0 +1,4 @@+{+ "title": "Funnels",+ "pages": ["list", "analyze", "step-sessions", "create", "delete"]+}diff --git a/docs/content/docs/api/funnels/step-sessions.mdx b/docs/content/docs/api/funnels/step-sessions.mdxnew file mode 100644index 000000000..91adc87a5--- /dev/null+++ b/docs/content/docs/api/funnels/step-sessions.mdx@@ -0,0 +1,320 @@+---+title: Get Funnel Step Sessions+description: Returns sessions that either reached or dropped off at a specific funnel step. Useful for analyzing user behavior at each stage.+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/funnels/:stepNumber/sessions+```++Returns sessions that either reached or dropped off at a specific funnel step. Useful for analyzing user behavior at each stage.++### Path Parameters++<TypeTable+ type={{+ stepNumber: {+ description: 'Step number (1-indexed)',+ type: 'string | number',+ required: true,+ },+ site: {+ description: 'Site ID or site identifier',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Query Parameters++Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) plus the following:++<TypeTable+ type={{+ mode: {+ description: 'Whether to get sessions that reached or dropped off at this step',+ type: 'string',+ typeDescription: '"reached" | "dropped"',+ required: true,+ },+ page: {+ description: 'Page number (1-indexed)',+ type: 'number',+ default: 1,+ },+ limit: {+ description: 'Number of results per page',+ type: 'number',+ default: 25,+ },+ }}+/>++### Request Body++<TypeTable+ type={{+ steps: {+ description: 'Array of funnel steps (same as used in analyze)',+ type: 'FunnelStep[]',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of session objects',+ type: 'Session[]',+ },+ }}+/>++</div>+<div className="flex flex-col gap-4">++<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>+ <Tab value="cURL">+```bash title="Get sessions that dropped off at step 2"+curl -X POST "https://app.rybbit.io/api/sites/1/funnels/2/sessions?mode=dropped&page=1" \+ -H "Authorization: Bearer your_api_key_here" \+ -H "Content-Type: application/json" \+ -d '{+ "steps": [+ { "type": "page", "value": "/", "name": "Homepage" },+ { "type": "page", "value": "/pricing", "name": "Pricing" },+ { "type": "page", "value": "/signup", "name": "Signup" }+ ]+ }'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Get sessions that reached step 3"+const response = await fetch(+ 'https://app.rybbit.io/api/sites/1/funnels/3/sessions?mode=reached&page=1',+ {+ method: 'POST',+ headers: {+ 'Authorization': 'Bearer your_api_key_here',+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ steps: [+ { type: 'page', value: '/', name: 'Homepage' },+ { type: 'page', value: '/pricing', name: 'Pricing' },+ { type: 'page', value: '/signup', name: 'Signup' }+ ]+ })+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++response = requests.post(+ 'https://app.rybbit.io/api/sites/1/funnels/2/sessions23',+ params={+ 'mode': 'dropped',+ 'page': 1+ },+ json={+ 'steps': [+ { 'type': 'page', 'value': '/', 'name': 'Homepage' },+ { 'type': 'page', 'value': '/pricing', 'name': 'Pricing' },+ { 'type': 'page', 'value': '/signup', 'name': 'Signup' }+ ]+ },+ headers={+ 'Authorization': 'Bearer your_api_key_here'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$body = [+ 'steps' => [+ ['type' => 'page', 'value' => '/', 'name' => 'Homepage'],+ ['type' => 'page', 'value' => '/pricing', 'name' => 'Pricing'],+ ['type' => 'page', 'value' => '/signup', 'name' => 'Signup']+ ]+];++$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/funnels/2/sessions?mode=dropped&page=1');+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/1/funnels/2/sessions?mode=dropped&page=1')+request = Net::HTTP::Post.new(uri)+request['Authorization'] = 'Bearer your_api_key_here'+request['Content-Type'] = 'application/json'+request.body = {+ steps: [+ { type: 'page', value: '/', name: 'Homepage' },+ { type: 'page', value: '/pricing', name: 'Pricing' },+ { type: 'page', value: '/signup', name: 'Signup' }+ ]+}.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{}{+ "steps": []map[string]string{+ {"type": "page", "value": "/", "name": "Homepage"},+ {"type": "page", "value": "/pricing", "name": "Pricing"},+ {"type": "page", "value": "/signup", "name": "Signup"},+ },+}+jsonBody, _ := json.Marshal(body)++req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/sites/1/funnels/2/sessions?mode=dropped&page=1", 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!({+ "steps": [+ {"type": "page", "value": "/", "name": "Homepage"},+ {"type": "page", "value": "/pricing", "name": "Pricing"},+ {"type": "page", "value": "/signup", "name": "Signup"}+ ]+});++let client = reqwest::Client::new();+let res = client+ .post("https://app.rybbit.io/api/sites/1/funnels/2/sessions?mode=dropped&page=1")+ .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 = """+{+ "steps": [+ {"type": "page", "value": "/", "name": "Homepage"},+ {"type": "page", "value": "/pricing", "name": "Pricing"},+ {"type": "page", "value": "/signup", "name": "Signup"}+ ]+}+""";++HttpClient client = HttpClient.newHttpClient();+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/sites/1/funnels/2/sessions?mode=dropped&page=1"))+ .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+{+ steps = new[]+ {+ new { type = "page", value = "/", name = "Homepage" },+ new { type = "page", value = "/pricing", name = "Pricing" },+ new { type = "page", value = "/signup", name = "Signup" }+ }+};++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/1/funnels/2/sessions?mode=dropped&page=1",+ content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "session_id": "sess_abc123",+ "user_id": "user_xyz789",+ "country": "US",+ "browser": "Chrome",+ "operating_system": "macOS",+ "device_type": "desktop",+ "entry_page": "/",+ "exit_page": "/pricing",+ "pageviews": 3,+ "session_duration": 125,+ "session_start": "2024-01-31T14:00:00.000Z",+ "session_end": "2024-01-31T14:02:05.000Z",+ "referrer": "https://google.com",+ "channel": "organic"+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/goals/create.mdx b/docs/content/docs/api/goals/create.mdxnew file mode 100644index 000000000..424c40a73--- /dev/null+++ b/docs/content/docs/api/goals/create.mdx@@ -0,0 +1,315 @@+---+title: Create Goal+description: Creates a new goal for tracking conversions.+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/goals+```++Creates a new goal for tracking conversions.++### Path Parameters++<TypeTable+ type={{+ site: {+ description: 'Site ID or site identifier',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Request Body++<TypeTable+ type={{+ name: {+ description: 'Goal name',+ type: 'string',+ required: false,+ },+ goalType: {+ description: 'Type of goal',+ type: 'string',+ typeDescription: '"path" | "event"',+ required: true,+ },+ config: {+ description: 'Goal configuration',+ type: 'GoalConfig',+ required: true,+ },+ }}+/>++#### GoalConfig for Path Goals++<TypeTable+ type={{+ pathPattern: {+ description: 'URL path pattern to match. Supports wildcards (*)',+ type: 'string',+ required: true,+ typeDescription: 'e.g., "/checkout/*", "/signup/complete"',+ },+ }}+/>++#### GoalConfig for Event Goals++<TypeTable+ type={{+ eventName: {+ description: 'Event name to match',+ type: 'string',+ required: true,+ },+ eventPropertyKey: {+ description: 'Property key to match (optional)',+ type: 'string',+ required: false,+ },+ eventPropertyValue: {+ description: 'Property value to match (required if key is provided)',+ type: 'string | number | boolean',+ required: false,+ },+ }}+/>++### Response++<TypeTable+ type={{+ success: {+ description: 'Whether the goal was created',+ type: 'boolean',+ },+ goalId: {+ description: 'ID of the created goal',+ 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="Path Goal"+curl -X POST "https://app.rybbit.io/api/sites/1/goals23" \+ -H "Authorization: Bearer your_api_key_here" \+ -H "Content-Type: application/json" \+ -d '{+ "name": "Checkout Complete",+ "goalType": "path",+ "config": {+ "pathPattern": "/checkout/success"+ }+ }'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Event Goal"+const response = await fetch(+ 'https://app.rybbit.io/api/sites/1/goals23',+ {+ method: 'POST',+ headers: {+ 'Authorization': 'Bearer your_api_key_here',+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ name: 'Purchase Made',+ goalType: 'event',+ config: {+ eventName: 'purchase',+ eventPropertyKey: 'plan',+ eventPropertyValue: 'pro'+ }+ })+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++response = requests.post(+ 'https://app.rybbit.io/api/sites/1/goals23',+ json={+ 'name': 'Signup Complete',+ 'goalType': 'path',+ 'config': {+ 'pathPattern': '/signup/*'+ }+ },+ headers={+ 'Authorization': 'Bearer your_api_key_here'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$body = [+ 'name' => 'Checkout Complete',+ 'goalType' => 'path',+ 'config' => [+ 'pathPattern' => '/checkout/success'+ ]+];++$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/goals23');+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/1/goals23')+request = Net::HTTP::Post.new(uri)+request['Authorization'] = 'Bearer your_api_key_here'+request['Content-Type'] = 'application/json'+request.body = {+ name: 'Checkout Complete',+ goalType: 'path',+ config: { pathPattern: '/checkout/success' }+}.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": "Checkout Complete",+ "goalType": "path",+ "config": map[string]string{+ "pathPattern": "/checkout/success",+ },+}+jsonBody, _ := json.Marshal(body)++req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/sites/1/goals23", 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": "Checkout Complete",+ "goalType": "path",+ "config": {+ "pathPattern": "/checkout/success"+ }+});++let client = reqwest::Client::new();+let res = client+ .post("https://app.rybbit.io/api/sites/1/goals23")+ .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": "Checkout Complete",+ "goalType": "path",+ "config": {+ "pathPattern": "/checkout/success"+ }+}+""";++HttpClient client = HttpClient.newHttpClient();+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/sites/1/goals23"))+ .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+{+ name = "Checkout Complete",+ goalType = "path",+ config = new { pathPattern = "/checkout/success" }+};++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/1/goals23", content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true,+ "goalId": 3+}+```++</div>+</div>diff --git a/docs/content/docs/api/goals/delete.mdx b/docs/content/docs/api/goals/delete.mdxnew file mode 100644index 000000000..f97a4dc31--- /dev/null+++ b/docs/content/docs/api/goals/delete.mdx@@ -0,0 +1,174 @@+---+title: Delete Goal+description: Deletes a goal. This action cannot be undone.+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/goals/:goalId+```++Deletes a goal. This action cannot be undone.++### Path Parameters++<TypeTable+ type={{+ goalId: {+ description: 'ID of the goal to delete',+ type: 'string | number',+ required: true,+ },+ site: {+ description: 'Site ID or site identifier',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ success: {+ description: 'Whether the goal 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/sites/1/goals/123" \+ -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/goals/123',+ {+ 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/1/goals/123',+ 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/1/goals/123');+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/1/goals/123')+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/sites/1/goals/123", 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/1/goals/123")+ .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/1/goals/123"))+ .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/1/goals/123");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true+}+```++</div>+</div>diff --git a/docs/content/docs/api/goals/list.mdx b/docs/content/docs/api/goals/list.mdxnew file mode 100644index 000000000..f399c5a34--- /dev/null+++ b/docs/content/docs/api/goals/list.mdx@@ -0,0 +1,360 @@+---+title: Get Goals+description: Returns a paginated list of goals with their conversion metrics.+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+```++Returns a paginated list of goals with their conversion metrics.++### 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) plus the following:++<TypeTable+ type={{+ page: {+ description: 'Page number (1-indexed)',+ type: 'number',+ default: 1,+ },+ page_size: {+ description: 'Number of results per page (max 100)',+ type: 'number',+ default: 10,+ },+ sort: {+ description: 'Field to sort by',+ type: 'string',+ typeDescription: '"goalId" | "name" | "goalType" | "createdAt"',+ default: 'createdAt',+ },+ order: {+ description: 'Sort direction',+ type: 'string',+ typeDescription: '"asc" | "desc"',+ default: 'desc',+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of goal objects with conversion data',+ type: 'Goal[]',+ },+ meta: {+ description: 'Pagination metadata',+ type: 'PaginationMeta',+ },+ }}+/>++#### Goal Object++<TypeTable+ type={{+ goalId: {+ description: 'Unique goal identifier',+ type: 'number',+ },+ name: {+ description: 'Goal name',+ type: 'string | null',+ },+ goalType: {+ description: 'Type of goal',+ type: 'string',+ typeDescription: '"path" | "event"',+ },+ config: {+ description: 'Goal configuration',+ type: 'GoalConfig',+ },+ createdAt: {+ description: 'Creation timestamp',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ total_conversions: {+ description: 'Number of sessions that completed the goal',+ type: 'number',+ },+ total_sessions: {+ description: 'Total sessions in the time period',+ type: 'number',+ },+ conversion_rate: {+ description: 'Conversion rate (0-1)',+ type: 'number',+ },+ }}+/>++#### GoalConfig Object++<TypeTable+ type={{+ pathPattern: {+ description: 'URL path pattern (for path goals). Supports wildcards (*)',+ type: 'string',+ required: false,+ },+ eventName: {+ description: 'Event name to match (for event goals)',+ type: 'string',+ required: false,+ },+ eventPropertyKey: {+ description: 'Event property key to match',+ type: 'string',+ required: false,+ },+ eventPropertyValue: {+ description: 'Event property value to match',+ type: 'string | number | boolean',+ required: false,+ },+ }}+/>++</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/1/goals?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/goals?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/1/goals23',+ params={+ '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"+<?php+$ch = curl_init();++curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/goals?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'+require 'uri'++uri = URI('https://app.rybbit.io/api/sites/1/goals?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) 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/1/goals?start_date=2024-01-01&end_date=2024-01-31"++ 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/1/goals?start_date=2024-01-01&end_date=2024-01-31")+ .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/1/goals?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());++ 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/1/goals?start_date=2024-01-01&end_date=2024-01-31");++ var data = await response.Content.ReadAsStringAsync();+ }+}+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "goalId": 1,+ "name": "Signup Completed",+ "goalType": "path",+ "config": {+ "pathPattern": "/signup/complete"+ },+ "createdAt": "2024-01-10T12:00:00.000Z",+ "total_conversions": 1250,+ "total_sessions": 15420,+ "conversion_rate": 0.081+ },+ {+ "goalId": 2,+ "name": "Purchase Made",+ "goalType": "event",+ "config": {+ "eventName": "purchase",+ "eventPropertyKey": "value",+ "eventPropertyValue": 100+ },+ "createdAt": "2024-01-15T09:30:00.000Z",+ "total_conversions": 320,+ "total_sessions": 15420,+ "conversion_rate": 0.021+ }+ ],+ "meta": {+ "total": 2,+ "page": 1,+ "pageSize": 10,+ "totalPages": 1+ }+}+```++</div>+</div>diff --git a/docs/content/docs/api/goals/meta.json b/docs/content/docs/api/goals/meta.jsonnew file mode 100644index 000000000..dd177fd8a--- /dev/null+++ b/docs/content/docs/api/goals/meta.json@@ -0,0 +1,4 @@+{+ "title": "Goals",+ "pages": ["list", "sessions", "create", "update", "delete"]+}diff --git a/docs/content/docs/api/goals/sessions.mdx b/docs/content/docs/api/goals/sessions.mdxnew file mode 100644index 000000000..3ddc92bfd--- /dev/null+++ b/docs/content/docs/api/goals/sessions.mdx@@ -0,0 +1,322 @@+---+title: Get Goal Sessions+description: Returns sessions that completed a specific goal. Useful for analyzing the behavior of converting users.+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/:goalId/sessions+```++Returns sessions that completed a specific goal. Useful for analyzing the behavior of converting users.++### Path Parameters++<TypeTable+ type={{+ goalId: {+ description: 'Goal ID',+ type: 'string | number',+ required: true,+ },+ site: {+ description: 'Site ID or site identifier',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Query Parameters++Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) plus the following:++<TypeTable+ type={{+ page: {+ description: 'Page number (1-indexed)',+ type: 'number',+ default: 1,+ },+ limit: {+ description: 'Number of results per page',+ type: 'number',+ default: 25,+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of session objects',+ type: 'Session[]',+ },+ }}+/>++#### Session Object++<TypeTable+ type={{+ session_id: {+ description: 'Unique session identifier',+ type: 'string',+ },+ user_id: {+ description: 'User identifier',+ type: 'string',+ },+ country: {+ description: 'Country code',+ type: 'string',+ },+ browser: {+ description: 'Browser name',+ type: 'string',+ },+ operating_system: {+ description: 'Operating system',+ type: 'string',+ },+ device_type: {+ description: 'Device type',+ type: 'string',+ },+ entry_page: {+ description: 'First page visited',+ type: 'string',+ },+ exit_page: {+ description: 'Last page visited',+ type: 'string',+ },+ pageviews: {+ description: 'Number of pageviews',+ type: 'number',+ },+ session_duration: {+ description: 'Session duration in seconds',+ type: 'number',+ },+ session_start: {+ description: 'Session start time',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ session_end: {+ description: 'Session end time',+ type: 'string',+ 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/1/goals/1/sessions?page=1&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/goals/1/sessions?page=1&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/1/goals/1/sessions',+ params={+ 'page': 1,+ 'limit': 10+ },+ 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/1/goals/1/sessions?page=1&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'+require 'uri'++uri = URI('https://app.rybbit.io/api/sites/1/goals/1/sessions?page=1&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) 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/1/goals/1/sessions?page=1&limit=10"++ 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/1/goals/1/sessions?page=1&limit=10")+ .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/1/goals/1/sessions?page=1&limit=10"))+ .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/1/goals/1/sessions?page=1&limit=10");++ var data = await response.Content.ReadAsStringAsync();+ }+}+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "session_id": "sess_abc123",+ "user_id": "user_xyz789",+ "country": "US",+ "browser": "Chrome",+ "operating_system": "macOS",+ "device_type": "desktop",+ "entry_page": "/",+ "exit_page": "/signup/complete",+ "pageviews": 5,+ "session_duration": 245,+ "session_start": "2024-01-31T14:00:00.000Z",+ "session_end": "2024-01-31T14:04:05.000Z",+ "referrer": "https://google.com",+ "channel": "organic"+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/goals/update.mdx b/docs/content/docs/api/goals/update.mdxnew file mode 100644index 000000000..ee764b173--- /dev/null+++ b/docs/content/docs/api/goals/update.mdx@@ -0,0 +1,283 @@+---+title: Update Goal+description: Updates an existing goal.+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/sites/:site/goals/:goalId+```++Updates an existing goal.++### Path Parameters++<TypeTable+ type={{+ goalId: {+ description: 'ID of the goal to update',+ type: 'string | number',+ required: true,+ },+ site: {+ description: 'Site ID or site identifier',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Request Body++<TypeTable+ type={{+ name: {+ description: 'Updated goal name',+ type: 'string',+ required: false,+ },+ goalType: {+ description: 'Type of goal',+ type: 'string',+ typeDescription: '"path" | "event"',+ required: true,+ },+ config: {+ description: 'Updated goal configuration',+ type: 'GoalConfig',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ success: {+ description: 'Whether the goal was updated',+ type: 'boolean',+ },+ goalId: {+ description: 'ID of the updated goal',+ 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 PUT "https://app.rybbit.io/api/sites/1/goals/123" \+ -H "Authorization: Bearer your_api_key_here" \+ -H "Content-Type: application/json" \+ -d '{+ "name": "Signup Completed (Updated)",+ "goalType": "path",+ "config": {+ "pathPattern": "/signup/complete/*"+ }+ }'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const response = await fetch(+ 'https://app.rybbit.io/api/sites/1/goals/123',+ {+ method: 'PUT',+ headers: {+ 'Authorization': 'Bearer your_api_key_here',+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ name: 'Signup Completed (Updated)',+ goalType: 'path',+ config: {+ pathPattern: '/signup/complete/*'+ }+ })+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++response = requests.put(+ 'https://app.rybbit.io/api/sites/1/goals/123',+ json={+ 'name': 'Signup Completed (Updated)',+ 'goalType': 'path',+ 'config': {+ 'pathPattern': '/signup/complete/*'+ }+ },+ headers={+ 'Authorization': 'Bearer your_api_key_here'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$body = [+ 'name' => 'Signup Completed (Updated)',+ 'goalType' => 'path',+ 'config' => [+ 'pathPattern' => '/signup/complete/*'+ ]+];++$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/goals/123');+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/sites/1/goals/123')+request = Net::HTTP::Put.new(uri)+request['Authorization'] = 'Bearer your_api_key_here'+request['Content-Type'] = 'application/json'+request.body = {+ name: 'Signup Completed (Updated)',+ goalType: 'path',+ config: { pathPattern: '/signup/complete/*' }+}.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": "Signup Completed (Updated)",+ "goalType": "path",+ "config": map[string]string{+ "pathPattern": "/signup/complete/*",+ },+}+jsonBody, _ := json.Marshal(body)++req, _ := http.NewRequest("PUT", "https://app.rybbit.io/api/sites/1/goals/123", 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": "Signup Completed (Updated)",+ "goalType": "path",+ "config": {+ "pathPattern": "/signup/complete/*"+ }+});++let client = reqwest::Client::new();+let res = client+ .put("https://app.rybbit.io/api/sites/1/goals/123")+ .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": "Signup Completed (Updated)",+ "goalType": "path",+ "config": {+ "pathPattern": "/signup/complete/*"+ }+}+""";++HttpClient client = HttpClient.newHttpClient();+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/sites/1/goals/123"))+ .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 = "Signup Completed (Updated)",+ goalType = "path",+ config = new { pathPattern = "/signup/complete/*" }+};++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/sites/1/goals/123", content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true,+ "goalId": 1+}+```++</div>+</div>diff --git a/docs/content/docs/api/stats/misc.mdx b/docs/content/docs/api/insights/journeys.mdxsimilarity index 56%rename from docs/content/docs/api/stats/misc.mdxrename to docs/content/docs/api/insights/journeys.mdxindex ad8d6aee9..236ff9b7e 100644--- a/docs/content/docs/api/stats/misc.mdx+++ b/docs/content/docs/api/insights/journeys.mdx@@ -1,310 +1,13 @@----title: Misc-description: Retention analysis and user journey tracking endpoints+title: Get Journeys+description: Returns the most common page navigation paths (user journeys) within sessions. Useful for understanding how users navigate through your site.full: true+method: GET---import { TypeTable } from 'fumadocs-ui/components/type-table';import { Tab, Tabs } from 'fumadocs-ui/components/tabs';-See the [API Reference](/docs/api/stats/reference) for authentication, common parameters, and filters.--## Endpoints--<div className="flex flex-col gap-2 my-6">- <a href="#get-retention" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/retention</code>- </a>- <a href="#get-journeys" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/journeys</code>- </a>-</div>-------## Get Retention--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/retention-```--Returns cohort-based retention analysis data. Users are grouped into cohorts based on their first visit, and retention is tracked over subsequent time periods.--### Path Parameters--<TypeTable- type={{- site: {- description: 'Site ID or site identifier',- type: 'string | number',- required: true,- },- }}-/>--### Query Parameters--<TypeTable- type={{- mode: {- description: 'Retention period granularity',- type: 'string',- typeDescription: '"day" | "week"',- default: 'week',- },- range: {- description: 'Number of days to analyze (7-365)',- type: 'number',- default: 90,- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Retention analysis data',- type: 'RetentionData',- },- }}-/>--#### RetentionData Object--<TypeTable- type={{- cohorts: {- description: 'Map of cohort periods to retention data',- type: 'Record<string, CohortData>',- },- maxPeriods: {- description: 'Maximum number of retention periods',- type: 'number',- },- mode: {- description: 'Retention mode used',- type: 'string',- typeDescription: '"day" | "week"',- },- range: {- description: 'Time range in days',- type: 'number',- },- }}-/>--#### CohortData Object--<TypeTable- type={{- size: {- description: 'Number of users in the cohort',- type: 'number',- },- percentages: {- description: 'Retention percentages for each period (index 0 = period 0, etc.)',- type: '(number | null)[]',- typeDescription: 'null indicates no data for that period yet',- },- }}-/>--</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/1/retention?mode=week&range=90" \- -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/retention?mode=week&range=90',- {- 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/1/retention23',- params={- 'mode': 'week',- 'range': 90- },- 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/1/retention?mode=week&range=90');-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/1/retention?mode=week&range=90')-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/1/retention?mode=week&range=90", 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/1/retention?mode=week&range=90")- .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/1/retention?mode=week&range=90"))- .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/1/retention?mode=week&range=90");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": {- "cohorts": {- "2024-01-01": {- "size": 1250,- "percentages": [100, 45.2, 32.1, 28.5, 25.3, 22.1]- },- "2024-01-08": {- "size": 1420,- "percentages": [100, 48.5, 35.2, 30.1, 26.8, null]- },- "2024-01-15": {- "size": 1380,- "percentages": [100, 46.8, 33.5, 29.2, null, null]- },- "2024-01-22": {- "size": 1510,- "percentages": [100, 44.2, 31.8, null, null, null]- },- "2024-01-29": {- "size": 1290,- "percentages": [100, 47.1, null, null, null, null]- }- },- "maxPeriods": 5,- "mode": "week",- "range": 90- }-}-```--### Understanding Retention Data--The retention data shows how many users from each cohort return in subsequent periods:--- **Period 0**: Always 100% (the cohort's first visit)-- **Period 1**: Users who returned 1 week later-- **Period 2**: Users who returned 2 weeks later-- etc.--A `null` value indicates that period hasn't occurred yet for that cohort.--### Visualization Example--```javascript title="Building a Retention Table"-const { cohorts, maxPeriods } = data.data;--// Headers: Cohort, Size, Week 0, Week 1, Week 2, ...-const headers = ['Cohort', 'Size',- ...Array(maxPeriods + 1).fill(0).map((_, i) => `Week ${i}`)-];--// Rows-Object.entries(cohorts).forEach(([date, cohort]) => {- const row = [- date,- cohort.size,- ...cohort.percentages.map(p => p !== null ? `${p}%` : '-')- ];- console.log(row.join(' | '));-});-```--</div>-</div>-------## Get Journeys-<div className="grid grid-cols-1 xl:grid-cols-2 gap-8"><div>diff --git a/docs/content/docs/api/insights/meta.json b/docs/content/docs/api/insights/meta.jsonnew file mode 100644index 000000000..bd502d63a--- /dev/null+++ b/docs/content/docs/api/insights/meta.json@@ -0,0 +1,4 @@+{+ "title": "Insights",+ "pages": ["retention", "journeys"]+}diff --git a/docs/content/docs/api/insights/retention.mdx b/docs/content/docs/api/insights/retention.mdxnew file mode 100644index 000000000..2a8b7766e--- /dev/null+++ b/docs/content/docs/api/insights/retention.mdx@@ -0,0 +1,284 @@+---+title: Get Retention+description: Returns cohort-based retention analysis data. Users are grouped into cohorts based on their first visit, and retention is tracked over subsequent time periods.+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/retention+```++Returns cohort-based retention analysis data. Users are grouped into cohorts based on their first visit, and retention is tracked over subsequent time periods.++### Path Parameters++<TypeTable+ type={{+ site: {+ description: 'Site ID or site identifier',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Query Parameters++<TypeTable+ type={{+ mode: {+ description: 'Retention period granularity',+ type: 'string',+ typeDescription: '"day" | "week"',+ default: 'week',+ },+ range: {+ description: 'Number of days to analyze (7-365)',+ type: 'number',+ default: 90,+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Retention analysis data',+ type: 'RetentionData',+ },+ }}+/>++#### RetentionData Object++<TypeTable+ type={{+ cohorts: {+ description: 'Map of cohort periods to retention data',+ type: 'Record<string, CohortData>',+ },+ maxPeriods: {+ description: 'Maximum number of retention periods',+ type: 'number',+ },+ mode: {+ description: 'Retention mode used',+ type: 'string',+ typeDescription: '"day" | "week"',+ },+ range: {+ description: 'Time range in days',+ type: 'number',+ },+ }}+/>++#### CohortData Object++<TypeTable+ type={{+ size: {+ description: 'Number of users in the cohort',+ type: 'number',+ },+ percentages: {+ description: 'Retention percentages for each period (index 0 = period 0, etc.)',+ type: '(number | null)[]',+ typeDescription: 'null indicates no data for that period yet',+ },+ }}+/>++</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/1/retention?mode=week&range=90" \+ -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/retention?mode=week&range=90',+ {+ 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/1/retention23',+ params={+ 'mode': 'week',+ 'range': 90+ },+ 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/1/retention?mode=week&range=90');+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/1/retention?mode=week&range=90')+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/1/retention?mode=week&range=90", 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/1/retention?mode=week&range=90")+ .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/1/retention?mode=week&range=90"))+ .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/1/retention?mode=week&range=90");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": {+ "cohorts": {+ "2024-01-01": {+ "size": 1250,+ "percentages": [100, 45.2, 32.1, 28.5, 25.3, 22.1]+ },+ "2024-01-08": {+ "size": 1420,+ "percentages": [100, 48.5, 35.2, 30.1, 26.8, null]+ },+ "2024-01-15": {+ "size": 1380,+ "percentages": [100, 46.8, 33.5, 29.2, null, null]+ },+ "2024-01-22": {+ "size": 1510,+ "percentages": [100, 44.2, 31.8, null, null, null]+ },+ "2024-01-29": {+ "size": 1290,+ "percentages": [100, 47.1, null, null, null, null]+ }+ },+ "maxPeriods": 5,+ "mode": "week",+ "range": 90+ }+}+```++### Understanding Retention Data++The retention data shows how many users from each cohort return in subsequent periods:++- **Period 0**: Always 100% (the cohort's first visit)+- **Period 1**: Users who returned 1 week later+- **Period 2**: Users who returned 2 weeks later+- etc.++A `null` value indicates that period hasn't occurred yet for that cohort.++### Visualization Example++```javascript title="Building a Retention Table"+const { cohorts, maxPeriods } = data.data;++// Headers: Cohort, Size, Week 0, Week 1, Week 2, ...+const headers = ['Cohort', 'Size',+ ...Array(maxPeriods + 1).fill(0).map((_, i) => `Week ${i}`)+];++// Rows+Object.entries(cohorts).forEach(([date, cohort]) => {+ const row = [+ date,+ cohort.size,+ ...cohort.percentages.map(p => p !== null ? `${p}%` : '-')+ ];+ console.log(row.join(' | '));+});+```++</div>+</div>diff --git a/docs/content/docs/api/meta.json b/docs/content/docs/api/meta.jsonindex b9229df2a..592b163b1 100644--- a/docs/content/docs/api/meta.json+++ b/docs/content/docs/api/meta.json@@ -3,5 +3,21 @@"description": "REST API endpoints and authentication","icon": "Terminal","root": true,- "pages": ["getting-started", "sending-events", "stats", "organizations", "sites"]+ "pages": [+ "getting-started",+ "sending-events",+ "---Analytics---",+ "overview",+ "sessions",+ "users",+ "events",+ "goals",+ "funnels",+ "performance",+ "errors",+ "insights",+ "---Management---",+ "organizations",+ "sites"+ ]}diff --git a/docs/content/docs/api/organizations.mdx b/docs/content/docs/api/organizations.mdxdeleted file mode 100644index 77c64d5e0..000000000--- a/docs/content/docs/api/organizations.mdx+++ /dev/null@@ -1,1343 +0,0 @@-----title: Organizations-description: Manage organizations, sites, and members-full: true------import { TypeTable } from 'fumadocs-ui/components/type-table';-import { Tab, Tabs } from 'fumadocs-ui/components/tabs';--See the [API Reference](/docs/api/getting-started) for authentication details.--## Endpoints--<div className="flex flex-col gap-2 my-6">- <a href="#get-my-organizations" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/organizations</code>- </a>- <a href="#create-site" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-blue-500/20 text-blue-600 dark:text-blue-400">POST</span>- <code className="text-sm">/api/organizations/:organizationId/sites</code>- </a>- <a href="#get-organization-members" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/organizations/:organizationId/members</code>- </a>- <a href="#add-organization-member" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-blue-500/20 text-blue-600 dark:text-blue-400">POST</span>- <code className="text-sm">/api/organizations/:organizationId/members</code>- </a>-</div>-------## Get My Organizations--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/organizations-```--Returns all organizations the authenticated user is a member of, including all members for each organization. Excludes subscription and billing information. Supports both session cookies and API key (Bearer token) authentication.--### Response--Returns an array of organization objects.--<TypeTable- type={{- id: {- description: 'Organization ID',- type: 'string',- },- name: {- description: 'Organization name',- type: 'string',- },- slug: {- description: 'Organization slug',- type: 'string',- },- logo: {- description: 'Organization logo URL',- type: 'string | null',- },- createdAt: {- description: 'Organization creation timestamp',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- role: {- description: 'Your role in the organization',- type: 'string',- typeDescription: '"owner" | "admin" | "member"',- },- members: {- description: 'Array of organization members',- type: 'array',- },- sites: {- description: 'Array of sites in the organization',- type: 'array',- },- }}-/>--#### Member Object--Each member in the `members` array contains:--<TypeTable- type={{- id: {- description: 'Member record ID',- type: 'string',- },- role: {- description: 'Member role in the organization',- type: 'string',- typeDescription: '"owner" | "admin" | "member"',- },- userId: {- description: 'User ID',- type: 'string',- },- createdAt: {- description: 'Timestamp when member was added',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- user: {- description: 'User details',- type: 'object',- },- }}-/>--#### User Object--<TypeTable- type={{- id: {- description: 'User ID',- type: 'string',- },- name: {- description: 'User display name',- type: 'string',- },- email: {- description: 'User email address',- type: 'string',- },- }}-/>--#### Site Object--Each site in the `sites` array contains:--<TypeTable- type={{- id: {- description: 'Site ID',- type: 'string',- },- domain: {- description: 'Site domain',- type: 'string',- },- name: {- description: 'Site name',- type: 'string',- },- organizationId: {- description: 'Organization ID',- type: 'string',- },- createdBy: {- description: 'User ID who created the site',- type: 'string',- },- public: {- description: 'Whether analytics are publicly accessible',- type: 'boolean',- },- saltUserIds: {- description: 'Whether user IDs are salted',- type: 'boolean',- },- blockBots: {- description: 'Whether bot traffic is blocked',- type: 'boolean',- },- createdAt: {- description: 'Site creation timestamp',- type: 'string',- 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/organizations" \- -H "Authorization: Bearer your_api_key_here"-```- </Tab>- <Tab value="JavaScript">-```javascript title="Request"-const response = await fetch(- 'https://app.rybbit.io/api/organizations',- {- 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/organizations',- 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");-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/organizations')-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/organizations", 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/organizations")- .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"))- .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/organizations");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-[- {- "id": "org_123",- "name": "Acme Inc",- "slug": "acme-inc",- "logo": "https://example.com/logo.png",- "createdAt": "2024-01-15T10:30:00.000Z",- "role": "owner",- "members": [- {- "id": "member_abc123",- "role": "owner",- "userId": "user_xyz789",- "createdAt": "2024-01-15T10:30:00.000Z",- "user": {- "id": "user_xyz789",- "name": "John Doe",- "email": "[email protected]"- }- },- {- "id": "member_def456",- "role": "member",- "userId": "user_abc456",- "createdAt": "2024-02-20T14:15:00.000Z",- "user": {- "id": "user_abc456",- "name": "Jane Smith",- "email": "[email protected]"- }- }- ],- "sites": [- {- "id": "456",- "domain": "example.com",- "name": "My Website",- "organizationId": "org_123",- "createdBy": "user_xyz789",- "public": false,- "saltUserIds": false,- "blockBots": true,- "createdAt": "2024-01-15T10:30:00.000Z"- }- ]- },- {- "id": "org_456",- "name": "Tech Startup",- "slug": "tech-startup",- "logo": null,- "createdAt": "2024-03-10T08:00:00.000Z",- "role": "admin",- "members": [- {- "id": "member_ghi789",- "role": "owner",- "userId": "user_owner123",- "createdAt": "2024-03-10T08:00:00.000Z",- "user": {- "id": "user_owner123",- "name": "Alice Johnson",- "email": "[email protected]"- }- },- {- "id": "member_jkl012",- "role": "admin",- "userId": "user_xyz789",- "createdAt": "2024-03-12T09:30:00.000Z",- "user": {- "id": "user_xyz789",- "name": "John Doe",- "email": "[email protected]"- }- }- ],- "sites": [- {- "id": "789",- "domain": "techstartup.com",- "name": "Tech Startup Website",- "organizationId": "org_456",- "createdBy": "user_owner123",- "public": true,- "saltUserIds": false,- "blockBots": true,- "createdAt": "2024-03-10T08:00:00.000Z"- }- ]- }-]-```--</div>-</div>-------## Create Site--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-POST /api/organizations/:organizationId/sites-```--Creates a new site within an organization. Requires admin or owner role in the organization.--### Path Parameters--<TypeTable- type={{- organizationId: {- description: 'Organization ID to add the site to',- type: 'string',- required: true,- },- }}-/>--### Request Body--<TypeTable- type={{- domain: {- description: 'Site domain',- type: 'string',- typeDescription: 'Valid domain format (e.g., example.com)',- required: true,- },- name: {- description: 'Site display name',- type: 'string',- required: true,- },- public: {- description: 'Make analytics publicly accessible',- type: 'boolean',- default: false,- },- saltUserIds: {- description: 'Salt user IDs for privacy',- type: 'boolean',- default: false,- },- blockBots: {- description: 'Block bot traffic',- type: 'boolean',- default: true,- },- excludedIPs: {- description: 'Array of IP addresses to exclude from tracking',- type: 'string[]',- default: '[]',- },- excludedCountries: {- description: 'Array of ISO country codes to exclude (e.g., ["US", "GB"])',- type: 'string[]',- default: '[]',- },- sessionReplay: {- description: 'Enable session replay recording',- type: 'boolean',- default: false,- },- webVitals: {- description: 'Enable Core Web Vitals tracking',- type: 'boolean',- default: false,- },- trackErrors: {- description: 'Enable JavaScript error tracking',- type: 'boolean',- default: false,- },- trackOutbound: {- description: 'Track outbound link clicks',- type: 'boolean',- default: true,- },- trackUrlParams: {- description: 'Track URL parameters (UTM, etc.)',- type: 'boolean',- default: true,- },- trackInitialPageView: {- description: 'Automatically track the initial page view',- type: 'boolean',- default: true,- },- trackSpaNavigation: {- description: 'Track SPA navigation events',- type: 'boolean',- default: true,- },- trackIp: {- description: 'Store visitor IP addresses',- type: 'boolean',- default: false,- },- trackButtonClicks: {- description: 'Track button click events',- type: 'boolean',- default: false,- },- trackCopy: {- description: 'Track copy events',- type: 'boolean',- default: false,- },- trackFormInteractions: {- description: 'Track form interaction events',- type: 'boolean',- default: false,- },- tags: {- description: 'Array of tags for organizing the site',- type: 'string[]',- default: '[]',- },- }}-/>--### Response--Returns the created site object with the assigned `siteId`.--<TypeTable- type={{- siteId: {- description: 'Numeric site ID (auto-assigned)',- type: 'number',- },- id: {- description: 'Site UUID',- type: 'string',- },- domain: {- description: 'Site domain',- type: 'string',- },- name: {- description: 'Site name',- type: 'string',- },- organizationId: {- description: 'Organization ID',- type: 'string',- },- createdBy: {- description: 'User ID who created the site',- type: 'string',- },- public: {- description: 'Whether analytics are public',- type: 'boolean',- },- saltUserIds: {- description: 'Whether user IDs are salted',- type: 'boolean',- },- blockBots: {- description: 'Whether bot traffic is blocked',- type: 'boolean',- },- excludedIPs: {- description: 'Excluded IP addresses',- type: 'string[]',- },- excludedCountries: {- description: 'Excluded country codes',- type: 'string[]',- },- sessionReplay: {- description: 'Whether session replay is enabled',- type: 'boolean',- },- webVitals: {- description: 'Whether Web Vitals tracking is enabled',- type: 'boolean',- },- trackErrors: {- description: 'Whether error tracking is enabled',- type: 'boolean',- },- trackOutbound: {- description: 'Whether outbound link tracking is enabled',- type: 'boolean',- },- trackUrlParams: {- description: 'Whether URL parameter tracking is enabled',- type: 'boolean',- },- trackInitialPageView: {- description: 'Whether initial page view is tracked automatically',- type: 'boolean',- },- trackSpaNavigation: {- description: 'Whether SPA navigation is tracked',- type: 'boolean',- },- trackIp: {- description: 'Whether IP addresses are stored',- type: 'boolean',- },- trackButtonClicks: {- description: 'Whether button clicks are tracked',- type: 'boolean',- },- trackCopy: {- description: 'Whether copy events are tracked',- type: 'boolean',- },- trackFormInteractions: {- description: 'Whether form interactions are tracked',- type: 'boolean',- },- tags: {- description: 'Site tags',- 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 POST "https://app.rybbit.io/api/organizations/org_123/sites" \- -H "Authorization: Bearer your_api_key_here" \- -H "Content-Type: application/json" \- -d '{"domain": "example.com", "name": "My Website", "blockBots": true}'-```- </Tab>- <Tab value="JavaScript">-```javascript title="Request"-const organizationId = 'org_123';-const response = await fetch(- `https://app.rybbit.io/api/organizations/${organizationId}/sites`,- {- method: 'POST',- headers: {- 'Authorization': 'Bearer your_api_key_here',- 'Content-Type': 'application/json'- },- body: JSON.stringify({- domain: 'example.com',- name: 'My Website',- blockBots: true- })- }-);--const data = await response.json();-```- </Tab>- <Tab value="Python">-```python title="Request"-import requests--organization_id = 'org_123'-response = requests.post(- f'https://app.rybbit.io/api/organizations/{organization_id}/sites',- json={- 'domain': 'example.com',- 'name': 'My Website',- 'blockBots': True- },- headers={- 'Authorization': 'Bearer your_api_key_here'- }-)--data = response.json()-```- </Tab>- <Tab value="PHP">-```php title="Request"-$organizationId = 'org_123';-$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_POST, true);-curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([- 'domain' => 'example.com',- 'name' => 'My Website',- 'blockBots' => true-]));-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_123'-uri = URI("https://app.rybbit.io/api/organizations/#{organization_id}/sites")-req = Net::HTTP::Post.new(uri)-req['Authorization'] = 'Bearer your_api_key_here'-req['Content-Type'] = 'application/json'-req.body = {- domain: 'example.com',- name: 'My Website',- blockBots: true-}.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_123"-body := bytes.NewBuffer([]byte(`{- "domain": "example.com",- "name": "My Website",- "blockBots": true-}`))-req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/organizations/"+organizationId+"/sites", 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_123";-let client = reqwest::Client::new();-let res = client- .post(format!("https://app.rybbit.io/api/organizations/{}/sites", organization_id))- .header("Authorization", "Bearer your_api_key_here")- .json(&serde_json::json!({- "domain": "example.com",- "name": "My Website",- "blockBots": true- }))- .send()- .await?;--let data: serde_json::Value = res.json().await?;-```- </Tab>- <Tab value="Java">-```java title="Request"-String organizationId = "org_123";-HttpClient client = HttpClient.newHttpClient();-String json = "{\"domain\": \"example.com\", \"name\": \"My Website\", \"blockBots\": true}";-HttpRequest request = HttpRequest.newBuilder()- .uri(URI.create("https://app.rybbit.io/api/organizations/" + organizationId + "/sites"))- .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_123";-using var client = new HttpClient();-client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");--var content = new StringContent(- "{\"domain\": \"example.com\", \"name\": \"My Website\", \"blockBots\": true}",- Encoding.UTF8,- "application/json"-);--var response = await client.PostAsync($"https://app.rybbit.io/api/organizations/{organizationId}/sites", content);-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "siteId": 456,- "id": "a1b2c3d4e5f6",- "domain": "example.com",- "name": "My Website",- "organizationId": "org_123",- "createdBy": "user_xyz789",- "public": false,- "saltUserIds": false,- "blockBots": true,- "excludedIPs": [],- "excludedCountries": [],- "sessionReplay": false,- "webVitals": false,- "trackErrors": false,- "trackOutbound": true,- "trackUrlParams": true,- "trackInitialPageView": true,- "trackSpaNavigation": true,- "trackIp": false,- "trackButtonClicks": false,- "trackCopy": false,- "trackFormInteractions": false,- "tags": []-}-```--</div>-</div>-------## Get Organization Members--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/organizations/:organizationId/members-```--Returns all members of an organization with their user details and roles. Requires membership in the organization.--### Path Parameters--<TypeTable- type={{- organizationId: {- description: 'Organization ID',- type: 'string',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- success: {- description: 'Whether the request was successful',- type: 'boolean',- },- data: {- description: 'Array of organization members',- type: 'array',- },- }}-/>--#### Member Object--Each member in the `data` array contains:--<TypeTable- type={{- id: {- description: 'Member record ID',- type: 'string',- },- role: {- description: 'Member role in the organization',- type: 'string',- typeDescription: '"owner" | "admin" | "member"',- },- userId: {- description: 'User ID',- type: 'string',- },- organizationId: {- description: 'Organization ID',- type: 'string',- },- createdAt: {- description: 'Timestamp when member was added',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- user: {- description: 'User details',- type: 'object',- },- }}-/>--#### User Object--<TypeTable- type={{- id: {- description: 'User ID',- type: 'string',- },- name: {- description: 'User display name',- type: 'string',- },- email: {- description: 'User email address',- 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_123/members" \- -H "Authorization: Bearer your_api_key_here"-```- </Tab>- <Tab value="JavaScript">-```javascript title="Request"-const organizationId = 'org_123';-const response = await fetch(- `https://app.rybbit.io/api/organizations/${organizationId}/members`,- {- headers: {- 'Authorization': 'Bearer your_api_key_here'- }- }-);--const data = await response.json();-```- </Tab>- <Tab value="Python">-```python title="Request"-import requests--organization_id = 'org_123'-response = requests.get(- f'https://app.rybbit.io/api/organizations/{organization_id}/members',- headers={- 'Authorization': 'Bearer your_api_key_here'- }-)--data = response.json()-```- </Tab>- <Tab value="PHP">-```php title="Request"-$organizationId = 'org_123';-$ch = curl_init();-curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/organizations/{$organizationId}/members");-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_123'-uri = URI("https://app.rybbit.io/api/organizations/#{organization_id}/members")-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_123"-req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/organizations/"+organizationId+"/members", 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_123";-let client = reqwest::Client::new();-let res = client- .get(format!("https://app.rybbit.io/api/organizations/{}/members", 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_123";-HttpClient client = HttpClient.newHttpClient();-HttpRequest request = HttpRequest.newBuilder()- .uri(URI.create("https://app.rybbit.io/api/organizations/" + organizationId + "/members"))- .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_123";-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}/members");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "success": true,- "data": [- {- "id": "member_abc123",- "role": "owner",- "userId": "user_xyz789",- "organizationId": "org_123",- "createdAt": "2024-01-15T10:30:00.000Z",- "user": {- "id": "user_xyz789",- "name": "John Doe",- "email": "[email protected]"- }- },- {- "id": "member_def456",- "role": "member",- "userId": "user_abc456",- "organizationId": "org_123",- "createdAt": "2024-02-20T14:15:00.000Z",- "user": {- "id": "user_abc456",- "name": "Jane Smith",- "email": "[email protected]"- }- }- ]-}-```--</div>-</div>-------## Add Organization Member--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-POST /api/organizations/:organizationId/members-```--Adds a user to an organization with a specified role. The user must already exist in the system. Requires admin or owner role in the organization.--### Path Parameters--<TypeTable- type={{- organizationId: {- description: 'Organization ID',- type: 'string',- required: true,- },- }}-/>--### Request Body--<TypeTable- type={{- email: {- description: 'Email address of the user to add',- type: 'string',- typeDescription: 'Must match an existing user',- required: true,- },- role: {- description: 'Role to assign to the user',- type: 'string',- typeDescription: '"admin" | "member" | "owner"',- required: true,- },- }}-/>--### Response--Returns a success message when the user is added successfully.--<TypeTable- type={{- message: {- description: 'Success message',- type: 'string',- },- }}-/>--### Error Responses--<TypeTable- type={{- '400': {- description: 'Invalid input (missing fields, invalid role, or user already a member)',- type: 'object',- },- '401': {- description: 'Unauthorized (not an admin/owner of the organization)',- type: 'object',- },- '404': {- description: 'User not found',- type: 'object',- },- '500': {- description: 'Internal server error',- type: '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/organizations/org_123/members" \- -H "Authorization: Bearer your_api_key_here" \- -H "Content-Type: application/json" \- -d '{"email": "[email protected]", "role": "member"}'-```- </Tab>- <Tab value="JavaScript">-```javascript title="Request"-const organizationId = 'org_123';-const response = await fetch(- `https://app.rybbit.io/api/organizations/${organizationId}/members`,- {- method: 'POST',- headers: {- 'Authorization': 'Bearer your_api_key_here',- 'Content-Type': 'application/json'- },- body: JSON.stringify({- email: '[email protected]',- role: 'member'- })- }-);--const data = await response.json();-```- </Tab>- <Tab value="Python">-```python title="Request"-import requests--organization_id = 'org_123'-response = requests.post(- f'https://app.rybbit.io/api/organizations/{organization_id}/members',- json={- 'email': '[email protected]',- 'role': 'member'- },- headers={- 'Authorization': 'Bearer your_api_key_here'- }-)--data = response.json()-```- </Tab>- <Tab value="PHP">-```php title="Request"-$organizationId = 'org_123';-$ch = curl_init();-curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/organizations/{$organizationId}/members");-curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);-curl_setopt($ch, CURLOPT_POST, true);-curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([- 'email' => '[email protected]',- 'role' => 'member'-]));-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_123'-uri = URI("https://app.rybbit.io/api/organizations/#{organization_id}/members")-req = Net::HTTP::Post.new(uri)-req['Authorization'] = 'Bearer your_api_key_here'-req['Content-Type'] = 'application/json'-req.body = {- email: '[email protected]',- role: 'member'-}.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_123"-body := bytes.NewBuffer([]byte(`{- "email": "[email protected]",- "role": "member"-}`))-req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/organizations/"+organizationId+"/members", 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_123";-let client = reqwest::Client::new();-let res = client- .post(format!("https://app.rybbit.io/api/organizations/{}/members", organization_id))- .header("Authorization", "Bearer your_api_key_here")- .json(&serde_json::json!({- "email": "[email protected]",- "role": "member"- }))- .send()- .await?;--let data: serde_json::Value = res.json().await?;-```- </Tab>- <Tab value="Java">-```java title="Request"-String organizationId = "org_123";-HttpClient client = HttpClient.newHttpClient();-String json = "{\"email\": \"[email protected]\", \"role\": \"member\"}";-HttpRequest request = HttpRequest.newBuilder()- .uri(URI.create("https://app.rybbit.io/api/organizations/" + organizationId + "/members"))- .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_123";-using var client = new HttpClient();-client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");--var content = new StringContent(- "{\"email\": \"[email protected]\", \"role\": \"member\"}",- Encoding.UTF8,- "application/json"-);--var response = await client.PostAsync($"https://app.rybbit.io/api/organizations/{organizationId}/members", content);-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "message": "User added to organization successfully"-}-```--```json title="Error Response (400 - Already a Member)"-{- "error": "User is already a member of this organization"-}-```--```json title="Error Response (404 - User Not Found)"-{- "error": "User not found"-}-```--```json title="Error Response (401 - Unauthorized)"-{- "error": "Unauthorized"-}-```--</div>-</div>diff --git a/docs/content/docs/api/organizations/add-member.mdx b/docs/content/docs/api/organizations/add-member.mdxnew file mode 100644index 000000000..3c3696460--- /dev/null+++ b/docs/content/docs/api/organizations/add-member.mdx@@ -0,0 +1,274 @@+---+title: Add Organization Member+description: Adds a user to an organization with a specified role. The user must already exist in the system. Requires admin or owner role in the organization.+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/members+```++Adds a user to an organization with a specified role. The user must already exist in the system. Requires admin or owner role in the organization.++### Path Parameters++<TypeTable+ type={{+ organizationId: {+ description: 'Organization ID',+ type: 'string',+ required: true,+ },+ }}+/>++### Request Body++<TypeTable+ type={{+ email: {+ description: 'Email address of the user to add',+ type: 'string',+ typeDescription: 'Must match an existing user',+ required: true,+ },+ role: {+ description: 'Role to assign to the user',+ type: 'string',+ typeDescription: '"admin" | "member" | "owner"',+ required: true,+ },+ }}+/>++### Response++Returns a success message when the user is added successfully.++<TypeTable+ type={{+ message: {+ description: 'Success message',+ type: 'string',+ },+ }}+/>++### Error Responses++<TypeTable+ type={{+ '400': {+ description: 'Invalid input (missing fields, invalid role, or user already a member)',+ type: 'object',+ },+ '401': {+ description: 'Unauthorized (not an admin/owner of the organization)',+ type: 'object',+ },+ '404': {+ description: 'User not found',+ type: 'object',+ },+ '500': {+ description: 'Internal server error',+ type: '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/organizations/org_123/members" \+ -H "Authorization: Bearer your_api_key_here" \+ -H "Content-Type: application/json" \+ -d '{"email": "[email protected]", "role": "member"}'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const organizationId = 'org_123';+const response = await fetch(+ `https://app.rybbit.io/api/organizations/${organizationId}/members`,+ {+ method: 'POST',+ headers: {+ 'Authorization': 'Bearer your_api_key_here',+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ email: '[email protected]',+ role: 'member'+ })+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++organization_id = 'org_123'+response = requests.post(+ f'https://app.rybbit.io/api/organizations/{organization_id}/members',+ json={+ 'email': '[email protected]',+ 'role': 'member'+ },+ headers={+ 'Authorization': 'Bearer your_api_key_here'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$organizationId = 'org_123';+$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/organizations/{$organizationId}/members");+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);+curl_setopt($ch, CURLOPT_POST, true);+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([+ 'email' => '[email protected]',+ 'role' => 'member'+]));+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_123'+uri = URI("https://app.rybbit.io/api/organizations/#{organization_id}/members")+req = Net::HTTP::Post.new(uri)+req['Authorization'] = 'Bearer your_api_key_here'+req['Content-Type'] = 'application/json'+req.body = {+ email: '[email protected]',+ role: 'member'+}.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_123"+body := bytes.NewBuffer([]byte(`{+ "email": "[email protected]",+ "role": "member"+}`))+req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/organizations/"+organizationId+"/members", 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_123";+let client = reqwest::Client::new();+let res = client+ .post(format!("https://app.rybbit.io/api/organizations/{}/members", organization_id))+ .header("Authorization", "Bearer your_api_key_here")+ .json(&serde_json::json!({+ "email": "[email protected]",+ "role": "member"+ }))+ .send()+ .await?;++let data: serde_json::Value = res.json().await?;+```+ </Tab>+ <Tab value="Java">+```java title="Request"+String organizationId = "org_123";+HttpClient client = HttpClient.newHttpClient();+String json = "{\"email\": \"[email protected]\", \"role\": \"member\"}";+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/organizations/" + organizationId + "/members"))+ .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_123";+using var client = new HttpClient();+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");++var content = new StringContent(+ "{\"email\": \"[email protected]\", \"role\": \"member\"}",+ Encoding.UTF8,+ "application/json"+);++var response = await client.PostAsync($"https://app.rybbit.io/api/organizations/{organizationId}/members", content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "message": "User added to organization successfully"+}+```++```json title="Error Response (400 - Already a Member)"+{+ "error": "User is already a member of this organization"+}+```++```json title="Error Response (404 - User Not Found)"+{+ "error": "User not found"+}+```++```json title="Error Response (401 - Unauthorized)"+{+ "error": "Unauthorized"+}+```++</div>+</div>diff --git a/docs/content/docs/api/organizations/create-site.mdx b/docs/content/docs/api/organizations/create-site.mdxnew file mode 100644index 000000000..13e453ed2--- /dev/null+++ b/docs/content/docs/api/organizations/create-site.mdx@@ -0,0 +1,433 @@+---+title: Create Site+description: Creates a new site within an organization. Requires admin or owner role in the organization.+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/sites+```++Creates a new site within an organization. Requires admin or owner role in the organization.++### Path Parameters++<TypeTable+ type={{+ organizationId: {+ description: 'Organization ID to add the site to',+ type: 'string',+ required: true,+ },+ }}+/>++### Request Body++<TypeTable+ type={{+ domain: {+ description: 'Site domain',+ type: 'string',+ typeDescription: 'Valid domain format (e.g., example.com)',+ required: true,+ },+ name: {+ description: 'Site display name',+ type: 'string',+ required: true,+ },+ public: {+ description: 'Make analytics publicly accessible',+ type: 'boolean',+ default: false,+ },+ saltUserIds: {+ description: 'Salt user IDs for privacy',+ type: 'boolean',+ default: false,+ },+ blockBots: {+ description: 'Block bot traffic',+ type: 'boolean',+ default: true,+ },+ excludedIPs: {+ description: 'Array of IP addresses to exclude from tracking',+ type: 'string[]',+ default: '[]',+ },+ excludedCountries: {+ description: 'Array of ISO country codes to exclude (e.g., ["US", "GB"])',+ type: 'string[]',+ default: '[]',+ },+ sessionReplay: {+ description: 'Enable session replay recording',+ type: 'boolean',+ default: false,+ },+ webVitals: {+ description: 'Enable Core Web Vitals tracking',+ type: 'boolean',+ default: false,+ },+ trackErrors: {+ description: 'Enable JavaScript error tracking',+ type: 'boolean',+ default: false,+ },+ trackOutbound: {+ description: 'Track outbound link clicks',+ type: 'boolean',+ default: true,+ },+ trackUrlParams: {+ description: 'Track URL parameters (UTM, etc.)',+ type: 'boolean',+ default: true,+ },+ trackInitialPageView: {+ description: 'Automatically track the initial page view',+ type: 'boolean',+ default: true,+ },+ trackSpaNavigation: {+ description: 'Track SPA navigation events',+ type: 'boolean',+ default: true,+ },+ trackIp: {+ description: 'Store visitor IP addresses',+ type: 'boolean',+ default: false,+ },+ trackButtonClicks: {+ description: 'Track button click events',+ type: 'boolean',+ default: false,+ },+ trackCopy: {+ description: 'Track copy events',+ type: 'boolean',+ default: false,+ },+ trackFormInteractions: {+ description: 'Track form interaction events',+ type: 'boolean',+ default: false,+ },+ tags: {+ description: 'Array of tags for organizing the site',+ type: 'string[]',+ default: '[]',+ },+ }}+/>++### Response++Returns the created site object with the assigned `siteId`.++<TypeTable+ type={{+ siteId: {+ description: 'Numeric site ID (auto-assigned)',+ type: 'number',+ },+ id: {+ description: 'Site UUID',+ type: 'string',+ },+ domain: {+ description: 'Site domain',+ type: 'string',+ },+ name: {+ description: 'Site name',+ type: 'string',+ },+ organizationId: {+ description: 'Organization ID',+ type: 'string',+ },+ createdBy: {+ description: 'User ID who created the site',+ type: 'string',+ },+ public: {+ description: 'Whether analytics are public',+ type: 'boolean',+ },+ saltUserIds: {+ description: 'Whether user IDs are salted',+ type: 'boolean',+ },+ blockBots: {+ description: 'Whether bot traffic is blocked',+ type: 'boolean',+ },+ excludedIPs: {+ description: 'Excluded IP addresses',+ type: 'string[]',+ },+ excludedCountries: {+ description: 'Excluded country codes',+ type: 'string[]',+ },+ sessionReplay: {+ description: 'Whether session replay is enabled',+ type: 'boolean',+ },+ webVitals: {+ description: 'Whether Web Vitals tracking is enabled',+ type: 'boolean',+ },+ trackErrors: {+ description: 'Whether error tracking is enabled',+ type: 'boolean',+ },+ trackOutbound: {+ description: 'Whether outbound link tracking is enabled',+ type: 'boolean',+ },+ trackUrlParams: {+ description: 'Whether URL parameter tracking is enabled',+ type: 'boolean',+ },+ trackInitialPageView: {+ description: 'Whether initial page view is tracked automatically',+ type: 'boolean',+ },+ trackSpaNavigation: {+ description: 'Whether SPA navigation is tracked',+ type: 'boolean',+ },+ trackIp: {+ description: 'Whether IP addresses are stored',+ type: 'boolean',+ },+ trackButtonClicks: {+ description: 'Whether button clicks are tracked',+ type: 'boolean',+ },+ trackCopy: {+ description: 'Whether copy events are tracked',+ type: 'boolean',+ },+ trackFormInteractions: {+ description: 'Whether form interactions are tracked',+ type: 'boolean',+ },+ tags: {+ description: 'Site tags',+ 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 POST "https://app.rybbit.io/api/organizations/org_123/sites" \+ -H "Authorization: Bearer your_api_key_here" \+ -H "Content-Type: application/json" \+ -d '{"domain": "example.com", "name": "My Website", "blockBots": true}'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const organizationId = 'org_123';+const response = await fetch(+ `https://app.rybbit.io/api/organizations/${organizationId}/sites`,+ {+ method: 'POST',+ headers: {+ 'Authorization': 'Bearer your_api_key_here',+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ domain: 'example.com',+ name: 'My Website',+ blockBots: true+ })+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++organization_id = 'org_123'+response = requests.post(+ f'https://app.rybbit.io/api/organizations/{organization_id}/sites',+ json={+ 'domain': 'example.com',+ 'name': 'My Website',+ 'blockBots': True+ },+ headers={+ 'Authorization': 'Bearer your_api_key_here'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$organizationId = 'org_123';+$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_POST, true);+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([+ 'domain' => 'example.com',+ 'name' => 'My Website',+ 'blockBots' => true+]));+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_123'+uri = URI("https://app.rybbit.io/api/organizations/#{organization_id}/sites")+req = Net::HTTP::Post.new(uri)+req['Authorization'] = 'Bearer your_api_key_here'+req['Content-Type'] = 'application/json'+req.body = {+ domain: 'example.com',+ name: 'My Website',+ blockBots: true+}.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_123"+body := bytes.NewBuffer([]byte(`{+ "domain": "example.com",+ "name": "My Website",+ "blockBots": true+}`))+req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/organizations/"+organizationId+"/sites", 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_123";+let client = reqwest::Client::new();+let res = client+ .post(format!("https://app.rybbit.io/api/organizations/{}/sites", organization_id))+ .header("Authorization", "Bearer your_api_key_here")+ .json(&serde_json::json!({+ "domain": "example.com",+ "name": "My Website",+ "blockBots": true+ }))+ .send()+ .await?;++let data: serde_json::Value = res.json().await?;+```+ </Tab>+ <Tab value="Java">+```java title="Request"+String organizationId = "org_123";+HttpClient client = HttpClient.newHttpClient();+String json = "{\"domain\": \"example.com\", \"name\": \"My Website\", \"blockBots\": true}";+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/organizations/" + organizationId + "/sites"))+ .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_123";+using var client = new HttpClient();+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");++var content = new StringContent(+ "{\"domain\": \"example.com\", \"name\": \"My Website\", \"blockBots\": true}",+ Encoding.UTF8,+ "application/json"+);++var response = await client.PostAsync($"https://app.rybbit.io/api/organizations/{organizationId}/sites", content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "siteId": 456,+ "id": "a1b2c3d4e5f6",+ "domain": "example.com",+ "name": "My Website",+ "organizationId": "org_123",+ "createdBy": "user_xyz789",+ "public": false,+ "saltUserIds": false,+ "blockBots": true,+ "excludedIPs": [],+ "excludedCountries": [],+ "sessionReplay": false,+ "webVitals": false,+ "trackErrors": false,+ "trackOutbound": true,+ "trackUrlParams": true,+ "trackInitialPageView": true,+ "trackSpaNavigation": true,+ "trackIp": false,+ "trackButtonClicks": false,+ "trackCopy": false,+ "trackFormInteractions": false,+ "tags": []+}+```++</div>+</div>diff --git a/docs/content/docs/api/organizations/list.mdx b/docs/content/docs/api/organizations/list.mdxnew file mode 100644index 000000000..771ec4427--- /dev/null+++ b/docs/content/docs/api/organizations/list.mdx@@ -0,0 +1,369 @@+---+title: Get My Organizations+description: Returns all organizations the authenticated user is a member of, including all members for each organization. Excludes subscription and billing information. Supports both session cookies and API key (Bearer token) authentication.+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+```++Returns all organizations the authenticated user is a member of, including all members for each organization. Excludes subscription and billing information. Supports both session cookies and API key (Bearer token) authentication.++### Response++Returns an array of organization objects.++<TypeTable+ type={{+ id: {+ description: 'Organization ID',+ type: 'string',+ },+ name: {+ description: 'Organization name',+ type: 'string',+ },+ slug: {+ description: 'Organization slug',+ type: 'string',+ },+ logo: {+ description: 'Organization logo URL',+ type: 'string | null',+ },+ createdAt: {+ description: 'Organization creation timestamp',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ role: {+ description: 'Your role in the organization',+ type: 'string',+ typeDescription: '"owner" | "admin" | "member"',+ },+ members: {+ description: 'Array of organization members',+ type: 'array',+ },+ sites: {+ description: 'Array of sites in the organization',+ type: 'array',+ },+ }}+/>++#### Member Object++Each member in the `members` array contains:++<TypeTable+ type={{+ id: {+ description: 'Member record ID',+ type: 'string',+ },+ role: {+ description: 'Member role in the organization',+ type: 'string',+ typeDescription: '"owner" | "admin" | "member"',+ },+ userId: {+ description: 'User ID',+ type: 'string',+ },+ createdAt: {+ description: 'Timestamp when member was added',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ user: {+ description: 'User details',+ type: 'object',+ },+ }}+/>++#### User Object++<TypeTable+ type={{+ id: {+ description: 'User ID',+ type: 'string',+ },+ name: {+ description: 'User display name',+ type: 'string',+ },+ email: {+ description: 'User email address',+ type: 'string',+ },+ }}+/>++#### Site Object++Each site in the `sites` array contains:++<TypeTable+ type={{+ id: {+ description: 'Site ID',+ type: 'string',+ },+ domain: {+ description: 'Site domain',+ type: 'string',+ },+ name: {+ description: 'Site name',+ type: 'string',+ },+ organizationId: {+ description: 'Organization ID',+ type: 'string',+ },+ createdBy: {+ description: 'User ID who created the site',+ type: 'string',+ },+ public: {+ description: 'Whether analytics are publicly accessible',+ type: 'boolean',+ },+ saltUserIds: {+ description: 'Whether user IDs are salted',+ type: 'boolean',+ },+ blockBots: {+ description: 'Whether bot traffic is blocked',+ type: 'boolean',+ },+ createdAt: {+ description: 'Site creation timestamp',+ type: 'string',+ 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/organizations" \+ -H "Authorization: Bearer your_api_key_here"+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const response = await fetch(+ 'https://app.rybbit.io/api/organizations',+ {+ 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/organizations',+ 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");+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/organizations')+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/organizations", 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/organizations")+ .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"))+ .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/organizations");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+[+ {+ "id": "org_123",+ "name": "Acme Inc",+ "slug": "acme-inc",+ "logo": "https://example.com/logo.png",+ "createdAt": "2024-01-15T10:30:00.000Z",+ "role": "owner",+ "members": [+ {+ "id": "member_abc123",+ "role": "owner",+ "userId": "user_xyz789",+ "createdAt": "2024-01-15T10:30:00.000Z",+ "user": {+ "id": "user_xyz789",+ "name": "John Doe",+ "email": "[email protected]"+ }+ },+ {+ "id": "member_def456",+ "role": "member",+ "userId": "user_abc456",+ "createdAt": "2024-02-20T14:15:00.000Z",+ "user": {+ "id": "user_abc456",+ "name": "Jane Smith",+ "email": "[email protected]"+ }+ }+ ],+ "sites": [+ {+ "id": "456",+ "domain": "example.com",+ "name": "My Website",+ "organizationId": "org_123",+ "createdBy": "user_xyz789",+ "public": false,+ "saltUserIds": false,+ "blockBots": true,+ "createdAt": "2024-01-15T10:30:00.000Z"+ }+ ]+ },+ {+ "id": "org_456",+ "name": "Tech Startup",+ "slug": "tech-startup",+ "logo": null,+ "createdAt": "2024-03-10T08:00:00.000Z",+ "role": "admin",+ "members": [+ {+ "id": "member_ghi789",+ "role": "owner",+ "userId": "user_owner123",+ "createdAt": "2024-03-10T08:00:00.000Z",+ "user": {+ "id": "user_owner123",+ "name": "Alice Johnson",+ "email": "[email protected]"+ }+ },+ {+ "id": "member_jkl012",+ "role": "admin",+ "userId": "user_xyz789",+ "createdAt": "2024-03-12T09:30:00.000Z",+ "user": {+ "id": "user_xyz789",+ "name": "John Doe",+ "email": "[email protected]"+ }+ }+ ],+ "sites": [+ {+ "id": "789",+ "domain": "techstartup.com",+ "name": "Tech Startup Website",+ "organizationId": "org_456",+ "createdBy": "user_owner123",+ "public": true,+ "saltUserIds": false,+ "blockBots": true,+ "createdAt": "2024-03-10T08:00:00.000Z"+ }+ ]+ }+]+```++</div>+</div>diff --git a/docs/content/docs/api/organizations/members.mdx b/docs/content/docs/api/organizations/members.mdxnew file mode 100644index 000000000..53eade9fb--- /dev/null+++ b/docs/content/docs/api/organizations/members.mdx@@ -0,0 +1,256 @@+---+title: Get Organization Members+description: Returns all members of an organization with their user details and roles. Requires membership in the organization.+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/members+```++Returns all members of an organization with their user details and roles. Requires membership in the organization.++### Path Parameters++<TypeTable+ type={{+ organizationId: {+ description: 'Organization ID',+ type: 'string',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ success: {+ description: 'Whether the request was successful',+ type: 'boolean',+ },+ data: {+ description: 'Array of organization members',+ type: 'array',+ },+ }}+/>++#### Member Object++Each member in the `data` array contains:++<TypeTable+ type={{+ id: {+ description: 'Member record ID',+ type: 'string',+ },+ role: {+ description: 'Member role in the organization',+ type: 'string',+ typeDescription: '"owner" | "admin" | "member"',+ },+ userId: {+ description: 'User ID',+ type: 'string',+ },+ organizationId: {+ description: 'Organization ID',+ type: 'string',+ },+ createdAt: {+ description: 'Timestamp when member was added',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ user: {+ description: 'User details',+ type: 'object',+ },+ }}+/>++#### User Object++<TypeTable+ type={{+ id: {+ description: 'User ID',+ type: 'string',+ },+ name: {+ description: 'User display name',+ type: 'string',+ },+ email: {+ description: 'User email address',+ 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_123/members" \+ -H "Authorization: Bearer your_api_key_here"+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const organizationId = 'org_123';+const response = await fetch(+ `https://app.rybbit.io/api/organizations/${organizationId}/members`,+ {+ headers: {+ 'Authorization': 'Bearer your_api_key_here'+ }+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++organization_id = 'org_123'+response = requests.get(+ f'https://app.rybbit.io/api/organizations/{organization_id}/members',+ headers={+ 'Authorization': 'Bearer your_api_key_here'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$organizationId = 'org_123';+$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/organizations/{$organizationId}/members");+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_123'+uri = URI("https://app.rybbit.io/api/organizations/#{organization_id}/members")+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_123"+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/organizations/"+organizationId+"/members", 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_123";+let client = reqwest::Client::new();+let res = client+ .get(format!("https://app.rybbit.io/api/organizations/{}/members", 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_123";+HttpClient client = HttpClient.newHttpClient();+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/organizations/" + organizationId + "/members"))+ .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_123";+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}/members");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true,+ "data": [+ {+ "id": "member_abc123",+ "role": "owner",+ "userId": "user_xyz789",+ "organizationId": "org_123",+ "createdAt": "2024-01-15T10:30:00.000Z",+ "user": {+ "id": "user_xyz789",+ "name": "John Doe",+ "email": "[email protected]"+ }+ },+ {+ "id": "member_def456",+ "role": "member",+ "userId": "user_abc456",+ "organizationId": "org_123",+ "createdAt": "2024-02-20T14:15:00.000Z",+ "user": {+ "id": "user_abc456",+ "name": "Jane Smith",+ "email": "[email protected]"+ }+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/organizations/meta.json b/docs/content/docs/api/organizations/meta.jsonnew file mode 100644index 000000000..5fd8600a7--- /dev/null+++ b/docs/content/docs/api/organizations/meta.json@@ -0,0 +1,4 @@+{+ "title": "Organizations",+ "pages": ["list", "create-site", "members", "add-member"]+}diff --git a/docs/content/docs/api/overview/live-visitors.mdx b/docs/content/docs/api/overview/live-visitors.mdxnew file mode 100644index 000000000..f27894cb5--- /dev/null+++ b/docs/content/docs/api/overview/live-visitors.mdx@@ -0,0 +1,214 @@+---+title: Get Live Visitors+description: Returns the count of unique active sessions within the specified time window. Useful for displaying real-time visitor 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/live-user-count+```++Returns the count of unique active sessions within the specified time window. Useful for displaying real-time visitor counts.++### Path Parameters++<TypeTable+ type={{+ site: {+ description: 'Site ID or site identifier',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Query Parameters++<TypeTable+ type={{+ minutes: {+ description: 'Time window in minutes to count active sessions',+ type: 'number',+ default: 5,+ typeDescription: 'Sessions with activity within the last N minutes are considered "live"',+ },+ }}+/>++### Response++<TypeTable+ type={{+ count: {+ description: 'Number of unique active sessions',+ type: 'number',+ },+ }}+/>++#### Time Window Guide++| Minutes | Use Case |+|---------|----------|+| `1` | Very active visitors (currently browsing) |+| `5` | Standard "live" count (default) |+| `15` | Recently active visitors |+| `30` | Short-term engagement window |++</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/live-user-count?minutes=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/live-user-count?minutes=5',+ {+ headers: {+ 'Authorization': 'Bearer your_api_key_here'+ }+ }+);++const { count } = await response.json();+console.log(`Live visitors: ${count}`);+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++response = requests.get(+ 'https://app.rybbit.io/api/sites/123/live-user-count',+ params={'minutes': 5},+ headers={+ 'Authorization': 'Bearer your_api_key_here'+ }+)++data = response.json()+print(f"Live visitors: {data['count']}")+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/live-user-count?minutes=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);+echo "Live visitors: " . $data['count'];+```+ </Tab>+ <Tab value="Ruby">+```ruby title="Request"+require 'net/http'+require 'json'++uri = URI('https://app.rybbit.io/api/sites/123/live-user-count?minutes=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)+puts "Live visitors: #{data['count']}"+```+ </Tab>+ <Tab value="Go">+```go title="Request"+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/live-user-count?minutes=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)+fmt.Printf("Live visitors: %v\n", data["count"])+```+ </Tab>+ <Tab value="Rust">+```rust title="Request"+let client = reqwest::Client::new();+let res = client+ .get("https://app.rybbit.io/api/sites/123/live-user-count?minutes=5")+ .header("Authorization", "Bearer your_api_key_here")+ .send()+ .await?;++let data: serde_json::Value = res.json().await?;+println!("Live visitors: {}", data["count"]);+```+ </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/live-user-count?minutes=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/live-user-count?minutes=5");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "count": 42+}+```++### Polling Example++```javascript title="Real-time Widget"+async function updateLiveCount() {+ const response = await fetch(+ 'https://app.rybbit.io/api/sites/123/live-user-count?minutes=5',+ {+ headers: {+ 'Authorization': 'Bearer your_api_key'+ }+ }+ );+ const { count } = await response.json();+ document.getElementById('live-visitors')+ .textContent = count;+}++// Update every 15 seconds+setInterval(updateLiveCount, 15000);+```++</div>+</div>diff --git a/docs/content/docs/api/overview/meta.json b/docs/content/docs/api/overview/meta.jsonnew file mode 100644index 000000000..cf5c45b6a--- /dev/null+++ b/docs/content/docs/api/overview/meta.json@@ -0,0 +1,4 @@+{+ "title": "Overview",+ "pages": ["overview", "time-series", "metric", "live-visitors"]+}diff --git a/docs/content/docs/api/overview/metric.mdx b/docs/content/docs/api/overview/metric.mdxnew file mode 100644index 000000000..3fa9f465f--- /dev/null+++ b/docs/content/docs/api/overview/metric.mdx@@ -0,0 +1,253 @@+---+title: Get Metric+description: Returns dimensional analytics data broken down by a specific parameter. Supports pagination.+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/metric+```++Returns dimensional analytics data broken down by a specific parameter. Supports pagination.++### 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) plus the following:++<TypeTable+ type={{+ parameter: {+ description: 'The dimension to break down by',+ type: 'FilterParameter',+ typeDescription: 'e.g., "pathname", "country", "browser", "event_name"',+ required: true,+ },+ limit: {+ description: 'Number of results per page',+ type: 'number',+ default: 100,+ },+ page: {+ description: 'Page number (1-indexed)',+ type: 'number',+ default: 1,+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of metric results',+ type: 'MetricItem[]',+ typeDescription: 'See MetricItem structure below',+ },+ totalCount: {+ description: 'Total number of unique values across all pages',+ type: 'number',+ },+ }}+/>++#### MetricItem Structure++<TypeTable+ type={{+ value: {+ description: 'The dimension value',+ type: 'string',+ typeDescription: 'e.g., "/blog", "Chrome", "US"',+ },+ count: {+ description: 'Number of sessions for this value',+ type: 'number',+ },+ percentage: {+ description: 'Percentage of total sessions',+ type: 'number',+ typeDescription: 'Range: 0-100',+ },+ pageviews: {+ description: 'Total pageviews (for page-related parameters)',+ type: 'number',+ required: false,+ },+ bounce_rate: {+ description: 'Bounce rate percentage',+ type: 'number',+ typeDescription: 'Range: 0-100',+ required: false,+ },+ }}+/>++</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/metric?parameter=country&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/metric?parameter=country&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/metric',+ params={+ 'parameter': 'country',+ '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/metric?parameter=country&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/metric?parameter=country&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/metric?parameter=country&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/metric?parameter=country&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/metric?parameter=country&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/metric?parameter=country&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": {+ "data": [+ {+ "value": "US",+ "count": 8420,+ "percentage": 54.63,+ "pageviews": 26891,+ "pageviews_percentage": 54.96,+ "bounce_rate": 41.2+ },+ {+ "value": "GB",+ "count": 2150,+ "percentage": 13.95,+ "pageviews": 6847,+ "pageviews_percentage": 13.99,+ "bounce_rate": 43.8+ }+ ],+ "totalCount": 87+ }+}+```++</div>+</div>diff --git a/docs/content/docs/api/overview/overview.mdx b/docs/content/docs/api/overview/overview.mdxnew file mode 100644index 000000000..f4928ad37--- /dev/null+++ b/docs/content/docs/api/overview/overview.mdx@@ -0,0 +1,201 @@+---+title: Get Overview+description: Returns high-level analytics metrics for a site.+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/overview+```++Returns high-level analytics metrics for a site.++### 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).++### Response++<TypeTable+ type={{+ sessions: {+ description: 'Total number of sessions',+ type: 'number',+ },+ pageviews: {+ description: 'Total number of pageviews',+ type: 'number',+ },+ users: {+ description: 'Total unique users',+ type: 'number',+ },+ pages_per_session: {+ description: 'Average pages viewed per session',+ type: 'number',+ },+ bounce_rate: {+ description: 'Percentage of single-page sessions',+ type: 'number',+ typeDescription: 'Range: 0-100',+ },+ session_duration: {+ description: 'Average session duration in seconds',+ 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/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/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/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/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/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/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/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/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/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": {+ "sessions": 15420,+ "pageviews": 48933,+ "users": 12847,+ "pages_per_session": 3.17,+ "bounce_rate": 42.8,+ "session_duration": 182.5+ }+}+```++</div>+</div>diff --git a/docs/content/docs/api/overview/time-series.mdx b/docs/content/docs/api/overview/time-series.mdxnew file mode 100644index 000000000..497d0a9b7--- /dev/null+++ b/docs/content/docs/api/overview/time-series.mdx@@ -0,0 +1,250 @@+---+title: Get Overview (Time Series)+description: Returns time-series analytics data broken down by configurable time buckets. Useful for charting trends 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/overview-bucketed+```++Returns time-series analytics data broken down by configurable time buckets. Useful for charting trends 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) plus the following:++<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"',+ required: true,+ },+ }}+/>++#### 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',+ },+ sessions: {+ description: 'Number of sessions in this bucket',+ type: 'number',+ },+ pageviews: {+ description: 'Number of pageviews in this bucket',+ type: 'number',+ },+ users: {+ description: 'Unique users in this bucket',+ type: 'number',+ },+ pages_per_session: {+ description: 'Average pages viewed per session',+ type: 'number',+ },+ bounce_rate: {+ description: 'Percentage of single-page sessions',+ type: 'number',+ typeDescription: 'Range: 0-100',+ },+ session_duration: {+ description: 'Average session duration in seconds',+ 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/overview-bucketed?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',+ {+ 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/overview-bucketed',+ 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/overview-bucketed?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/overview-bucketed?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/overview-bucketed?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/overview-bucketed?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/overview-bucketed?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/overview-bucketed?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",+ "sessions": 1250,+ "pageviews": 3890,+ "users": 1100,+ "pages_per_session": 3.11,+ "bounce_rate": 41.5,+ "session_duration": 165.2+ },+ {+ "time": "2024-01-02T00:00:00.000Z",+ "sessions": 1420,+ "pageviews": 4520,+ "users": 1280,+ "pages_per_session": 3.18,+ "bounce_rate": 39.8,+ "session_duration": 178.4+ },+ {+ "time": "2024-01-03T00:00:00.000Z",+ "sessions": 1380,+ "pageviews": 4210,+ "users": 1190,+ "pages_per_session": 3.05,+ "bounce_rate": 42.1,+ "session_duration": 162.8+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/performance/by-dimension.mdx b/docs/content/docs/api/performance/by-dimension.mdxnew file mode 100644index 000000000..701984445--- /dev/null+++ b/docs/content/docs/api/performance/by-dimension.mdx@@ -0,0 +1,277 @@+---+title: Get Performance by Dimension+description: Returns performance metrics broken down by a specific dimension (page, country, browser, etc.). Useful for identifying performance issues on specific pages or for specific user segments.+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/performance/by-dimension+```++Returns performance metrics broken down by a specific dimension (page, country, browser, etc.). Useful for identifying performance issues on specific pages or for specific user segments.++### 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) plus the following:++<TypeTable+ type={{+ dimension: {+ description: 'Dimension to break down by',+ type: 'string',+ typeDescription: '"pathname" | "country" | "device_type" | "browser" | "operating_system" | "region"',+ required: true,+ },+ page: {+ description: 'Page number (1-indexed)',+ type: 'number',+ required: false,+ },+ limit: {+ description: 'Number of results per page',+ type: 'number',+ default: 100,+ },+ sort_by: {+ description: 'Field to sort by',+ type: 'string',+ default: 'event_count',+ },+ sort_order: {+ description: 'Sort direction',+ type: 'string',+ typeDescription: '"asc" | "desc"',+ default: 'desc',+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Paginated response object',+ type: 'PaginatedResponse',+ },+ }}+/>++#### DimensionPerformance Object++Each object includes the dimension value plus all percentiles:++<TypeTable+ type={{+ pathname: {+ description: 'The dimension value (field name matches dimension param)',+ type: 'string',+ },+ event_count: {+ description: 'Number of performance events',+ type: 'number',+ },+ lcp_avg: {+ description: 'Average LCP',+ type: 'number',+ },+ lcp_p50: {+ description: 'LCP 50th percentile',+ type: 'number',+ },+ lcp_p75: {+ description: 'LCP 75th percentile',+ type: 'number',+ },+ lcp_p90: {+ description: 'LCP 90th percentile',+ type: 'number',+ },+ lcp_p99: {+ description: 'LCP 99th percentile',+ 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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/1/performance/by-dimension',+ params={+ 'dimension': 'pathname',+ 'sort_by': 'lcp_p75',+ 'sort_order': 'desc',+ '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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&limit=10");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": {+ "data": [+ {+ "pathname": "/dashboard",+ "event_count": 12450,+ "lcp_avg": 2850,+ "lcp_p50": 2400,+ "lcp_p75": 3200,+ "lcp_p90": 4100,+ "lcp_p99": 6500,+ "cls_avg": 0.08,+ "cls_p50": 0.05,+ "cls_p75": 0.12,+ "inp_avg": 180,+ "inp_p50": 150,+ "inp_p75": 220,+ "fcp_avg": 1450,+ "fcp_p50": 1300,+ "fcp_p75": 1700,+ "ttfb_avg": 520,+ "ttfb_p50": 480,+ "ttfb_p75": 680+ },+ {+ "pathname": "/reports",+ "event_count": 8920,+ "lcp_avg": 2650,+ "lcp_p50": 2200,+ "lcp_p75": 2900,+ "lcp_p90": 3800,+ "lcp_p99": 5800+ }+ ],+ "totalCount": 156+ }+}+```++</div>+</div>diff --git a/docs/content/docs/api/performance/meta.json b/docs/content/docs/api/performance/meta.jsonnew file mode 100644index 000000000..aa494e669--- /dev/null+++ b/docs/content/docs/api/performance/meta.json@@ -0,0 +1,4 @@+{+ "title": "Performance",+ "pages": ["overview", "time-series", "by-dimension"]+}diff --git a/docs/content/docs/api/performance/overview.mdx b/docs/content/docs/api/performance/overview.mdxnew file mode 100644index 000000000..4a1246168--- /dev/null+++ b/docs/content/docs/api/performance/overview.mdx@@ -0,0 +1,227 @@+---+title: Get Performance Overview+description: Returns aggregate performance metrics with percentile breakdowns for all Core Web Vitals.+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/performance/overview+```++Returns aggregate performance metrics with percentile breakdowns for all Core Web Vitals.++### 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).++### Response++<TypeTable+ type={{+ data: {+ description: 'Performance metrics object',+ type: 'PerformanceMetrics',+ },+ }}+/>++#### PerformanceMetrics Object++Each metric (lcp, cls, inp, fcp, ttfb) includes the following percentiles:++<TypeTable+ type={{+ lcp_p50: {+ description: 'LCP 50th percentile (median)',+ type: 'number',+ typeDescription: 'milliseconds',+ },+ lcp_p75: {+ description: 'LCP 75th percentile',+ type: 'number',+ typeDescription: 'milliseconds',+ },+ lcp_p90: {+ description: 'LCP 90th percentile',+ type: 'number',+ typeDescription: 'milliseconds',+ },+ lcp_p99: {+ description: 'LCP 99th percentile',+ type: 'number',+ typeDescription: 'milliseconds',+ },+ total_performance_events: {+ description: 'Total number of performance measurements',+ 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/1/performance/overview?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/performance/overview?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/1/performance/overview23',+ params={+ '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/1/performance/overview?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/1/performance/overview?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/1/performance/overview?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/1/performance/overview?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/1/performance/overview?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/1/performance/overview?start_date=2024-01-01&end_date=2024-01-31");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": {+ "lcp_p50": 1850,+ "lcp_p75": 2400,+ "lcp_p90": 3200,+ "lcp_p99": 5100,+ "cls_p50": 0.05,+ "cls_p75": 0.1,+ "cls_p90": 0.18,+ "cls_p99": 0.35,+ "inp_p50": 120,+ "inp_p75": 180,+ "inp_p90": 280,+ "inp_p99": 450,+ "fcp_p50": 1200,+ "fcp_p75": 1600,+ "fcp_p90": 2100,+ "fcp_p99": 3500,+ "ttfb_p50": 450,+ "ttfb_p75": 650,+ "ttfb_p90": 950,+ "ttfb_p99": 1800,+ "total_performance_events": 48521+ }+}+```++</div>+</div>diff --git a/docs/content/docs/api/performance/time-series.mdx b/docs/content/docs/api/performance/time-series.mdxnew file mode 100644index 000000000..2c9153a8a--- /dev/null+++ b/docs/content/docs/api/performance/time-series.mdx@@ -0,0 +1,236 @@+---+title: Get Performance Time Series+description: Returns performance metrics over time, broken down by configurable time buckets. Useful for charting performance trends.+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/performance/time-series+```++Returns performance metrics over time, broken down by configurable time buckets. Useful for charting performance trends.++### 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) plus the following:++<TypeTable+ type={{+ bucket: {+ description: 'Time bucket size for grouping data',+ type: 'TimeBucket',+ typeDescription: '"minute" | "five_minutes" | "hour" | "day" | "week" | "month"',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of time-bucketed performance data',+ type: 'PerformancePoint[]',+ },+ }}+/>++#### PerformancePoint Object++Each point includes all percentiles for each metric plus:++<TypeTable+ type={{+ time: {+ description: 'Start of the time bucket',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ event_count: {+ description: 'Number of performance events 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/1/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&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/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=UTC',+ {+ 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/1/performance/time-series',+ params={+ 'bucket': 'day',+ 'start_date': '2024-01-01',+ 'end_date': '2024-01-07',+ 'time_zone': 'UTC'+ },+ 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/1/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&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'++uri = URI('https://app.rybbit.io/api/sites/1/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&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"+req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/1/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&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 client = reqwest::Client::new();+let res = client+ .get("https://app.rybbit.io/api/sites/1/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=UTC")+ .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/1/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&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"+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/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=UTC");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "time": "2024-01-01T00:00:00.000Z",+ "lcp_p50": 1820,+ "lcp_p75": 2350,+ "lcp_p90": 3100,+ "lcp_p99": 4900,+ "cls_p50": 0.04,+ "cls_p75": 0.09,+ "inp_p50": 115,+ "inp_p75": 175,+ "fcp_p50": 1180,+ "fcp_p75": 1580,+ "ttfb_p50": 440,+ "ttfb_p75": 640,+ "event_count": 6892+ },+ {+ "time": "2024-01-02T00:00:00.000Z",+ "lcp_p50": 1900,+ "lcp_p75": 2450,+ "lcp_p90": 3250,+ "lcp_p99": 5200,+ "cls_p50": 0.05,+ "cls_p75": 0.11,+ "inp_p50": 125,+ "inp_p75": 185,+ "fcp_p50": 1220,+ "fcp_p75": 1620,+ "ttfb_p50": 460,+ "ttfb_p75": 660,+ "event_count": 7234+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/sessions/get.mdx b/docs/content/docs/api/sessions/get.mdxnew file mode 100644index 000000000..f6a929c39--- /dev/null+++ b/docs/content/docs/api/sessions/get.mdx@@ -0,0 +1,288 @@+---+title: Get Session+description: Returns detailed information about a specific session including all events and pageviews.+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/sessions/:sessionId+```++Returns detailed information about a specific session including all events and pageviews.++### Path Parameters++<TypeTable+ type={{+ sessionId: {+ description: 'Session ID',+ type: 'string',+ required: true,+ },+ site: {+ description: 'Site ID or site identifier',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Query Parameters++<TypeTable+ type={{+ limit: {+ description: 'Number of events to return',+ type: 'number',+ default: 100,+ },+ offset: {+ description: 'Number of events to skip',+ type: 'number',+ default: 0,+ },+ minutes: {+ description: 'Only return events from the last N minutes',+ type: 'number',+ required: false,+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Session details object',+ type: 'SessionDetails',+ },+ }}+/>++#### SessionDetails Object++<TypeTable+ type={{+ session: {+ description: 'Session metadata',+ type: 'SessionMeta',+ },+ events: {+ description: 'Array of events in the session',+ type: 'Event[]',+ },+ pagination: {+ description: 'Pagination info for events',+ type: 'Pagination',+ },+ }}+/>++#### Event Object++<TypeTable+ type={{+ timestamp: {+ description: 'Event timestamp',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ pathname: {+ description: 'Page path',+ type: 'string',+ },+ hostname: {+ description: 'Hostname',+ type: 'string',+ },+ page_title: {+ description: 'Page title',+ type: 'string',+ },+ type: {+ description: 'Event type',+ type: 'string',+ typeDescription: '"pageview" | "custom_event" | "error" | "outbound"',+ },+ event_name: {+ description: 'Custom event name (for custom_event type)',+ type: 'string',+ },+ props: {+ description: 'Event properties',+ type: '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 GET "https://app.rybbit.io/api/sites/123/sessions/sess_abc123?limit=50" \+ -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/sessions/sess_abc123?limit=50',+ {+ 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/sessions/sess_abc123',+ params={'limit': 50},+ 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/sessions/sess_abc123?limit=50');+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/sessions/sess_abc123?limit=50')+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/sessions/sess_abc123?limit=50", 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/sessions/sess_abc123?limit=50")+ .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/sessions/sess_abc123?limit=50"))+ .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/sessions/sess_abc123?limit=50");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": {+ "session": {+ "session_id": "sess_abc123",+ "user_id": "dev_xyz789",+ "country": "US",+ "browser": "Chrome",+ "operating_system": "macOS",+ "device_type": "desktop",+ "session_start": "2024-01-31T14:00:00.000Z",+ "session_end": "2024-01-31T14:04:05.000Z",+ "session_duration": 245,+ "pageviews": 5,+ "events": 7,+ "entry_page": "/",+ "exit_page": "/pricing"+ },+ "events": [+ {+ "timestamp": "2024-01-31T14:00:00.000Z",+ "pathname": "/",+ "hostname": "example.com",+ "page_title": "Home",+ "type": "pageview",+ "referrer": "https://google.com"+ },+ {+ "timestamp": "2024-01-31T14:01:30.000Z",+ "pathname": "/",+ "hostname": "example.com",+ "type": "custom_event",+ "event_name": "cta_click",+ "props": { "button": "hero" }+ }+ ],+ "pagination": {+ "total": 7,+ "limit": 50,+ "offset": 0,+ "hasMore": false+ }+ }+}+```++</div>+</div>diff --git a/docs/content/docs/api/sessions/list.mdx b/docs/content/docs/api/sessions/list.mdxnew file mode 100644index 000000000..28b2d5420--- /dev/null+++ b/docs/content/docs/api/sessions/list.mdx@@ -0,0 +1,322 @@+---+title: Get Sessions+description: Returns a paginated list of sessions with their analytics data.+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/sessions+```++Returns a paginated list of sessions with their analytics data.++### 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) plus the following:++<TypeTable+ type={{+ page: {+ description: 'Page number (1-indexed)',+ type: 'number',+ default: 1,+ },+ limit: {+ description: 'Number of results per page',+ type: 'number',+ default: 100,+ },+ user_id: {+ description: 'Filter sessions by user ID',+ type: 'string',+ required: false,+ },+ identified_only: {+ description: 'Only return sessions from identified users',+ type: 'string',+ typeDescription: '"true" | "false"',+ default: 'false',+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of session objects',+ type: 'Session[]',+ },+ }}+/>++#### Session Object++<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',+ },+ traits: {+ description: 'Custom user traits',+ type: 'object | null',+ },+ 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',+ type: 'string',+ },+ device_type: {+ description: 'Device type',+ type: 'string',+ },+ referrer: {+ description: 'Referrer URL',+ type: 'string',+ },+ channel: {+ description: 'Traffic channel',+ type: 'string',+ },+ entry_page: {+ description: 'First page visited',+ type: 'string',+ },+ exit_page: {+ description: 'Last page visited',+ type: 'string',+ },+ pageviews: {+ description: 'Number of pageviews',+ type: 'number',+ },+ events: {+ description: 'Number of custom events',+ type: 'number',+ },+ session_duration: {+ description: 'Duration in seconds',+ type: 'number',+ },+ session_start: {+ description: 'Session start time',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ session_end: {+ description: 'Session end time',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ utm_source: {+ description: 'UTM source parameter',+ type: 'string',+ },+ utm_medium: {+ description: 'UTM medium parameter',+ type: 'string',+ },+ utm_campaign: {+ description: 'UTM campaign parameter',+ 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/1/sessions?page=1&limit=20&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/sessions?page=1&limit=20&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/1/sessions',+ params={+ 'page': 1,+ 'limit': 20,+ '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/1/sessions?page=1&limit=20&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/1/sessions?page=1&limit=20&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/1/sessions?page=1&limit=20&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/1/sessions?page=1&limit=20&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/1/sessions?page=1&limit=20&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/1/sessions?page=1&limit=20&start_date=2024-01-01&end_date=2024-01-31");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "session_id": "sess_abc123",+ "user_id": "dev_xyz789",+ "identified_user_id": "[email protected]",+ "traits": { "plan": "pro" },+ "country": "US",+ "region": "California",+ "city": "San Francisco",+ "browser": "Chrome",+ "operating_system": "macOS",+ "device_type": "desktop",+ "referrer": "https://google.com",+ "channel": "organic",+ "entry_page": "/",+ "exit_page": "/pricing",+ "pageviews": 5,+ "events": 2,+ "session_duration": 245,+ "session_start": "2024-01-31T14:00:00.000Z",+ "session_end": "2024-01-31T14:04:05.000Z",+ "utm_source": "google",+ "utm_medium": "cpc",+ "utm_campaign": "brand"+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/sessions/locations.mdx b/docs/content/docs/api/sessions/locations.mdxnew file mode 100644index 000000000..eaf441949--- /dev/null+++ b/docs/content/docs/api/sessions/locations.mdx@@ -0,0 +1,221 @@+---+title: Get Session Locations+description: Returns aggregated session locations with coordinates for map visualization.+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-locations+```++Returns aggregated session locations with coordinates for map visualization.++### 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).++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of location objects',+ type: 'Location[]',+ },+ }}+/>++#### Location Object++<TypeTable+ type={{+ lat: {+ description: 'Latitude coordinate',+ type: 'number',+ },+ lon: {+ description: 'Longitude coordinate',+ type: 'number',+ },+ city: {+ description: 'City name',+ type: 'string',+ },+ country: {+ description: 'Country code',+ type: 'string',+ },+ count: {+ description: 'Number of sessions from this location',+ 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/1/session-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',+ {+ 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/1/session-locations',+ params={+ '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/1/session-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'+]);++$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/1/session-locations?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/1/session-locations?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/1/session-locations?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/1/session-locations?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/1/session-locations?start_date=2024-01-01&end_date=2024-01-31");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "lat": 37.7749,+ "lon": -122.4194,+ "city": "San Francisco",+ "country": "US",+ "count": 1250+ },+ {+ "lat": 40.7128,+ "lon": -74.006,+ "city": "New York",+ "country": "US",+ "count": 980+ },+ {+ "lat": 51.5074,+ "lon": -0.1278,+ "city": "London",+ "country": "GB",+ "count": 650+ }+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/sessions/meta.json b/docs/content/docs/api/sessions/meta.jsonnew file mode 100644index 000000000..d0d398d70--- /dev/null+++ b/docs/content/docs/api/sessions/meta.json@@ -0,0 +1,4 @@+{+ "title": "Sessions",+ "pages": ["list", "get", "locations"]+}diff --git a/docs/content/docs/api/sites.mdx b/docs/content/docs/api/sites.mdxdeleted file mode 100644index 524f3a862..000000000--- a/docs/content/docs/api/sites.mdx+++ /dev/null@@ -1,1466 +0,0 @@-----title: Sites-description: Manage sites, configuration, private links, and exclusion settings-full: true------import { TypeTable } from 'fumadocs-ui/components/type-table';-import { Tab, Tabs } from 'fumadocs-ui/components/tabs';-import { Callout } from 'fumadocs-ui/components/callout';--See the [API Reference](/docs/api/getting-started) for authentication details.--<Callout type="info">-Looking to create a new site? See the [Create Site](/docs/api/organizations#create-site) endpoint under Organizations.-</Callout>--## Endpoints--<div className="flex flex-col gap-2 my-6">- <a href="#get-site" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:siteId</code>- </a>- <a href="#delete-site" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-red-500/20 text-red-600 dark:text-red-400">DELETE</span>- <code className="text-sm">/api/sites/:siteId</code>- </a>- <a href="#update-site-config" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-yellow-500/20 text-yellow-600 dark:text-yellow-400">PUT</span>- <code className="text-sm">/api/sites/:siteId/config</code>- </a>- <a href="#get-excluded-ips" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:siteId/excluded-ips</code>- </a>- <a href="#get-excluded-countries" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:siteId/excluded-countries</code>- </a>- <a href="#get-private-link-config" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:siteId/private-link-config</code>- </a>- <a href="#update-private-link-config" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-blue-500/20 text-blue-600 dark:text-blue-400">POST</span>- <code className="text-sm">/api/sites/:siteId/private-link-config</code>- </a>-</div>-------## Get Site--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:siteId-```--Returns detailed information about a specific site including its configuration.--### Path Parameters--<TypeTable- type={{- siteId: {- description: 'Site ID',- type: 'string | number',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- id: {- description: 'Site UUID',- type: 'string | null',- },- siteId: {- description: 'Numeric site ID',- type: 'number',- },- name: {- description: 'Site name',- type: 'string',- },- domain: {- description: 'Site domain',- type: 'string',- },- createdAt: {- description: 'Creation timestamp',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- updatedAt: {- description: 'Last update timestamp',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- createdBy: {- description: 'User ID who created the site',- type: 'string',- },- organizationId: {- description: 'Organization ID',- type: 'string | null',- },- public: {- description: 'Whether the site analytics are publicly accessible',- type: 'boolean',- },- saltUserIds: {- description: 'Whether user IDs are salted for privacy',- type: 'boolean',- },- blockBots: {- description: 'Whether bot traffic is blocked',- type: 'boolean',- },- isOwner: {- description: 'Whether the current user owns this site',- type: 'boolean',- },- sessionReplay: {- description: 'Whether session replay is enabled',- type: 'boolean',- },- webVitals: {- description: 'Whether Web Vitals tracking is enabled',- type: 'boolean',- },- trackErrors: {- description: 'Whether error tracking is enabled',- type: 'boolean',- },- trackOutbound: {- description: 'Whether outbound link tracking is enabled',- type: 'boolean',- },- trackUrlParams: {- description: 'Whether URL parameter tracking is enabled',- 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" \- -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',- {- 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',- 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');-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')-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", 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")- .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"))- .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");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "id": "site_abc123",- "siteId": 123,- "name": "My Website",- "domain": "example.com",- "createdAt": "2024-01-15T10:30:00.000Z",- "updatedAt": "2024-01-31T14:00:00.000Z",- "createdBy": "user_xyz789",- "organizationId": "org_def456",- "public": false,- "saltUserIds": false,- "blockBots": true,- "isOwner": true,- "sessionReplay": true,- "webVitals": true,- "trackErrors": true,- "trackOutbound": true,- "trackUrlParams": false-}-```--</div>-</div>-------## Delete Site--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-DELETE /api/sites/:siteId-```--Permanently deletes a site and all its associated data. This action cannot be undone. Requires admin or owner role.--### Path Parameters--<TypeTable- type={{- siteId: {- description: 'Site ID',- type: 'string | number',- 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" \- -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',- {- 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',- 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');-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')-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", 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")- .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"))- .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");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "success": true-}-```--</div>-</div>-------## Update Site Config--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-PUT /api/sites/:siteId/config-```--Updates site configuration settings. All fields are optional - only include the fields you want to update. Requires admin or owner role.--### Path Parameters--<TypeTable- type={{- siteId: {- description: 'Site ID',- type: 'string | number',- required: true,- },- }}-/>--### Request Body--<TypeTable- type={{- domain: {- description: 'Site domain',- type: 'string',- typeDescription: 'Valid domain format (e.g., example.com)',- required: false,- },- public: {- description: 'Make analytics publicly accessible',- type: 'boolean',- required: false,- },- saltUserIds: {- description: 'Salt user IDs for privacy',- type: 'boolean',- required: false,- },- blockBots: {- description: 'Block bot traffic',- type: 'boolean',- required: false,- },- excludedIPs: {- description: 'List of IP addresses or CIDR ranges to exclude',- type: 'string[]',- typeDescription: 'Max 100 entries',- required: false,- },- excludedCountries: {- description: 'List of country codes to exclude',- type: 'string[]',- typeDescription: '2-letter ISO codes (e.g., US, GB)',- required: false,- },- sessionReplay: {- description: 'Enable session replay',- type: 'boolean',- required: false,- },- webVitals: {- description: 'Enable Web Vitals tracking',- type: 'boolean',- required: false,- },- trackErrors: {- description: 'Enable error tracking',- type: 'boolean',- required: false,- },- trackOutbound: {- description: 'Enable outbound link tracking',- type: 'boolean',- required: false,- },- trackUrlParams: {- description: 'Enable URL parameter tracking',- type: 'boolean',- required: false,- },- }}-/>--### Response--<TypeTable- type={{- success: {- description: 'Whether the update was successful',- type: 'boolean',- },- message: {- description: 'Status message',- type: 'string',- },- config: {- description: 'Updated site configuration',- type: '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 PUT "https://app.rybbit.io/api/sites/123/config" \- -H "Authorization: Bearer your_api_key_here" \- -H "Content-Type: application/json" \- -d '{"public": true, "blockBots": true, "excludedCountries": ["CN", "RU"]}'-```- </Tab>- <Tab value="JavaScript">-```javascript title="Request"-const response = await fetch(- 'https://app.rybbit.io/api/sites/123/config',- {- method: 'PUT',- headers: {- 'Authorization': 'Bearer your_api_key_here',- 'Content-Type': 'application/json'- },- body: JSON.stringify({- public: true,- blockBots: true,- excludedCountries: ['CN', 'RU']- })- }-);--const data = await response.json();-```- </Tab>- <Tab value="Python">-```python title="Request"-import requests--response = requests.put(- 'https://app.rybbit.io/api/sites/123/config',- json={- 'public': True,- 'blockBots': True,- 'excludedCountries': ['CN', 'RU']- },- 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/config');-curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);-curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');-curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([- 'public' => true,- 'blockBots' => true,- 'excludedCountries' => ['CN', 'RU']-]));-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/config')-req = Net::HTTP::Put.new(uri)-req['Authorization'] = 'Bearer your_api_key_here'-req['Content-Type'] = 'application/json'-req.body = { public: true, blockBots: true, excludedCountries: ['CN', 'RU'] }.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(`{"public": true, "blockBots": true, "excludedCountries": ["CN", "RU"]}`))-req, _ := http.NewRequest("PUT", "https://app.rybbit.io/api/sites/123/config", 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 client = reqwest::Client::new();-let res = client- .put("https://app.rybbit.io/api/sites/123/config")- .header("Authorization", "Bearer your_api_key_here")- .json(&serde_json::json!({- "public": true,- "blockBots": true,- "excludedCountries": ["CN", "RU"]- }))- .send()- .await?;--let data: serde_json::Value = res.json().await?;-```- </Tab>- <Tab value="Java">-```java title="Request"-HttpClient client = HttpClient.newHttpClient();-String json = "{\"public\": true, \"blockBots\": true, \"excludedCountries\": [\"CN\", \"RU\"]}";-HttpRequest request = HttpRequest.newBuilder()- .uri(URI.create("https://app.rybbit.io/api/sites/123/config"))- .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"-using var client = new HttpClient();-client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");--var content = new StringContent(- "{\"public\": true, \"blockBots\": true, \"excludedCountries\": [\"CN\", \"RU\"]}",- Encoding.UTF8,- "application/json"-);--var response = await client.PutAsync("https://app.rybbit.io/api/sites/123/config", content);-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "success": true,- "message": "Site configuration updated successfully",- "config": {- "public": true,- "saltUserIds": false,- "blockBots": true,- "excludedIPs": [],- "excludedCountries": ["CN", "RU"],- "sessionReplay": true,- "webVitals": true,- "trackErrors": true,- "trackOutbound": true,- "trackUrlParams": false- }-}-```--</div>-</div>-------## Get Excluded IPs--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:siteId/excluded-ips-```--Returns the list of IP addresses and CIDR ranges that are excluded from tracking.--### Path Parameters--<TypeTable- type={{- siteId: {- description: 'Site ID',- type: 'string | number',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- success: {- description: 'Whether the request was successful',- type: 'boolean',- },- excludedIPs: {- description: 'Array of excluded IP addresses or CIDR ranges',- 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-ips" \- -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-ips',- {- 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-ips',- 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-ips');-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-ips')-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-ips", 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-ips")- .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-ips"))- .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-ips");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "success": true,- "excludedIPs": [- "192.168.1.1",- "10.0.0.0/8",- "172.16.0.0/12"- ]-}-```--</div>-</div>-------## Get Excluded Countries--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:siteId/excluded-countries-```--Returns the list of country codes that are excluded from tracking.--### Path Parameters--<TypeTable- type={{- siteId: {- description: 'Site ID',- type: 'string | number',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- success: {- description: 'Whether the request was successful',- type: 'boolean',- },- excludedCountries: {- description: 'Array of excluded country codes (2-letter ISO codes)',- 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-countries" \- -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-countries',- {- 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-countries',- 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-countries');-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-countries')-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-countries", 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-countries")- .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-countries"))- .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-countries");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "success": true,- "excludedCountries": [- "CN",- "RU",- "KP"- ]-}-```--</div>-</div>-------## Get Private Link Config--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:siteId/private-link-config-```--Returns the private link key configuration. Private links allow sharing analytics with a secret key without requiring authentication.--### Path Parameters--<TypeTable- type={{- siteId: {- description: 'Site ID',- type: 'string | number',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- success: {- description: 'Whether the request was successful',- type: 'boolean',- },- data: {- description: 'Private link configuration',- type: 'object',- },- }}-/>--#### Data Object--<TypeTable- type={{- privateLinkKey: {- description: 'Private link key, or null if not generated',- type: 'string | null',- },- }}-/>--</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/private-link-config" \- -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/private-link-config',- {- 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/private-link-config',- 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/private-link-config');-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/private-link-config')-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/private-link-config", 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/private-link-config")- .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/private-link-config"))- .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/private-link-config");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "success": true,- "data": {- "privateLinkKey": "a1b2c3d4e5f6"- }-}-```--</div>-</div>-------## Update Private Link Config--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-POST /api/sites/:siteId/private-link-config-```--Generates or revokes a private link key for sharing analytics without authentication. Requires admin or owner role.--### Path Parameters--<TypeTable- type={{- siteId: {- description: 'Site ID',- type: 'string | number',- required: true,- },- }}-/>--### Request Body--<TypeTable- type={{- action: {- description: 'Action to perform',- type: 'string',- typeDescription: '"generate_private_link_key" | "revoke_private_link_key"',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- success: {- description: 'Whether the request was successful',- type: 'boolean',- },- data: {- description: 'Updated private link configuration',- type: 'object',- },- }}-/>--#### Data Object--<TypeTable- type={{- privateLinkKey: {- description: 'New private link key (for generate), or null (for revoke)',- type: 'string | null',- },- }}-/>--</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/private-link-config" \- -H "Authorization: Bearer your_api_key_here" \- -H "Content-Type: application/json" \- -d '{"action": "generate_private_link_key"}'-```- </Tab>- <Tab value="JavaScript">-```javascript title="Request"-const response = await fetch(- 'https://app.rybbit.io/api/sites/123/private-link-config',- {- method: 'POST',- headers: {- 'Authorization': 'Bearer your_api_key_here',- 'Content-Type': 'application/json'- },- body: JSON.stringify({- action: 'generate_private_link_key'- })- }-);--const data = await response.json();-```- </Tab>- <Tab value="Python">-```python title="Request"-import requests--response = requests.post(- 'https://app.rybbit.io/api/sites/123/private-link-config',- json={- 'action': 'generate_private_link_key'- },- 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/private-link-config');-curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);-curl_setopt($ch, CURLOPT_POST, true);-curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([- 'action' => 'generate_private_link_key'-]));-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/private-link-config')-req = Net::HTTP::Post.new(uri)-req['Authorization'] = 'Bearer your_api_key_here'-req['Content-Type'] = 'application/json'-req.body = { action: 'generate_private_link_key' }.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(`{"action": "generate_private_link_key"}`))-req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/sites/123/private-link-config", 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 client = reqwest::Client::new();-let res = client- .post("https://app.rybbit.io/api/sites/123/private-link-config")- .header("Authorization", "Bearer your_api_key_here")- .json(&serde_json::json!({- "action": "generate_private_link_key"- }))- .send()- .await?;--let data: serde_json::Value = res.json().await?;-```- </Tab>- <Tab value="Java">-```java title="Request"-HttpClient client = HttpClient.newHttpClient();-String json = "{\"action\": \"generate_private_link_key\"}";-HttpRequest request = HttpRequest.newBuilder()- .uri(URI.create("https://app.rybbit.io/api/sites/123/private-link-config"))- .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"-using var client = new HttpClient();-client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");--var content = new StringContent(- "{\"action\": \"generate_private_link_key\"}",- Encoding.UTF8,- "application/json"-);--var response = await client.PostAsync("https://app.rybbit.io/api/sites/123/private-link-config", content);-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "success": true,- "data": {- "privateLinkKey": "f6e5d4c3b2a1"- }-}-```--</div>-</div>diff --git a/docs/content/docs/api/sites/delete.mdx b/docs/content/docs/api/sites/delete.mdxnew file mode 100644index 000000000..6bbfa4f90--- /dev/null+++ b/docs/content/docs/api/sites/delete.mdx@@ -0,0 +1,166 @@+---+title: Delete Site+description: Permanently deletes a site and all its associated data. This action cannot be undone. Requires admin or 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/sites/:siteId+```++Permanently deletes a site and all its associated data. This action cannot be undone. Requires admin or owner role.++### Path Parameters++<TypeTable+ type={{+ siteId: {+ description: 'Site ID',+ type: 'string | number',+ 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" \+ -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',+ {+ 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',+ 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');+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')+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", 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")+ .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"))+ .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");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true+}+```++</div>+</div>diff --git a/docs/content/docs/api/sites/excluded-countries.mdx b/docs/content/docs/api/sites/excluded-countries.mdxnew file mode 100644index 000000000..2321d2924--- /dev/null+++ b/docs/content/docs/api/sites/excluded-countries.mdx@@ -0,0 +1,173 @@+---+title: Get Excluded Countries+description: Returns the list of country codes that are excluded from tracking.+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/:siteId/excluded-countries+```++Returns the list of country codes that are excluded from tracking.++### Path Parameters++<TypeTable+ type={{+ siteId: {+ description: 'Site ID',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ success: {+ description: 'Whether the request was successful',+ type: 'boolean',+ },+ excludedCountries: {+ description: 'Array of excluded country codes (2-letter ISO codes)',+ 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-countries" \+ -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-countries',+ {+ 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-countries',+ 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-countries');+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-countries')+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-countries", 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-countries")+ .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-countries"))+ .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-countries");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true,+ "excludedCountries": [+ "CN",+ "RU",+ "KP"+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/sites/excluded-ips.mdx b/docs/content/docs/api/sites/excluded-ips.mdxnew file mode 100644index 000000000..b0c7c53e3--- /dev/null+++ b/docs/content/docs/api/sites/excluded-ips.mdx@@ -0,0 +1,173 @@+---+title: Get Excluded IPs+description: Returns the list of IP addresses and CIDR ranges that are excluded from tracking.+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/:siteId/excluded-ips+```++Returns the list of IP addresses and CIDR ranges that are excluded from tracking.++### Path Parameters++<TypeTable+ type={{+ siteId: {+ description: 'Site ID',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ success: {+ description: 'Whether the request was successful',+ type: 'boolean',+ },+ excludedIPs: {+ description: 'Array of excluded IP addresses or CIDR ranges',+ 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-ips" \+ -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-ips',+ {+ 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-ips',+ 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-ips');+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-ips')+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-ips", 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-ips")+ .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-ips"))+ .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-ips");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true,+ "excludedIPs": [+ "192.168.1.1",+ "10.0.0.0/8",+ "172.16.0.0/12"+ ]+}+```++</div>+</div>diff --git a/docs/content/docs/api/sites/get-private-link.mdx b/docs/content/docs/api/sites/get-private-link.mdxnew file mode 100644index 000000000..b46e300de--- /dev/null+++ b/docs/content/docs/api/sites/get-private-link.mdx@@ -0,0 +1,182 @@+---+title: Get Private Link Config+description: Returns the private link key configuration. Private links allow sharing analytics with a secret key without requiring authentication.+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/:siteId/private-link-config+```++Returns the private link key configuration. Private links allow sharing analytics with a secret key without requiring authentication.++### Path Parameters++<TypeTable+ type={{+ siteId: {+ description: 'Site ID',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ success: {+ description: 'Whether the request was successful',+ type: 'boolean',+ },+ data: {+ description: 'Private link configuration',+ type: 'object',+ },+ }}+/>++#### Data Object++<TypeTable+ type={{+ privateLinkKey: {+ description: 'Private link key, or null if not generated',+ type: 'string | null',+ },+ }}+/>++</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/private-link-config" \+ -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/private-link-config',+ {+ 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/private-link-config',+ 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/private-link-config');+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/private-link-config')+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/private-link-config", 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/private-link-config")+ .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/private-link-config"))+ .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/private-link-config");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true,+ "data": {+ "privateLinkKey": "a1b2c3d4e5f6"+ }+}+```++</div>+</div>diff --git a/docs/content/docs/api/sites/get.mdx b/docs/content/docs/api/sites/get.mdxnew file mode 100644index 000000000..b73edb225--- /dev/null+++ b/docs/content/docs/api/sites/get.mdx@@ -0,0 +1,246 @@+---+title: Get Site+description: Returns detailed information about a specific site including its configuration.+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/:siteId+```++Returns detailed information about a specific site including its configuration.++### Path Parameters++<TypeTable+ type={{+ siteId: {+ description: 'Site ID',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ id: {+ description: 'Site UUID',+ type: 'string | null',+ },+ siteId: {+ description: 'Numeric site ID',+ type: 'number',+ },+ name: {+ description: 'Site name',+ type: 'string',+ },+ domain: {+ description: 'Site domain',+ type: 'string',+ },+ createdAt: {+ description: 'Creation timestamp',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ updatedAt: {+ description: 'Last update timestamp',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ createdBy: {+ description: 'User ID who created the site',+ type: 'string',+ },+ organizationId: {+ description: 'Organization ID',+ type: 'string | null',+ },+ public: {+ description: 'Whether the site analytics are publicly accessible',+ type: 'boolean',+ },+ saltUserIds: {+ description: 'Whether user IDs are salted for privacy',+ type: 'boolean',+ },+ blockBots: {+ description: 'Whether bot traffic is blocked',+ type: 'boolean',+ },+ isOwner: {+ description: 'Whether the current user owns this site',+ type: 'boolean',+ },+ sessionReplay: {+ description: 'Whether session replay is enabled',+ type: 'boolean',+ },+ webVitals: {+ description: 'Whether Web Vitals tracking is enabled',+ type: 'boolean',+ },+ trackErrors: {+ description: 'Whether error tracking is enabled',+ type: 'boolean',+ },+ trackOutbound: {+ description: 'Whether outbound link tracking is enabled',+ type: 'boolean',+ },+ trackUrlParams: {+ description: 'Whether URL parameter tracking is enabled',+ 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" \+ -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',+ {+ 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',+ 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');+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')+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", 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")+ .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"))+ .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");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "id": "site_abc123",+ "siteId": 123,+ "name": "My Website",+ "domain": "example.com",+ "createdAt": "2024-01-15T10:30:00.000Z",+ "updatedAt": "2024-01-31T14:00:00.000Z",+ "createdBy": "user_xyz789",+ "organizationId": "org_def456",+ "public": false,+ "saltUserIds": false,+ "blockBots": true,+ "isOwner": true,+ "sessionReplay": true,+ "webVitals": true,+ "trackErrors": true,+ "trackOutbound": true,+ "trackUrlParams": false+}+```++</div>+</div>diff --git a/docs/content/docs/api/sites/meta.json b/docs/content/docs/api/sites/meta.jsonnew file mode 100644index 000000000..b0e835520--- /dev/null+++ b/docs/content/docs/api/sites/meta.json@@ -0,0 +1,4 @@+{+ "title": "Sites",+ "pages": ["get", "delete", "update-config", "excluded-ips", "excluded-countries", "get-private-link", "update-private-link"]+}diff --git a/docs/content/docs/api/sites/update-config.mdx b/docs/content/docs/api/sites/update-config.mdxnew file mode 100644index 000000000..8cb5a4723--- /dev/null+++ b/docs/content/docs/api/sites/update-config.mdx@@ -0,0 +1,288 @@+---+title: Update Site Config+description: Updates site configuration settings. All fields are optional - only include the fields you want to update. Requires admin or 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/sites/:siteId/config+```++Updates site configuration settings. All fields are optional - only include the fields you want to update. Requires admin or owner role.++### Path Parameters++<TypeTable+ type={{+ siteId: {+ description: 'Site ID',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Request Body++<TypeTable+ type={{+ domain: {+ description: 'Site domain',+ type: 'string',+ typeDescription: 'Valid domain format (e.g., example.com)',+ required: false,+ },+ public: {+ description: 'Make analytics publicly accessible',+ type: 'boolean',+ required: false,+ },+ saltUserIds: {+ description: 'Salt user IDs for privacy',+ type: 'boolean',+ required: false,+ },+ blockBots: {+ description: 'Block bot traffic',+ type: 'boolean',+ required: false,+ },+ excludedIPs: {+ description: 'List of IP addresses or CIDR ranges to exclude',+ type: 'string[]',+ typeDescription: 'Max 100 entries',+ required: false,+ },+ excludedCountries: {+ description: 'List of country codes to exclude',+ type: 'string[]',+ typeDescription: '2-letter ISO codes (e.g., US, GB)',+ required: false,+ },+ sessionReplay: {+ description: 'Enable session replay',+ type: 'boolean',+ required: false,+ },+ webVitals: {+ description: 'Enable Web Vitals tracking',+ type: 'boolean',+ required: false,+ },+ trackErrors: {+ description: 'Enable error tracking',+ type: 'boolean',+ required: false,+ },+ trackOutbound: {+ description: 'Enable outbound link tracking',+ type: 'boolean',+ required: false,+ },+ trackUrlParams: {+ description: 'Enable URL parameter tracking',+ type: 'boolean',+ required: false,+ },+ }}+/>++### Response++<TypeTable+ type={{+ success: {+ description: 'Whether the update was successful',+ type: 'boolean',+ },+ message: {+ description: 'Status message',+ type: 'string',+ },+ config: {+ description: 'Updated site configuration',+ type: '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 PUT "https://app.rybbit.io/api/sites/123/config" \+ -H "Authorization: Bearer your_api_key_here" \+ -H "Content-Type: application/json" \+ -d '{"public": true, "blockBots": true, "excludedCountries": ["CN", "RU"]}'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const response = await fetch(+ 'https://app.rybbit.io/api/sites/123/config',+ {+ method: 'PUT',+ headers: {+ 'Authorization': 'Bearer your_api_key_here',+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ public: true,+ blockBots: true,+ excludedCountries: ['CN', 'RU']+ })+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++response = requests.put(+ 'https://app.rybbit.io/api/sites/123/config',+ json={+ 'public': True,+ 'blockBots': True,+ 'excludedCountries': ['CN', 'RU']+ },+ 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/config');+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);+curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([+ 'public' => true,+ 'blockBots' => true,+ 'excludedCountries' => ['CN', 'RU']+]));+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/config')+req = Net::HTTP::Put.new(uri)+req['Authorization'] = 'Bearer your_api_key_here'+req['Content-Type'] = 'application/json'+req.body = { public: true, blockBots: true, excludedCountries: ['CN', 'RU'] }.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(`{"public": true, "blockBots": true, "excludedCountries": ["CN", "RU"]}`))+req, _ := http.NewRequest("PUT", "https://app.rybbit.io/api/sites/123/config", 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 client = reqwest::Client::new();+let res = client+ .put("https://app.rybbit.io/api/sites/123/config")+ .header("Authorization", "Bearer your_api_key_here")+ .json(&serde_json::json!({+ "public": true,+ "blockBots": true,+ "excludedCountries": ["CN", "RU"]+ }))+ .send()+ .await?;++let data: serde_json::Value = res.json().await?;+```+ </Tab>+ <Tab value="Java">+```java title="Request"+HttpClient client = HttpClient.newHttpClient();+String json = "{\"public\": true, \"blockBots\": true, \"excludedCountries\": [\"CN\", \"RU\"]}";+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/sites/123/config"))+ .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"+using var client = new HttpClient();+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");++var content = new StringContent(+ "{\"public\": true, \"blockBots\": true, \"excludedCountries\": [\"CN\", \"RU\"]}",+ Encoding.UTF8,+ "application/json"+);++var response = await client.PutAsync("https://app.rybbit.io/api/sites/123/config", content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true,+ "message": "Site configuration updated successfully",+ "config": {+ "public": true,+ "saltUserIds": false,+ "blockBots": true,+ "excludedIPs": [],+ "excludedCountries": ["CN", "RU"],+ "sessionReplay": true,+ "webVitals": true,+ "trackErrors": true,+ "trackOutbound": true,+ "trackUrlParams": false+ }+}+```++</div>+</div>diff --git a/docs/content/docs/api/sites/update-private-link.mdx b/docs/content/docs/api/sites/update-private-link.mdxnew file mode 100644index 000000000..cdc49fc04--- /dev/null+++ b/docs/content/docs/api/sites/update-private-link.mdx@@ -0,0 +1,225 @@+---+title: Update Private Link Config+description: Generates or revokes a private link key for sharing analytics without authentication. Requires admin or 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/sites/:siteId/private-link-config+```++Generates or revokes a private link key for sharing analytics without authentication. Requires admin or owner role.++### Path Parameters++<TypeTable+ type={{+ siteId: {+ description: 'Site ID',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Request Body++<TypeTable+ type={{+ action: {+ description: 'Action to perform',+ type: 'string',+ typeDescription: '"generate_private_link_key" | "revoke_private_link_key"',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ success: {+ description: 'Whether the request was successful',+ type: 'boolean',+ },+ data: {+ description: 'Updated private link configuration',+ type: 'object',+ },+ }}+/>++#### Data Object++<TypeTable+ type={{+ privateLinkKey: {+ description: 'New private link key (for generate), or null (for revoke)',+ type: 'string | null',+ },+ }}+/>++</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/private-link-config" \+ -H "Authorization: Bearer your_api_key_here" \+ -H "Content-Type: application/json" \+ -d '{"action": "generate_private_link_key"}'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const response = await fetch(+ 'https://app.rybbit.io/api/sites/123/private-link-config',+ {+ method: 'POST',+ headers: {+ 'Authorization': 'Bearer your_api_key_here',+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ action: 'generate_private_link_key'+ })+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++response = requests.post(+ 'https://app.rybbit.io/api/sites/123/private-link-config',+ json={+ 'action': 'generate_private_link_key'+ },+ 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/private-link-config');+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);+curl_setopt($ch, CURLOPT_POST, true);+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([+ 'action' => 'generate_private_link_key'+]));+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/private-link-config')+req = Net::HTTP::Post.new(uri)+req['Authorization'] = 'Bearer your_api_key_here'+req['Content-Type'] = 'application/json'+req.body = { action: 'generate_private_link_key' }.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(`{"action": "generate_private_link_key"}`))+req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/sites/123/private-link-config", 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 client = reqwest::Client::new();+let res = client+ .post("https://app.rybbit.io/api/sites/123/private-link-config")+ .header("Authorization", "Bearer your_api_key_here")+ .json(&serde_json::json!({+ "action": "generate_private_link_key"+ }))+ .send()+ .await?;++let data: serde_json::Value = res.json().await?;+```+ </Tab>+ <Tab value="Java">+```java title="Request"+HttpClient client = HttpClient.newHttpClient();+String json = "{\"action\": \"generate_private_link_key\"}";+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/sites/123/private-link-config"))+ .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"+using var client = new HttpClient();+client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");++var content = new StringContent(+ "{\"action\": \"generate_private_link_key\"}",+ Encoding.UTF8,+ "application/json"+);++var response = await client.PostAsync("https://app.rybbit.io/api/sites/123/private-link-config", content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true,+ "data": {+ "privateLinkKey": "f6e5d4c3b2a1"+ }+}+```++</div>+</div>diff --git a/docs/content/docs/api/stats/errors.mdx b/docs/content/docs/api/stats/errors.mdxdeleted file mode 100644index 0ff7ea533..000000000--- a/docs/content/docs/api/stats/errors.mdx+++ /dev/null@@ -1,755 +0,0 @@-----title: Errors-description: Track and analyze JavaScript errors captured from your site-full: true------import { TypeTable } from 'fumadocs-ui/components/type-table';-import { Tab, Tabs } from 'fumadocs-ui/components/tabs';--See the [API Reference](/docs/api/stats/reference) for authentication, common parameters, and filters.--## Endpoints--<div className="flex flex-col gap-2 my-6">- <a href="#get-error-names" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/error-names</code>- </a>- <a href="#get-error-events" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/error-events</code>- </a>- <a href="#get-error-time-series" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/error-bucketed</code>- </a>-</div>-------## Get Error Names--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/error-names-```--Returns a list of unique error messages with occurrence counts and affected session counts.--### 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) plus the following:--<TypeTable- type={{- page: {- description: 'Page number (1-indexed). Enables paginated response format.',- type: 'number',- required: false,- },- limit: {- description: 'Number of results per page',- type: 'number',- default: 10,- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of error objects (or paginated wrapper)',- type: 'Error[] | PaginatedResponse',- },- }}-/>--#### Error Object--<TypeTable- type={{- value: {- description: 'Error message',- type: 'string',- },- errorName: {- description: 'Error type (TypeError, ReferenceError, etc.)',- type: 'string',- },- count: {- description: 'Total occurrences',- type: 'number',- },- sessionCount: {- description: 'Unique sessions affected',- type: 'number',- },- percentage: {- description: 'Percentage of total error 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/1/error-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',- {- 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/1/error-names23',- params={- '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/1/error-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'-]);--$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/1/error-names?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/1/error-names?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/1/error-names?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/1/error-names?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/1/error-names?start_date=2024-01-01&end_date=2024-01-31");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "value": "Cannot read property 'map' of undefined",- "errorName": "TypeError",- "count": 156,- "sessionCount": 89,- "percentage": 34.5- },- {- "value": "NetworkError when attempting to fetch resource",- "errorName": "TypeError",- "count": 98,- "sessionCount": 72,- "percentage": 27.9- },- {- "value": "foo is not defined",- "errorName": "ReferenceError",- "count": 45,- "sessionCount": 38,- "percentage": 14.7- }- ]-}-```--</div>-</div>-------## Get Error Events--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/error-events-```--Returns individual error occurrences for a specific error message, with full context including stack traces.--### 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) plus the following:--<TypeTable- type={{- errorMessage: {- description: 'The error message to filter by',- type: 'string',- required: true,- },- page: {- description: 'Page number (1-indexed)',- type: 'number',- required: false,- },- limit: {- description: 'Number of results per page',- type: 'number',- default: 20,- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of error event objects',- type: 'ErrorEvent[]',- },- }}-/>--#### ErrorEvent Object--<TypeTable- type={{- timestamp: {- description: 'When the error occurred',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- session_id: {- description: 'Session identifier',- type: 'string',- },- user_id: {- description: 'User identifier',- type: 'string | null',- },- pathname: {- description: 'Page where error occurred',- type: 'string',- },- hostname: {- description: 'Hostname',- type: 'string',- },- browser: {- description: 'Browser name',- type: 'string',- },- browser_version: {- description: 'Browser version',- type: 'string',- },- operating_system: {- description: 'Operating system',- type: 'string',- },- device_type: {- description: 'Device type',- type: 'string',- },- country: {- description: 'Country code',- type: 'string',- },- message: {- description: 'Error message',- type: 'string',- },- stack: {- description: 'Stack trace',- type: 'string | null',- },- fileName: {- description: 'Source file name',- type: 'string | null',- },- lineNumber: {- description: 'Line number in source',- type: 'number | null',- },- columnNumber: {- description: 'Column number in source',- type: 'number | null',- },- }}-/>--</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/1/error-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`,- {- 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/1/error-events',- params={- 'errorMessage': "Cannot read property 'map' of undefined",- '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/1/error-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'-]);--$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/1/error-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'--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/1/error-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{}-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/1/error-events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&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/1/error-events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&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/1/error-events?errorMessage=Cannot%20read%20property%20%27map%27%20of%20undefined&limit=10");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "timestamp": "2024-01-31T14:22:00.000Z",- "session_id": "sess_abc123",- "user_id": "user_xyz789",- "pathname": "/dashboard",- "hostname": "app.example.com",- "browser": "Chrome",- "browser_version": "120.0.0",- "operating_system": "macOS",- "device_type": "desktop",- "country": "US",- "message": "Cannot read property 'map' of undefined",- "stack": "TypeError: Cannot read property 'map' of undefined\n at Dashboard (dashboard.js:42:15)\n at renderWithHooks (react-dom.js:1234:22)",- "fileName": "dashboard.js",- "lineNumber": 42,- "columnNumber": 15- }- ]-}-```--</div>-</div>-------## Get Error Time Series--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/error-bucketed-```--Returns error occurrence counts over time for a specific error message. Useful for tracking error trends and identifying when issues started.--### 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) plus the following:--<TypeTable- type={{- errorMessage: {- description: 'The error message to filter by',- type: 'string',- required: true,- },- bucket: {- description: 'Time bucket size for grouping data',- type: 'TimeBucket',- typeDescription: '"minute" | "five_minutes" | "hour" | "day" | "week" | "month"',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- success: {- description: 'Whether the request succeeded',- type: 'boolean',- },- data: {- description: 'Array of time-bucketed counts',- type: 'ErrorBucket[]',- },- }}-/>--#### ErrorBucket Object--<TypeTable- type={{- time: {- description: 'Start of the time bucket',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- error_count: {- description: 'Number of errors 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/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" \- -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`,- {- 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/1/error-bucketed',- params={- 'errorMessage': "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'- }-)--data = response.json()-```- </Tab>- <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_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/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')-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/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.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/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")- .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/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"))- .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/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 data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "success": true,- "data": [- {- "time": "2024-01-30T00:00:00.000Z",- "error_count": 5- },- {- "time": "2024-01-30T01:00:00.000Z",- "error_count": 3- },- {- "time": "2024-01-30T02:00:00.000Z",- "error_count": 8- },- {- "time": "2024-01-30T03:00:00.000Z",- "error_count": 2- }- ]-}-```--</div>-</div>diff --git a/docs/content/docs/api/stats/events.mdx b/docs/content/docs/api/stats/events.mdxdeleted file mode 100644index f98edb9ab..000000000--- a/docs/content/docs/api/stats/events.mdx+++ /dev/null@@ -1,1014 +0,0 @@-----title: Events-description: Retrieve event data including custom events, pageviews, and outbound links-full: true------import { TypeTable } from 'fumadocs-ui/components/type-table';-import { Tab, Tabs } from 'fumadocs-ui/components/tabs';--See the [API Reference](/docs/api/stats/reference) for authentication, common parameters, and filters.--## Endpoints--<div className="flex flex-col gap-2 my-6">- <a href="#get-events" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/events</code>- </a>- <a href="#get-event-names" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/events/names</code>- </a>- <a href="#get-event-properties" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/events/properties</code>- </a>- <a href="#get-outbound-links" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/events/outbound</code>- </a>-</div>-------## Get Events--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/events-```--Returns a paginated list of events (pageviews, custom events, and outbound clicks).--### 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) plus the following:--<TypeTable- type={{- page_size: {- description: 'Number of results per page',- type: 'number',- default: 50,- },- since_timestamp: {- description: 'Poll for new events after this timestamp (ISO 8601). Used for realtime polling. Returns up to 500 events.',- type: 'string',- },- before_timestamp: {- description: 'Fetch events before this timestamp (ISO 8601). Used for cursor-based pagination (scrolling back).',- type: 'string',- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of event objects',- type: 'Event[]',- },- cursor: {- description: 'Cursor metadata for pagination (only present when not using since_timestamp)',- type: '{ hasMore: boolean, oldestTimestamp: string | null }',- },- }}-/>--#### Event Object--<TypeTable- type={{- timestamp: {- description: 'Event timestamp',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- type: {- description: 'Event type',- type: 'string',- typeDescription: '"pageview" | "custom_event" | "outbound" | "button_click" | "copy" | "form_submit" | "input_change"',- },- event_name: {- description: 'Custom event name',- type: 'string',- },- properties: {- description: 'Event properties as JSON string',- type: 'string',- },- session_id: {- description: 'Session identifier',- type: 'string',- },- user_id: {- description: 'User identifier',- type: 'string',- },- identified_user_id: {- description: 'Identified user ID (if user has been identified)',- type: 'string',- },- pathname: {- description: 'Page path',- type: 'string',- },- querystring: {- description: 'URL query string',- type: 'string',- },- hostname: {- description: 'Hostname',- type: 'string',- },- page_title: {- description: 'Page title',- type: 'string',- },- referrer: {- description: 'Referrer URL',- 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',- },- language: {- description: 'Browser language',- type: 'string',- },- country: {- description: 'Country code',- type: 'string',- },- region: {- description: 'Region/state',- type: 'string',- },- city: {- description: 'City name',- type: 'string',- },- lat: {- description: 'Latitude',- type: 'number',- },- lon: {- description: 'Longitude',- type: 'number',- },- screen_width: {- description: 'Screen width in pixels',- type: 'number',- },- screen_height: {- description: 'Screen height in pixels',- type: 'number',- },- device_type: {- description: 'Device type',- 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/1/events?page_size=50&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/events?page_size=50&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/1/events',- params={- 'page_size': 50,- '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/1/events?page_size=50&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/1/events?page_size=50&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/1/events?page_size=50&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/1/events?page_size=50&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/1/events?page_size=50&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/1/events?page_size=50&start_date=2024-01-01&end_date=2024-01-31");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "timestamp": "2024-01-31T14:22:00.000Z",- "type": "custom_event",- "event_name": "signup",- "properties": "{\"plan\":\"pro\",\"source\":\"homepage\"}",- "session_id": "abc123def456",- "user_id": "user_abc123",- "identified_user_id": "",- "pathname": "/signup",- "querystring": "",- "hostname": "example.com",- "page_title": "Sign Up",- "referrer": "https://google.com",- "browser": "Chrome",- "browser_version": "120.0",- "operating_system": "macOS",- "operating_system_version": "14.0",- "language": "en-US",- "country": "US",- "region": "California",- "city": "San Francisco",- "lat": 37.7749,- "lon": -122.4194,- "screen_width": 1920,- "screen_height": 1080,- "device_type": "desktop"- },- {- "timestamp": "2024-01-31T14:21:00.000Z",- "type": "pageview",- "event_name": "",- "properties": "{}",- "session_id": "abc123def456",- "user_id": "user_abc123",- "identified_user_id": "",- "pathname": "/pricing",- "querystring": "",- "hostname": "example.com",- "page_title": "Pricing",- "referrer": "https://example.com/",- "browser": "Chrome",- "browser_version": "120.0",- "operating_system": "macOS",- "operating_system_version": "14.0",- "language": "en-US",- "country": "US",- "region": "California",- "city": "San Francisco",- "lat": 37.7749,- "lon": -122.4194,- "screen_width": 1920,- "screen_height": 1080,- "device_type": "desktop"- }- ],- "cursor": {- "hasMore": true,- "oldestTimestamp": "2024-01-31T14:21:00.000Z"- }-}-```--</div>-</div>-------## Get Event Names--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/events/names-```--Returns a list of unique custom event names with their occurrence counts.--### 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).--### Response--<TypeTable- type={{- data: {- description: 'Array of event name objects',- type: 'EventName[]',- },- }}-/>--#### EventName Object--<TypeTable- type={{- eventName: {- description: 'Name of the custom event',- type: 'string',- },- count: {- description: 'Number of occurrences',- 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/1/events/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/events/names?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/1/events/names',- params={- '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/1/events/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'-]);--$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/1/events/names?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/1/events/names?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/1/events/names?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/1/events/names?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/1/events/names?start_date=2024-01-01&end_date=2024-01-31");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "eventName": "signup",- "count": 1250- },- {- "eventName": "purchase",- "count": 320- },- {- "eventName": "add_to_cart",- "count": 890- },- {- "eventName": "newsletter_subscribe",- "count": 456- }- ]-}-```--</div>-</div>-------## Get Event Properties--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/events/properties-```--Returns property key-value pairs for a specific event name with their occurrence counts.--### 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) plus the following:--<TypeTable- type={{- event_name: {- description: 'Event name to get properties for',- type: 'string',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of property objects',- type: 'EventProperty[]',- },- }}-/>--#### EventProperty Object--<TypeTable- type={{- propertyKey: {- description: 'Property key name',- type: 'string',- },- propertyValue: {- description: 'Property value',- type: 'string',- },- count: {- description: 'Number of occurrences',- 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/1/events/properties?event_name=signup&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/events/properties?event_name=signup&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/1/events/properties',- params={- 'event_name': 'signup',- '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/1/events/properties?event_name=signup&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/1/events/properties?event_name=signup&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/1/events/properties?event_name=signup&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/1/events/properties?event_name=signup&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/1/events/properties?event_name=signup&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/1/events/properties?event_name=signup&start_date=2024-01-01&end_date=2024-01-31");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "propertyKey": "plan",- "propertyValue": "pro",- "count": 520- },- {- "propertyKey": "plan",- "propertyValue": "starter",- "count": 430- },- {- "propertyKey": "plan",- "propertyValue": "enterprise",- "count": 300- },- {- "propertyKey": "source",- "propertyValue": "homepage",- "count": 650- },- {- "propertyKey": "source",- "propertyValue": "pricing",- "count": 600- }- ]-}-```--</div>-</div>-------## Get Outbound Links--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/events/outbound-```--Returns a list of outbound link clicks with their occurrence counts.--### 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).--### Response--<TypeTable- type={{- data: {- description: 'Array of outbound link objects',- type: 'OutboundLink[]',- },- }}-/>--#### OutboundLink Object--<TypeTable- type={{- url: {- description: 'The outbound URL that was clicked',- type: 'string',- },- count: {- description: 'Number of clicks',- type: 'number',- },- lastClicked: {- description: 'Most recent click timestamp',- type: 'string',- 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/1/events/outbound?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/events/outbound?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/1/events/outbound',- params={- '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/1/events/outbound?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/1/events/outbound?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/1/events/outbound?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/1/events/outbound?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/1/events/outbound?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/1/events/outbound?start_date=2024-01-01&end_date=2024-01-31");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "url": "https://github.com/example/repo",- "count": 245,- "lastClicked": "2024-01-31T14:22:00.000Z"- },- {- "url": "https://twitter.com/example",- "count": 189,- "lastClicked": "2024-01-31T12:15:00.000Z"- },- {- "url": "https://docs.example.com",- "count": 156,- "lastClicked": "2024-01-31T10:30:00.000Z"- }- ]-}-```--</div>-</div>diff --git a/docs/content/docs/api/stats/funnels.mdx b/docs/content/docs/api/stats/funnels.mdxdeleted file mode 100644index 4e9104e72..000000000--- a/docs/content/docs/api/stats/funnels.mdx+++ /dev/null@@ -1,1459 +0,0 @@-----title: Funnels-description: Create and analyze multi-step conversion funnels-full: true------import { TypeTable } from 'fumadocs-ui/components/type-table';-import { Tab, Tabs } from 'fumadocs-ui/components/tabs';--See the [API Reference](/docs/api/stats/reference) for authentication, common parameters, and filters.--## Endpoints--<div className="flex flex-col gap-2 my-6">- <a href="#get-funnels" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/funnels</code>- </a>- <a href="#analyze-funnel" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-blue-500/20 text-blue-600 dark:text-blue-400">POST</span>- <code className="text-sm">/api/sites/:site/funnels/analyze</code>- </a>- <a href="#get-funnel-step-sessions" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-blue-500/20 text-blue-600 dark:text-blue-400">POST</span>- <code className="text-sm">/api/sites/:site/funnels/:stepNumber/sessions</code>- </a>- <a href="#create-funnel" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-blue-500/20 text-blue-600 dark:text-blue-400">POST</span>- <code className="text-sm">/api/sites/:site/funnels</code>- </a>- <a href="#delete-funnel" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-red-500/20 text-red-600 dark:text-red-400">DELETE</span>- <code className="text-sm">/api/sites/:site/funnels/:funnelId</code>- </a>-</div>-------## Get Funnels--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/funnels-```--Returns all saved funnels for a site.--### Path Parameters--<TypeTable- type={{- site: {- description: 'Site ID or site identifier',- type: 'string | number',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of saved funnels',- type: 'Funnel[]',- },- }}-/>--#### Funnel Object--<TypeTable- type={{- id: {- description: 'Unique funnel identifier',- type: 'number',- },- name: {- description: 'Funnel name',- type: 'string',- },- steps: {- description: 'Array of funnel steps',- type: 'FunnelStep[]',- },- createdAt: {- description: 'Creation timestamp',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- updatedAt: {- description: 'Last update timestamp',- type: 'string',- 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/1/funnels23" \- -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/funnels23',- {- 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/1/funnels23',- 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/1/funnels23');-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/1/funnels23')-request = Net::HTTP::Get.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"-package main--import (- "encoding/json"- "io"- "net/http"-)--func main() {- client := &http.Client{}- req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/1/funnels23", nil)- req.Header.Set("Authorization", "Bearer your_api_key_here")-- 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/1/funnels23")- .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;--HttpClient client = HttpClient.newHttpClient();-HttpRequest request = HttpRequest.newBuilder()- .uri(URI.create("https://app.rybbit.io/api/sites/1/funnels23"))- .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.Net.Http;-using System.Net.Http.Headers;--var client = new HttpClient();-client.DefaultRequestHeaders.Authorization =- new AuthenticationHeaderValue("Bearer", "your_api_key_here");--var response = await client.GetAsync(- "https://app.rybbit.io/api/sites/1/funnels23");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "id": 1,- "name": "Signup Funnel",- "steps": [- { "type": "page", "value": "/", "name": "Homepage" },- { "type": "page", "value": "/pricing", "name": "Pricing" },- { "type": "page", "value": "/signup", "name": "Signup" },- { "type": "page", "value": "/signup/complete", "name": "Complete" }- ],- "createdAt": "2024-01-10T12:00:00.000Z",- "updatedAt": "2024-01-15T09:30:00.000Z"- }- ]-}-```--</div>-</div>-------## Analyze Funnel--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-POST /api/sites/:site/funnels/analyze-```--Analyzes a funnel and returns step-by-step conversion data. Sessions must complete steps in order (step 2 must occur after step 1, etc.).--### 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).--### Request Body--<TypeTable- type={{- steps: {- description: 'Array of funnel steps (minimum 2)',- type: 'FunnelStep[]',- required: true,- },- }}-/>--#### FunnelStep Object--<TypeTable- type={{- type: {- description: 'Step type',- type: 'string',- typeDescription: '"page" | "event"',- required: true,- },- value: {- description: 'Page path pattern or event name',- type: 'string',- required: true,- },- name: {- description: 'Display name for the step',- type: 'string',- required: false,- },- hostname: {- description: 'Filter by specific hostname',- type: 'string',- required: false,- },- eventPropertyKey: {- description: 'Event property key to match (for event steps)',- type: 'string',- required: false,- },- eventPropertyValue: {- description: 'Event property value to match',- type: 'string | number | boolean',- required: false,- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of step results',- type: 'FunnelStepResult[]',- },- }}-/>--#### FunnelStepResult Object--<TypeTable- type={{- step_number: {- description: 'Step number (1-indexed)',- type: 'number',- },- step_name: {- description: 'Step name',- type: 'string',- },- visitors: {- description: 'Number of sessions that reached this step',- type: 'number',- },- conversion_rate: {- description: 'Percentage of step 1 visitors who reached this step',- type: 'number',- typeDescription: 'Range: 0-100',- },- dropoff_rate: {- description: 'Percentage who dropped off from the previous step',- 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 POST "https://app.rybbit.io/api/sites/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31" \- -H "Authorization: Bearer your_api_key_here" \- -H "Content-Type: application/json" \- -d '{- "steps": [- { "type": "page", "value": "/", "name": "Homepage" },- { "type": "page", "value": "/pricing", "name": "Pricing" },- { "type": "page", "value": "/signup", "name": "Signup" },- { "type": "event", "value": "signup_complete", "name": "Complete" }- ]- }'-```- </Tab>- <Tab value="JavaScript">-```javascript title="Request"-const response = await fetch(- 'https://app.rybbit.io/api/sites/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31',- {- method: 'POST',- headers: {- 'Authorization': 'Bearer your_api_key_here',- 'Content-Type': 'application/json'- },- body: JSON.stringify({- steps: [- { type: 'page', value: '/', name: 'Homepage' },- { type: 'page', value: '/pricing', name: 'Pricing' },- { type: 'page', value: '/signup', name: 'Signup' },- { type: 'event', value: 'signup_complete', name: 'Complete' }- ]- })- }-);--const data = await response.json();-```- </Tab>- <Tab value="Python">-```python title="Request"-import requests--response = requests.post(- 'https://app.rybbit.io/api/sites/1/funnels/analyze',- params={- 'start_date': '2024-01-01',- 'end_date': '2024-01-31'- },- json={- 'steps': [- { 'type': 'page', 'value': '/', 'name': 'Homepage' },- { 'type': 'page', 'value': '/pricing', 'name': 'Pricing' },- { 'type': 'page', 'value': '/signup', 'name': 'Signup' },- { 'type': 'event', 'value': 'signup_complete', 'name': 'Complete' }- ]- },- headers={- 'Authorization': 'Bearer your_api_key_here'- }-)--data = response.json()-```- </Tab>- <Tab value="PHP">-```php title="Request"-$body = [- 'steps' => [- ['type' => 'page', 'value' => '/', 'name' => 'Homepage'],- ['type' => 'page', 'value' => '/pricing', 'name' => 'Pricing'],- ['type' => 'page', 'value' => '/signup', 'name' => 'Signup'],- ['type' => 'event', 'value' => 'signup_complete', 'name' => 'Complete']- ]-];--$ch = curl_init();-curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31');-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/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31')-request = Net::HTTP::Post.new(uri)-request['Authorization'] = 'Bearer your_api_key_here'-request['Content-Type'] = 'application/json'-request.body = {- steps: [- { type: 'page', value: '/', name: 'Homepage' },- { type: 'page', value: '/pricing', name: 'Pricing' },- { type: 'page', value: '/signup', name: 'Signup' },- { type: 'event', value: 'signup_complete', name: 'Complete' }- ]-}.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"-package main--import (- "bytes"- "encoding/json"- "io"- "net/http"-)--func main() {- body := map[string]interface{}{- "steps": []map[string]string{- {"type": "page", "value": "/", "name": "Homepage"},- {"type": "page", "value": "/pricing", "name": "Pricing"},- {"type": "page", "value": "/signup", "name": "Signup"},- {"type": "event", "value": "signup_complete", "name": "Complete"},- },- }- jsonBody, _ := json.Marshal(body)-- client := &http.Client{}- req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/sites/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31", bytes.NewBuffer(jsonBody))- req.Header.Set("Authorization", "Bearer your_api_key_here")- req.Header.Set("Content-Type", "application/json")-- resp, _ := client.Do(req)- defer resp.Body.Close()-- respBody, _ := io.ReadAll(resp.Body)- var data map[string]interface{}- json.Unmarshal(respBody, &data)-}-```- </Tab>- <Tab value="Rust">-```rust title="Request"-use reqwest;-use serde_json::{json, Value};--#[tokio::main]-async fn main() -> Result<(), Box<dyn std::error::Error>> {- let body = json!({- "steps": [- {"type": "page", "value": "/", "name": "Homepage"},- {"type": "page", "value": "/pricing", "name": "Pricing"},- {"type": "page", "value": "/signup", "name": "Signup"},- {"type": "event", "value": "signup_complete", "name": "Complete"}- ]- });-- let client = reqwest::Client::new();- let response = client- .post("https://app.rybbit.io/api/sites/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31")- .header("Authorization", "Bearer your_api_key_here")- .header("Content-Type", "application/json")- .json(&body)- .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;--String json = """-{- "steps": [- {"type": "page", "value": "/", "name": "Homepage"},- {"type": "page", "value": "/pricing", "name": "Pricing"},- {"type": "page", "value": "/signup", "name": "Signup"},- {"type": "event", "value": "signup_complete", "name": "Complete"}- ]-}-""";--HttpClient client = HttpClient.newHttpClient();-HttpRequest request = HttpRequest.newBuilder()- .uri(URI.create("https://app.rybbit.io/api/sites/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31"))- .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());-String data = response.body();-```- </Tab>- <Tab value=".NET">-```csharp title="Request"-using System.Net.Http;-using System.Net.Http.Headers;-using System.Text;-using System.Text.Json;--var body = new-{- steps = new[]- {- new { type = "page", value = "/", name = "Homepage" },- new { type = "page", value = "/pricing", name = "Pricing" },- new { type = "page", value = "/signup", name = "Signup" },- new { type = "event", value = "signup_complete", name = "Complete" }- }-};--var client = new HttpClient();-client.DefaultRequestHeaders.Authorization =- new AuthenticationHeaderValue("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/1/funnels/analyze?start_date=2024-01-01&end_date=2024-01-31",- content);-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "step_number": 1,- "step_name": "Homepage",- "visitors": 10000,- "conversion_rate": 100,- "dropoff_rate": 0- },- {- "step_number": 2,- "step_name": "Pricing",- "visitors": 4500,- "conversion_rate": 45,- "dropoff_rate": 55- },- {- "step_number": 3,- "step_name": "Signup",- "visitors": 1800,- "conversion_rate": 18,- "dropoff_rate": 60- },- {- "step_number": 4,- "step_name": "Complete",- "visitors": 720,- "conversion_rate": 7.2,- "dropoff_rate": 60- }- ]-}-```--</div>-</div>-------## Get Funnel Step Sessions--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-POST /api/sites/:site/funnels/:stepNumber/sessions-```--Returns sessions that either reached or dropped off at a specific funnel step. Useful for analyzing user behavior at each stage.--### Path Parameters--<TypeTable- type={{- stepNumber: {- description: 'Step number (1-indexed)',- type: 'string | number',- required: true,- },- site: {- description: 'Site ID or site identifier',- type: 'string | number',- required: true,- },- }}-/>--### Query Parameters--Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) plus the following:--<TypeTable- type={{- mode: {- description: 'Whether to get sessions that reached or dropped off at this step',- type: 'string',- typeDescription: '"reached" | "dropped"',- required: true,- },- page: {- description: 'Page number (1-indexed)',- type: 'number',- default: 1,- },- limit: {- description: 'Number of results per page',- type: 'number',- default: 25,- },- }}-/>--### Request Body--<TypeTable- type={{- steps: {- description: 'Array of funnel steps (same as used in analyze)',- type: 'FunnelStep[]',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of session objects',- type: 'Session[]',- },- }}-/>--</div>-<div className="flex flex-col gap-4">--<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>- <Tab value="cURL">-```bash title="Get sessions that dropped off at step 2"-curl -X POST "https://app.rybbit.io/api/sites/1/funnels/2/sessions?mode=dropped&page=1" \- -H "Authorization: Bearer your_api_key_here" \- -H "Content-Type: application/json" \- -d '{- "steps": [- { "type": "page", "value": "/", "name": "Homepage" },- { "type": "page", "value": "/pricing", "name": "Pricing" },- { "type": "page", "value": "/signup", "name": "Signup" }- ]- }'-```- </Tab>- <Tab value="JavaScript">-```javascript title="Get sessions that reached step 3"-const response = await fetch(- 'https://app.rybbit.io/api/sites/1/funnels/3/sessions?mode=reached&page=1',- {- method: 'POST',- headers: {- 'Authorization': 'Bearer your_api_key_here',- 'Content-Type': 'application/json'- },- body: JSON.stringify({- steps: [- { type: 'page', value: '/', name: 'Homepage' },- { type: 'page', value: '/pricing', name: 'Pricing' },- { type: 'page', value: '/signup', name: 'Signup' }- ]- })- }-);--const data = await response.json();-```- </Tab>- <Tab value="Python">-```python title="Request"-import requests--response = requests.post(- 'https://app.rybbit.io/api/sites/1/funnels/2/sessions23',- params={- 'mode': 'dropped',- 'page': 1- },- json={- 'steps': [- { 'type': 'page', 'value': '/', 'name': 'Homepage' },- { 'type': 'page', 'value': '/pricing', 'name': 'Pricing' },- { 'type': 'page', 'value': '/signup', 'name': 'Signup' }- ]- },- headers={- 'Authorization': 'Bearer your_api_key_here'- }-)--data = response.json()-```- </Tab>- <Tab value="PHP">-```php title="Request"-$body = [- 'steps' => [- ['type' => 'page', 'value' => '/', 'name' => 'Homepage'],- ['type' => 'page', 'value' => '/pricing', 'name' => 'Pricing'],- ['type' => 'page', 'value' => '/signup', 'name' => 'Signup']- ]-];--$ch = curl_init();-curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/funnels/2/sessions?mode=dropped&page=1');-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/1/funnels/2/sessions?mode=dropped&page=1')-request = Net::HTTP::Post.new(uri)-request['Authorization'] = 'Bearer your_api_key_here'-request['Content-Type'] = 'application/json'-request.body = {- steps: [- { type: 'page', value: '/', name: 'Homepage' },- { type: 'page', value: '/pricing', name: 'Pricing' },- { type: 'page', value: '/signup', name: 'Signup' }- ]-}.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{}{- "steps": []map[string]string{- {"type": "page", "value": "/", "name": "Homepage"},- {"type": "page", "value": "/pricing", "name": "Pricing"},- {"type": "page", "value": "/signup", "name": "Signup"},- },-}-jsonBody, _ := json.Marshal(body)--req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/sites/1/funnels/2/sessions?mode=dropped&page=1", 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!({- "steps": [- {"type": "page", "value": "/", "name": "Homepage"},- {"type": "page", "value": "/pricing", "name": "Pricing"},- {"type": "page", "value": "/signup", "name": "Signup"}- ]-});--let client = reqwest::Client::new();-let res = client- .post("https://app.rybbit.io/api/sites/1/funnels/2/sessions?mode=dropped&page=1")- .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 = """-{- "steps": [- {"type": "page", "value": "/", "name": "Homepage"},- {"type": "page", "value": "/pricing", "name": "Pricing"},- {"type": "page", "value": "/signup", "name": "Signup"}- ]-}-""";--HttpClient client = HttpClient.newHttpClient();-HttpRequest request = HttpRequest.newBuilder()- .uri(URI.create("https://app.rybbit.io/api/sites/1/funnels/2/sessions?mode=dropped&page=1"))- .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-{- steps = new[]- {- new { type = "page", value = "/", name = "Homepage" },- new { type = "page", value = "/pricing", name = "Pricing" },- new { type = "page", value = "/signup", name = "Signup" }- }-};--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/1/funnels/2/sessions?mode=dropped&page=1",- content);-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "session_id": "sess_abc123",- "user_id": "user_xyz789",- "country": "US",- "browser": "Chrome",- "operating_system": "macOS",- "device_type": "desktop",- "entry_page": "/",- "exit_page": "/pricing",- "pageviews": 3,- "session_duration": 125,- "session_start": "2024-01-31T14:00:00.000Z",- "session_end": "2024-01-31T14:02:05.000Z",- "referrer": "https://google.com",- "channel": "organic"- }- ]-}-```--</div>-</div>-------## Create Funnel--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-POST /api/sites/:site/funnels-```--Creates or updates a saved funnel. If `reportId` is provided, updates the existing funnel.--### Path Parameters--<TypeTable- type={{- site: {- description: 'Site ID or site identifier',- type: 'string | number',- required: true,- },- }}-/>--### Request Body--<TypeTable- type={{- name: {- description: 'Funnel name',- type: 'string',- required: true,- },- steps: {- description: 'Array of funnel steps (minimum 2)',- type: 'FunnelStep[]',- required: true,- },- reportId: {- description: 'Existing funnel ID to update (optional)',- type: 'number',- required: false,- },- }}-/>--### Response--<TypeTable- type={{- success: {- description: 'Whether the funnel was created/updated',- type: 'boolean',- },- funnelId: {- description: 'ID of the created/updated funnel',- 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="Create New Funnel"-curl -X POST "https://app.rybbit.io/api/sites/1/funnels23" \- -H "Authorization: Bearer your_api_key_here" \- -H "Content-Type: application/json" \- -d '{- "name": "Checkout Funnel",- "steps": [- { "type": "page", "value": "/products/*", "name": "Product Page" },- { "type": "page", "value": "/cart", "name": "Cart" },- { "type": "page", "value": "/checkout", "name": "Checkout" },- { "type": "event", "value": "purchase", "name": "Purchase" }- ]- }'-```- </Tab>- <Tab value="JavaScript">-```javascript title="Update Existing Funnel"-const response = await fetch(- 'https://app.rybbit.io/api/sites/1/funnels23',- {- method: 'POST',- headers: {- 'Authorization': 'Bearer your_api_key_here',- 'Content-Type': 'application/json'- },- body: JSON.stringify({- reportId: 1, // Update existing funnel- name: 'Checkout Funnel (Updated)',- steps: [- { type: 'page', value: '/products/*', name: 'Product Page' },- { type: 'page', value: '/cart', name: 'Cart' },- { type: 'page', value: '/checkout', name: 'Checkout' },- { type: 'page', value: '/checkout/success', name: 'Success' }- ]- })- }-);--const data = await response.json();-```- </Tab>- <Tab value="Python">-```python title="Request"-import requests--response = requests.post(- 'https://app.rybbit.io/api/sites/1/funnels23',- json={- 'name': 'Onboarding Funnel',- 'steps': [- { 'type': 'page', 'value': '/signup', 'name': 'Signup' },- { 'type': 'event', 'value': 'account_created', 'name': 'Account Created' },- { 'type': 'page', 'value': '/onboarding/*', 'name': 'Onboarding' },- { 'type': 'event', 'value': 'onboarding_complete', 'name': 'Complete' }- ]- },- headers={- 'Authorization': 'Bearer your_api_key_here'- }-)--data = response.json()-```- </Tab>- <Tab value="PHP">-```php title="Request"-$body = [- 'name' => 'Checkout Funnel',- 'steps' => [- ['type' => 'page', 'value' => '/products/*', 'name' => 'Product Page'],- ['type' => 'page', 'value' => '/cart', 'name' => 'Cart'],- ['type' => 'page', 'value' => '/checkout', 'name' => 'Checkout'],- ['type' => 'event', 'value' => 'purchase', 'name' => 'Purchase']- ]-];--$ch = curl_init();-curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/funnels23');-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/1/funnels23')-request = Net::HTTP::Post.new(uri)-request['Authorization'] = 'Bearer your_api_key_here'-request['Content-Type'] = 'application/json'-request.body = {- name: 'Checkout Funnel',- steps: [- { type: 'page', value: '/products/*', name: 'Product Page' },- { type: 'page', value: '/cart', name: 'Cart' },- { type: 'page', value: '/checkout', name: 'Checkout' },- { type: 'event', value: 'purchase', name: 'Purchase' }- ]-}.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": "Checkout Funnel",- "steps": []map[string]string{- {"type": "page", "value": "/products/*", "name": "Product Page"},- {"type": "page", "value": "/cart", "name": "Cart"},- {"type": "page", "value": "/checkout", "name": "Checkout"},- {"type": "event", "value": "purchase", "name": "Purchase"},- },-}-jsonBody, _ := json.Marshal(body)--req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/sites/1/funnels23", 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": "Checkout Funnel",- "steps": [- {"type": "page", "value": "/products/*", "name": "Product Page"},- {"type": "page", "value": "/cart", "name": "Cart"},- {"type": "page", "value": "/checkout", "name": "Checkout"},- {"type": "event", "value": "purchase", "name": "Purchase"}- ]-});--let client = reqwest::Client::new();-let res = client- .post("https://app.rybbit.io/api/sites/1/funnels23")- .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": "Checkout Funnel",- "steps": [- {"type": "page", "value": "/products/*", "name": "Product Page"},- {"type": "page", "value": "/cart", "name": "Cart"},- {"type": "page", "value": "/checkout", "name": "Checkout"},- {"type": "event", "value": "purchase", "name": "Purchase"}- ]-}-""";--HttpClient client = HttpClient.newHttpClient();-HttpRequest request = HttpRequest.newBuilder()- .uri(URI.create("https://app.rybbit.io/api/sites/1/funnels23"))- .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-{- name = "Checkout Funnel",- steps = new[]- {- new { type = "page", value = "/products/*", name = "Product Page" },- new { type = "page", value = "/cart", name = "Cart" },- new { type = "page", value = "/checkout", name = "Checkout" },- new { type = "event", value = "purchase", name = "Purchase" }- }-};--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/1/funnels23", content);-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "success": true,- "funnelId": 2-}-```--</div>-</div>-------## Delete Funnel--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-DELETE /api/sites/:site/funnels/:funnelId-```--Deletes a saved funnel. This action cannot be undone.--### Path Parameters--<TypeTable- type={{- funnelId: {- description: 'ID of the funnel to delete',- type: 'string | number',- required: true,- },- site: {- description: 'Site ID or site identifier',- type: 'string | number',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- success: {- description: 'Whether the funnel 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/sites/1/funnels/123" \- -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/funnels/123',- {- 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/1/funnels/123',- 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/1/funnels/123');-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/1/funnels/123')-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/sites/1/funnels/123", 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/1/funnels/123")- .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/1/funnels/123"))- .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/1/funnels/123");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "success": true-}-```--</div>-</div>diff --git a/docs/content/docs/api/stats/goals.mdx b/docs/content/docs/api/stats/goals.mdxdeleted file mode 100644index 1d3c82832..000000000--- a/docs/content/docs/api/stats/goals.mdx+++ /dev/null@@ -1,1464 +0,0 @@-----title: Goals-description: Create and track conversion goals based on page visits or custom events-full: true------import { TypeTable } from 'fumadocs-ui/components/type-table';-import { Tab, Tabs } from 'fumadocs-ui/components/tabs';--See the [API Reference](/docs/api/stats/reference) for authentication, common parameters, and filters.--## Endpoints--<div className="flex flex-col gap-2 my-6">- <a href="#get-goals" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/goals</code>- </a>- <a href="#get-goal-sessions" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/goals/:goalId/sessions</code>- </a>- <a href="#create-goal" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-blue-500/20 text-blue-600 dark:text-blue-400">POST</span>- <code className="text-sm">/api/sites/:site/goals</code>- </a>- <a href="#update-goal" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-yellow-500/20 text-yellow-600 dark:text-yellow-400">PUT</span>- <code className="text-sm">/api/sites/:site/goals/:goalId</code>- </a>- <a href="#delete-goal" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-red-500/20 text-red-600 dark:text-red-400">DELETE</span>- <code className="text-sm">/api/sites/:site/goals/:goalId</code>- </a>-</div>-------## Get Goals--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/goals-```--Returns a paginated list of goals with their conversion metrics.--### 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) plus the following:--<TypeTable- type={{- page: {- description: 'Page number (1-indexed)',- type: 'number',- default: 1,- },- page_size: {- description: 'Number of results per page (max 100)',- type: 'number',- default: 10,- },- sort: {- description: 'Field to sort by',- type: 'string',- typeDescription: '"goalId" | "name" | "goalType" | "createdAt"',- default: 'createdAt',- },- order: {- description: 'Sort direction',- type: 'string',- typeDescription: '"asc" | "desc"',- default: 'desc',- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of goal objects with conversion data',- type: 'Goal[]',- },- meta: {- description: 'Pagination metadata',- type: 'PaginationMeta',- },- }}-/>--#### Goal Object--<TypeTable- type={{- goalId: {- description: 'Unique goal identifier',- type: 'number',- },- name: {- description: 'Goal name',- type: 'string | null',- },- goalType: {- description: 'Type of goal',- type: 'string',- typeDescription: '"path" | "event"',- },- config: {- description: 'Goal configuration',- type: 'GoalConfig',- },- createdAt: {- description: 'Creation timestamp',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- total_conversions: {- description: 'Number of sessions that completed the goal',- type: 'number',- },- total_sessions: {- description: 'Total sessions in the time period',- type: 'number',- },- conversion_rate: {- description: 'Conversion rate (0-1)',- type: 'number',- },- }}-/>--#### GoalConfig Object--<TypeTable- type={{- pathPattern: {- description: 'URL path pattern (for path goals). Supports wildcards (*)',- type: 'string',- required: false,- },- eventName: {- description: 'Event name to match (for event goals)',- type: 'string',- required: false,- },- eventPropertyKey: {- description: 'Event property key to match',- type: 'string',- required: false,- },- eventPropertyValue: {- description: 'Event property value to match',- type: 'string | number | boolean',- required: false,- },- }}-/>--</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/1/goals?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/goals?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/1/goals23',- params={- '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"-<?php-$ch = curl_init();--curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/goals?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'-require 'uri'--uri = URI('https://app.rybbit.io/api/sites/1/goals?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) 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/1/goals?start_date=2024-01-01&end_date=2024-01-31"-- 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/1/goals?start_date=2024-01-01&end_date=2024-01-31")- .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/1/goals?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());-- 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/1/goals?start_date=2024-01-01&end_date=2024-01-31");-- var data = await response.Content.ReadAsStringAsync();- }-}-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "goalId": 1,- "name": "Signup Completed",- "goalType": "path",- "config": {- "pathPattern": "/signup/complete"- },- "createdAt": "2024-01-10T12:00:00.000Z",- "total_conversions": 1250,- "total_sessions": 15420,- "conversion_rate": 0.081- },- {- "goalId": 2,- "name": "Purchase Made",- "goalType": "event",- "config": {- "eventName": "purchase",- "eventPropertyKey": "value",- "eventPropertyValue": 100- },- "createdAt": "2024-01-15T09:30:00.000Z",- "total_conversions": 320,- "total_sessions": 15420,- "conversion_rate": 0.021- }- ],- "meta": {- "total": 2,- "page": 1,- "pageSize": 10,- "totalPages": 1- }-}-```--</div>-</div>-------## Get Goal Sessions--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/goals/:goalId/sessions-```--Returns sessions that completed a specific goal. Useful for analyzing the behavior of converting users.--### Path Parameters--<TypeTable- type={{- goalId: {- description: 'Goal ID',- type: 'string | number',- required: true,- },- site: {- description: 'Site ID or site identifier',- type: 'string | number',- required: true,- },- }}-/>--### Query Parameters--Accepts all [Common Parameters](/docs/api/getting-started#common-parameters) plus the following:--<TypeTable- type={{- page: {- description: 'Page number (1-indexed)',- type: 'number',- default: 1,- },- limit: {- description: 'Number of results per page',- type: 'number',- default: 25,- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of session objects',- type: 'Session[]',- },- }}-/>--#### Session Object--<TypeTable- type={{- session_id: {- description: 'Unique session identifier',- type: 'string',- },- user_id: {- description: 'User identifier',- type: 'string',- },- country: {- description: 'Country code',- type: 'string',- },- browser: {- description: 'Browser name',- type: 'string',- },- operating_system: {- description: 'Operating system',- type: 'string',- },- device_type: {- description: 'Device type',- type: 'string',- },- entry_page: {- description: 'First page visited',- type: 'string',- },- exit_page: {- description: 'Last page visited',- type: 'string',- },- pageviews: {- description: 'Number of pageviews',- type: 'number',- },- session_duration: {- description: 'Session duration in seconds',- type: 'number',- },- session_start: {- description: 'Session start time',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- session_end: {- description: 'Session end time',- type: 'string',- 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/1/goals/1/sessions?page=1&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/goals/1/sessions?page=1&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/1/goals/1/sessions',- params={- 'page': 1,- 'limit': 10- },- 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/1/goals/1/sessions?page=1&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'-require 'uri'--uri = URI('https://app.rybbit.io/api/sites/1/goals/1/sessions?page=1&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) 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/1/goals/1/sessions?page=1&limit=10"-- 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/1/goals/1/sessions?page=1&limit=10")- .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/1/goals/1/sessions?page=1&limit=10"))- .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/1/goals/1/sessions?page=1&limit=10");-- var data = await response.Content.ReadAsStringAsync();- }-}-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "session_id": "sess_abc123",- "user_id": "user_xyz789",- "country": "US",- "browser": "Chrome",- "operating_system": "macOS",- "device_type": "desktop",- "entry_page": "/",- "exit_page": "/signup/complete",- "pageviews": 5,- "session_duration": 245,- "session_start": "2024-01-31T14:00:00.000Z",- "session_end": "2024-01-31T14:04:05.000Z",- "referrer": "https://google.com",- "channel": "organic"- }- ]-}-```--</div>-</div>-------## Create Goal--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-POST /api/sites/:site/goals-```--Creates a new goal for tracking conversions.--### Path Parameters--<TypeTable- type={{- site: {- description: 'Site ID or site identifier',- type: 'string | number',- required: true,- },- }}-/>--### Request Body--<TypeTable- type={{- name: {- description: 'Goal name',- type: 'string',- required: false,- },- goalType: {- description: 'Type of goal',- type: 'string',- typeDescription: '"path" | "event"',- required: true,- },- config: {- description: 'Goal configuration',- type: 'GoalConfig',- required: true,- },- }}-/>--#### GoalConfig for Path Goals--<TypeTable- type={{- pathPattern: {- description: 'URL path pattern to match. Supports wildcards (*)',- type: 'string',- required: true,- typeDescription: 'e.g., "/checkout/*", "/signup/complete"',- },- }}-/>--#### GoalConfig for Event Goals--<TypeTable- type={{- eventName: {- description: 'Event name to match',- type: 'string',- required: true,- },- eventPropertyKey: {- description: 'Property key to match (optional)',- type: 'string',- required: false,- },- eventPropertyValue: {- description: 'Property value to match (required if key is provided)',- type: 'string | number | boolean',- required: false,- },- }}-/>--### Response--<TypeTable- type={{- success: {- description: 'Whether the goal was created',- type: 'boolean',- },- goalId: {- description: 'ID of the created goal',- 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="Path Goal"-curl -X POST "https://app.rybbit.io/api/sites/1/goals23" \- -H "Authorization: Bearer your_api_key_here" \- -H "Content-Type: application/json" \- -d '{- "name": "Checkout Complete",- "goalType": "path",- "config": {- "pathPattern": "/checkout/success"- }- }'-```- </Tab>- <Tab value="JavaScript">-```javascript title="Event Goal"-const response = await fetch(- 'https://app.rybbit.io/api/sites/1/goals23',- {- method: 'POST',- headers: {- 'Authorization': 'Bearer your_api_key_here',- 'Content-Type': 'application/json'- },- body: JSON.stringify({- name: 'Purchase Made',- goalType: 'event',- config: {- eventName: 'purchase',- eventPropertyKey: 'plan',- eventPropertyValue: 'pro'- }- })- }-);--const data = await response.json();-```- </Tab>- <Tab value="Python">-```python title="Request"-import requests--response = requests.post(- 'https://app.rybbit.io/api/sites/1/goals23',- json={- 'name': 'Signup Complete',- 'goalType': 'path',- 'config': {- 'pathPattern': '/signup/*'- }- },- headers={- 'Authorization': 'Bearer your_api_key_here'- }-)--data = response.json()-```- </Tab>- <Tab value="PHP">-```php title="Request"-$body = [- 'name' => 'Checkout Complete',- 'goalType' => 'path',- 'config' => [- 'pathPattern' => '/checkout/success'- ]-];--$ch = curl_init();-curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/goals23');-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/1/goals23')-request = Net::HTTP::Post.new(uri)-request['Authorization'] = 'Bearer your_api_key_here'-request['Content-Type'] = 'application/json'-request.body = {- name: 'Checkout Complete',- goalType: 'path',- config: { pathPattern: '/checkout/success' }-}.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": "Checkout Complete",- "goalType": "path",- "config": map[string]string{- "pathPattern": "/checkout/success",- },-}-jsonBody, _ := json.Marshal(body)--req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/sites/1/goals23", 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": "Checkout Complete",- "goalType": "path",- "config": {- "pathPattern": "/checkout/success"- }-});--let client = reqwest::Client::new();-let res = client- .post("https://app.rybbit.io/api/sites/1/goals23")- .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": "Checkout Complete",- "goalType": "path",- "config": {- "pathPattern": "/checkout/success"- }-}-""";--HttpClient client = HttpClient.newHttpClient();-HttpRequest request = HttpRequest.newBuilder()- .uri(URI.create("https://app.rybbit.io/api/sites/1/goals23"))- .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-{- name = "Checkout Complete",- goalType = "path",- config = new { pathPattern = "/checkout/success" }-};--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/1/goals23", content);-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "success": true,- "goalId": 3-}-```--</div>-</div>-------## Update Goal--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-PUT /api/sites/:site/goals/:goalId-```--Updates an existing goal.--### Path Parameters--<TypeTable- type={{- goalId: {- description: 'ID of the goal to update',- type: 'string | number',- required: true,- },- site: {- description: 'Site ID or site identifier',- type: 'string | number',- required: true,- },- }}-/>--### Request Body--<TypeTable- type={{- name: {- description: 'Updated goal name',- type: 'string',- required: false,- },- goalType: {- description: 'Type of goal',- type: 'string',- typeDescription: '"path" | "event"',- required: true,- },- config: {- description: 'Updated goal configuration',- type: 'GoalConfig',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- success: {- description: 'Whether the goal was updated',- type: 'boolean',- },- goalId: {- description: 'ID of the updated goal',- 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 PUT "https://app.rybbit.io/api/sites/1/goals/123" \- -H "Authorization: Bearer your_api_key_here" \- -H "Content-Type: application/json" \- -d '{- "name": "Signup Completed (Updated)",- "goalType": "path",- "config": {- "pathPattern": "/signup/complete/*"- }- }'-```- </Tab>- <Tab value="JavaScript">-```javascript title="Request"-const response = await fetch(- 'https://app.rybbit.io/api/sites/1/goals/123',- {- method: 'PUT',- headers: {- 'Authorization': 'Bearer your_api_key_here',- 'Content-Type': 'application/json'- },- body: JSON.stringify({- name: 'Signup Completed (Updated)',- goalType: 'path',- config: {- pathPattern: '/signup/complete/*'- }- })- }-);--const data = await response.json();-```- </Tab>- <Tab value="Python">-```python title="Request"-import requests--response = requests.put(- 'https://app.rybbit.io/api/sites/1/goals/123',- json={- 'name': 'Signup Completed (Updated)',- 'goalType': 'path',- 'config': {- 'pathPattern': '/signup/complete/*'- }- },- headers={- 'Authorization': 'Bearer your_api_key_here'- }-)--data = response.json()-```- </Tab>- <Tab value="PHP">-```php title="Request"-$body = [- 'name' => 'Signup Completed (Updated)',- 'goalType' => 'path',- 'config' => [- 'pathPattern' => '/signup/complete/*'- ]-];--$ch = curl_init();-curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/goals/123');-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/sites/1/goals/123')-request = Net::HTTP::Put.new(uri)-request['Authorization'] = 'Bearer your_api_key_here'-request['Content-Type'] = 'application/json'-request.body = {- name: 'Signup Completed (Updated)',- goalType: 'path',- config: { pathPattern: '/signup/complete/*' }-}.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": "Signup Completed (Updated)",- "goalType": "path",- "config": map[string]string{- "pathPattern": "/signup/complete/*",- },-}-jsonBody, _ := json.Marshal(body)--req, _ := http.NewRequest("PUT", "https://app.rybbit.io/api/sites/1/goals/123", 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": "Signup Completed (Updated)",- "goalType": "path",- "config": {- "pathPattern": "/signup/complete/*"- }-});--let client = reqwest::Client::new();-let res = client- .put("https://app.rybbit.io/api/sites/1/goals/123")- .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": "Signup Completed (Updated)",- "goalType": "path",- "config": {- "pathPattern": "/signup/complete/*"- }-}-""";--HttpClient client = HttpClient.newHttpClient();-HttpRequest request = HttpRequest.newBuilder()- .uri(URI.create("https://app.rybbit.io/api/sites/1/goals/123"))- .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 = "Signup Completed (Updated)",- goalType = "path",- config = new { pathPattern = "/signup/complete/*" }-};--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/sites/1/goals/123", content);-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "success": true,- "goalId": 1-}-```--</div>-</div>-------## Delete Goal--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-DELETE /api/sites/:site/goals/:goalId-```--Deletes a goal. This action cannot be undone.--### Path Parameters--<TypeTable- type={{- goalId: {- description: 'ID of the goal to delete',- type: 'string | number',- required: true,- },- site: {- description: 'Site ID or site identifier',- type: 'string | number',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- success: {- description: 'Whether the goal 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/sites/1/goals/123" \- -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/goals/123',- {- 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/1/goals/123',- 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/1/goals/123');-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/1/goals/123')-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/sites/1/goals/123", 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/1/goals/123")- .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/1/goals/123"))- .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/1/goals/123");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "success": true-}-```--</div>-</div>diff --git a/docs/content/docs/api/stats/meta.json b/docs/content/docs/api/stats/meta.jsondeleted file mode 100644index 4f0e87315..000000000--- a/docs/content/docs/api/stats/meta.json+++ /dev/null@@ -1,14 +0,0 @@-{- "title": "Stats",- "pages": [- "overview",- "sessions",- "events",- "users",- "goals",- "funnels",- "performance",- "errors",- "misc"- ]-}diff --git a/docs/content/docs/api/stats/overview.mdx b/docs/content/docs/api/stats/overview.mdxdeleted file mode 100644index bce616a40..000000000--- a/docs/content/docs/api/stats/overview.mdx+++ /dev/null@@ -1,929 +0,0 @@-----title: Overview-description: Retrieve high-level analytics metrics for a site-full: true------import { TypeTable } from 'fumadocs-ui/components/type-table';-import { Tab, Tabs } from 'fumadocs-ui/components/tabs';--See the [API Reference](/docs/api/stats/reference) for authentication, common parameters, and filters.--## Endpoints--<div className="flex flex-col gap-2 my-6">- <a href="#get-overview" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/overview</code>- </a>- <a href="#get-overview-time-series" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/overview-bucketed</code>- </a>- <a href="#get-metric" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/metric</code>- </a>- <a href="#get-live-visitors" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/live-user-count</code>- </a>-</div>-------## Get Overview--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/overview-```--Returns high-level analytics metrics for a site.--### 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).--### Response--<TypeTable- type={{- sessions: {- description: 'Total number of sessions',- type: 'number',- },- pageviews: {- description: 'Total number of pageviews',- type: 'number',- },- users: {- description: 'Total unique users',- type: 'number',- },- pages_per_session: {- description: 'Average pages viewed per session',- type: 'number',- },- bounce_rate: {- description: 'Percentage of single-page sessions',- type: 'number',- typeDescription: 'Range: 0-100',- },- session_duration: {- description: 'Average session duration in seconds',- 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/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/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/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/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/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/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/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/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/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": {- "sessions": 15420,- "pageviews": 48933,- "users": 12847,- "pages_per_session": 3.17,- "bounce_rate": 42.8,- "session_duration": 182.5- }-}-```--</div>-</div>-------## Get Overview (Time Series)--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/overview-bucketed-```--Returns time-series analytics data broken down by configurable time buckets. Useful for charting trends 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) plus the following:--<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"',- required: true,- },- }}-/>--#### 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',- },- sessions: {- description: 'Number of sessions in this bucket',- type: 'number',- },- pageviews: {- description: 'Number of pageviews in this bucket',- type: 'number',- },- users: {- description: 'Unique users in this bucket',- type: 'number',- },- pages_per_session: {- description: 'Average pages viewed per session',- type: 'number',- },- bounce_rate: {- description: 'Percentage of single-page sessions',- type: 'number',- typeDescription: 'Range: 0-100',- },- session_duration: {- description: 'Average session duration in seconds',- 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/overview-bucketed?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',- {- 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/overview-bucketed',- 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/overview-bucketed?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/overview-bucketed?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/overview-bucketed?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/overview-bucketed?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/overview-bucketed?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/overview-bucketed?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",- "sessions": 1250,- "pageviews": 3890,- "users": 1100,- "pages_per_session": 3.11,- "bounce_rate": 41.5,- "session_duration": 165.2- },- {- "time": "2024-01-02T00:00:00.000Z",- "sessions": 1420,- "pageviews": 4520,- "users": 1280,- "pages_per_session": 3.18,- "bounce_rate": 39.8,- "session_duration": 178.4- },- {- "time": "2024-01-03T00:00:00.000Z",- "sessions": 1380,- "pageviews": 4210,- "users": 1190,- "pages_per_session": 3.05,- "bounce_rate": 42.1,- "session_duration": 162.8- }- ]-}-```--</div>-</div>-------## Get Metric--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/metric-```--Returns dimensional analytics data broken down by a specific parameter. Supports pagination.--### 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) plus the following:--<TypeTable- type={{- parameter: {- description: 'The dimension to break down by',- type: 'FilterParameter',- typeDescription: 'e.g., "pathname", "country", "browser", "event_name"',- required: true,- },- limit: {- description: 'Number of results per page',- type: 'number',- default: 100,- },- page: {- description: 'Page number (1-indexed)',- type: 'number',- default: 1,- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of metric results',- type: 'MetricItem[]',- typeDescription: 'See MetricItem structure below',- },- totalCount: {- description: 'Total number of unique values across all pages',- type: 'number',- },- }}-/>--#### MetricItem Structure--<TypeTable- type={{- value: {- description: 'The dimension value',- type: 'string',- typeDescription: 'e.g., "/blog", "Chrome", "US"',- },- count: {- description: 'Number of sessions for this value',- type: 'number',- },- percentage: {- description: 'Percentage of total sessions',- type: 'number',- typeDescription: 'Range: 0-100',- },- pageviews: {- description: 'Total pageviews (for page-related parameters)',- type: 'number',- required: false,- },- bounce_rate: {- description: 'Bounce rate percentage',- type: 'number',- typeDescription: 'Range: 0-100',- required: false,- },- }}-/>--</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/metric?parameter=country&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/metric?parameter=country&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/metric',- params={- 'parameter': 'country',- '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/metric?parameter=country&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/metric?parameter=country&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/metric?parameter=country&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/metric?parameter=country&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/metric?parameter=country&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/metric?parameter=country&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": {- "data": [- {- "value": "US",- "count": 8420,- "percentage": 54.63,- "pageviews": 26891,- "pageviews_percentage": 54.96,- "bounce_rate": 41.2- },- {- "value": "GB",- "count": 2150,- "percentage": 13.95,- "pageviews": 6847,- "pageviews_percentage": 13.99,- "bounce_rate": 43.8- }- ],- "totalCount": 87- }-}-```--</div>-</div>-------## Get Live Visitors--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/live-user-count-```--Returns the count of unique active sessions within the specified time window. Useful for displaying real-time visitor counts.--### Path Parameters--<TypeTable- type={{- site: {- description: 'Site ID or site identifier',- type: 'string | number',- required: true,- },- }}-/>--### Query Parameters--<TypeTable- type={{- minutes: {- description: 'Time window in minutes to count active sessions',- type: 'number',- default: 5,- typeDescription: 'Sessions with activity within the last N minutes are considered "live"',- },- }}-/>--### Response--<TypeTable- type={{- count: {- description: 'Number of unique active sessions',- type: 'number',- },- }}-/>--#### Time Window Guide--| Minutes | Use Case |-|---------|----------|-| `1` | Very active visitors (currently browsing) |-| `5` | Standard "live" count (default) |-| `15` | Recently active visitors |-| `30` | Short-term engagement window |--</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/live-user-count?minutes=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/live-user-count?minutes=5',- {- headers: {- 'Authorization': 'Bearer your_api_key_here'- }- }-);--const { count } = await response.json();-console.log(`Live visitors: ${count}`);-```- </Tab>- <Tab value="Python">-```python title="Request"-import requests--response = requests.get(- 'https://app.rybbit.io/api/sites/123/live-user-count',- params={'minutes': 5},- headers={- 'Authorization': 'Bearer your_api_key_here'- }-)--data = response.json()-print(f"Live visitors: {data['count']}")-```- </Tab>- <Tab value="PHP">-```php title="Request"-$ch = curl_init();-curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/live-user-count?minutes=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);-echo "Live visitors: " . $data['count'];-```- </Tab>- <Tab value="Ruby">-```ruby title="Request"-require 'net/http'-require 'json'--uri = URI('https://app.rybbit.io/api/sites/123/live-user-count?minutes=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)-puts "Live visitors: #{data['count']}"-```- </Tab>- <Tab value="Go">-```go title="Request"-req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/123/live-user-count?minutes=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)-fmt.Printf("Live visitors: %v\n", data["count"])-```- </Tab>- <Tab value="Rust">-```rust title="Request"-let client = reqwest::Client::new();-let res = client- .get("https://app.rybbit.io/api/sites/123/live-user-count?minutes=5")- .header("Authorization", "Bearer your_api_key_here")- .send()- .await?;--let data: serde_json::Value = res.json().await?;-println!("Live visitors: {}", data["count"]);-```- </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/live-user-count?minutes=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/live-user-count?minutes=5");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "count": 42-}-```--### Polling Example--```javascript title="Real-time Widget"-async function updateLiveCount() {- const response = await fetch(- 'https://app.rybbit.io/api/sites/123/live-user-count?minutes=5',- {- headers: {- 'Authorization': 'Bearer your_api_key'- }- }- );- const { count } = await response.json();- document.getElementById('live-visitors')- .textContent = count;-}--// Update every 15 seconds-setInterval(updateLiveCount, 15000);-```--</div>-</div>diff --git a/docs/content/docs/api/stats/performance.mdx b/docs/content/docs/api/stats/performance.mdxdeleted file mode 100644index 8a237169b..000000000--- a/docs/content/docs/api/stats/performance.mdx+++ /dev/null@@ -1,764 +0,0 @@-----title: Performance-description: Retrieve Core Web Vitals and performance metrics for your site-full: true------import { TypeTable } from 'fumadocs-ui/components/type-table';-import { Tab, Tabs } from 'fumadocs-ui/components/tabs';--See the [API Reference](/docs/api/stats/reference) for authentication, common parameters, and filters.--## Core Web Vitals--The performance endpoints return data for the following Core Web Vitals metrics:--| Metric | Description | Good | Needs Improvement | Poor |-|--------|-------------|------|-------------------|------|-| **LCP** | Largest Contentful Paint - loading performance | < 2.5s | 2.5s - 4s | > 4s |-| **CLS** | Cumulative Layout Shift - visual stability | < 0.1 | 0.1 - 0.25 | > 0.25 |-| **INP** | Interaction to Next Paint - interactivity | < 200ms | 200ms - 500ms | > 500ms |-| **FCP** | First Contentful Paint - initial render | < 1.8s | 1.8s - 3s | > 3s |-| **TTFB** | Time to First Byte - server response time | < 800ms | 800ms - 1.8s | > 1.8s |--## Endpoints--<div className="flex flex-col gap-2 my-6">- <a href="#get-performance-overview" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/performance/overview</code>- </a>- <a href="#get-performance-time-series" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/performance/time-series</code>- </a>- <a href="#get-performance-by-dimension" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/performance/by-dimension</code>- </a>-</div>-------## Get Performance Overview--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/performance/overview-```--Returns aggregate performance metrics with percentile breakdowns for all Core Web Vitals.--### 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).--### Response--<TypeTable- type={{- data: {- description: 'Performance metrics object',- type: 'PerformanceMetrics',- },- }}-/>--#### PerformanceMetrics Object--Each metric (lcp, cls, inp, fcp, ttfb) includes the following percentiles:--<TypeTable- type={{- lcp_p50: {- description: 'LCP 50th percentile (median)',- type: 'number',- typeDescription: 'milliseconds',- },- lcp_p75: {- description: 'LCP 75th percentile',- type: 'number',- typeDescription: 'milliseconds',- },- lcp_p90: {- description: 'LCP 90th percentile',- type: 'number',- typeDescription: 'milliseconds',- },- lcp_p99: {- description: 'LCP 99th percentile',- type: 'number',- typeDescription: 'milliseconds',- },- total_performance_events: {- description: 'Total number of performance measurements',- 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/1/performance/overview?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/performance/overview?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/1/performance/overview23',- params={- '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/1/performance/overview?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/1/performance/overview?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/1/performance/overview?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/1/performance/overview?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/1/performance/overview?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/1/performance/overview?start_date=2024-01-01&end_date=2024-01-31");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": {- "lcp_p50": 1850,- "lcp_p75": 2400,- "lcp_p90": 3200,- "lcp_p99": 5100,- "cls_p50": 0.05,- "cls_p75": 0.1,- "cls_p90": 0.18,- "cls_p99": 0.35,- "inp_p50": 120,- "inp_p75": 180,- "inp_p90": 280,- "inp_p99": 450,- "fcp_p50": 1200,- "fcp_p75": 1600,- "fcp_p90": 2100,- "fcp_p99": 3500,- "ttfb_p50": 450,- "ttfb_p75": 650,- "ttfb_p90": 950,- "ttfb_p99": 1800,- "total_performance_events": 48521- }-}-```--</div>-</div>-------## Get Performance Time Series--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/performance/time-series-```--Returns performance metrics over time, broken down by configurable time buckets. Useful for charting performance trends.--### 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) plus the following:--<TypeTable- type={{- bucket: {- description: 'Time bucket size for grouping data',- type: 'TimeBucket',- typeDescription: '"minute" | "five_minutes" | "hour" | "day" | "week" | "month"',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of time-bucketed performance data',- type: 'PerformancePoint[]',- },- }}-/>--#### PerformancePoint Object--Each point includes all percentiles for each metric plus:--<TypeTable- type={{- time: {- description: 'Start of the time bucket',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- event_count: {- description: 'Number of performance events 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/1/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&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/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=UTC',- {- 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/1/performance/time-series',- params={- 'bucket': 'day',- 'start_date': '2024-01-01',- 'end_date': '2024-01-07',- 'time_zone': 'UTC'- },- 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/1/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&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'--uri = URI('https://app.rybbit.io/api/sites/1/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&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"-req, _ := http.NewRequest("GET", "https://app.rybbit.io/api/sites/1/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&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 client = reqwest::Client::new();-let res = client- .get("https://app.rybbit.io/api/sites/1/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=UTC")- .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/1/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&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"-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/performance/time-series?bucket=day&start_date=2024-01-01&end_date=2024-01-07&time_zone=UTC");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "time": "2024-01-01T00:00:00.000Z",- "lcp_p50": 1820,- "lcp_p75": 2350,- "lcp_p90": 3100,- "lcp_p99": 4900,- "cls_p50": 0.04,- "cls_p75": 0.09,- "inp_p50": 115,- "inp_p75": 175,- "fcp_p50": 1180,- "fcp_p75": 1580,- "ttfb_p50": 440,- "ttfb_p75": 640,- "event_count": 6892- },- {- "time": "2024-01-02T00:00:00.000Z",- "lcp_p50": 1900,- "lcp_p75": 2450,- "lcp_p90": 3250,- "lcp_p99": 5200,- "cls_p50": 0.05,- "cls_p75": 0.11,- "inp_p50": 125,- "inp_p75": 185,- "fcp_p50": 1220,- "fcp_p75": 1620,- "ttfb_p50": 460,- "ttfb_p75": 660,- "event_count": 7234- }- ]-}-```--</div>-</div>-------## Get Performance by Dimension--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/performance/by-dimension-```--Returns performance metrics broken down by a specific dimension (page, country, browser, etc.). Useful for identifying performance issues on specific pages or for specific user segments.--### 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) plus the following:--<TypeTable- type={{- dimension: {- description: 'Dimension to break down by',- type: 'string',- typeDescription: '"pathname" | "country" | "device_type" | "browser" | "operating_system" | "region"',- required: true,- },- page: {- description: 'Page number (1-indexed)',- type: 'number',- required: false,- },- limit: {- description: 'Number of results per page',- type: 'number',- default: 100,- },- sort_by: {- description: 'Field to sort by',- type: 'string',- default: 'event_count',- },- sort_order: {- description: 'Sort direction',- type: 'string',- typeDescription: '"asc" | "desc"',- default: 'desc',- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Paginated response object',- type: 'PaginatedResponse',- },- }}-/>--#### DimensionPerformance Object--Each object includes the dimension value plus all percentiles:--<TypeTable- type={{- pathname: {- description: 'The dimension value (field name matches dimension param)',- type: 'string',- },- event_count: {- description: 'Number of performance events',- type: 'number',- },- lcp_avg: {- description: 'Average LCP',- type: 'number',- },- lcp_p50: {- description: 'LCP 50th percentile',- type: 'number',- },- lcp_p75: {- description: 'LCP 75th percentile',- type: 'number',- },- lcp_p90: {- description: 'LCP 90th percentile',- type: 'number',- },- lcp_p99: {- description: 'LCP 99th percentile',- 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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/1/performance/by-dimension',- params={- 'dimension': 'pathname',- 'sort_by': 'lcp_p75',- 'sort_order': 'desc',- '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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&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/1/performance/by-dimension?dimension=pathname&sort_by=lcp_p75&sort_order=desc&limit=10");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": {- "data": [- {- "pathname": "/dashboard",- "event_count": 12450,- "lcp_avg": 2850,- "lcp_p50": 2400,- "lcp_p75": 3200,- "lcp_p90": 4100,- "lcp_p99": 6500,- "cls_avg": 0.08,- "cls_p50": 0.05,- "cls_p75": 0.12,- "inp_avg": 180,- "inp_p50": 150,- "inp_p75": 220,- "fcp_avg": 1450,- "fcp_p50": 1300,- "fcp_p75": 1700,- "ttfb_avg": 520,- "ttfb_p50": 480,- "ttfb_p75": 680- },- {- "pathname": "/reports",- "event_count": 8920,- "lcp_avg": 2650,- "lcp_p50": 2200,- "lcp_p75": 2900,- "lcp_p90": 3800,- "lcp_p99": 5800- }- ],- "totalCount": 156- }-}-```--</div>-</div>diff --git a/docs/content/docs/api/stats/sessions.mdx b/docs/content/docs/api/stats/sessions.mdxdeleted file mode 100644index 08523e04c..000000000--- a/docs/content/docs/api/stats/sessions.mdx+++ /dev/null@@ -1,843 +0,0 @@-----title: Sessions-description: Retrieve session-level analytics data including session lists, details, and locations-full: true------import { TypeTable } from 'fumadocs-ui/components/type-table';-import { Tab, Tabs } from 'fumadocs-ui/components/tabs';--See the [API Reference](/docs/api/stats/reference) for authentication, common parameters, and filters.--## Endpoints--<div className="flex flex-col gap-2 my-6">- <a href="#get-sessions" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/sessions</code>- </a>- <a href="#get-session" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/sessions/:sessionId</code>- </a>- <a href="#get-session-locations" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/session-locations</code>- </a>-</div>-------## Get Sessions--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/sessions-```--Returns a paginated list of sessions with their analytics data.--### 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) plus the following:--<TypeTable- type={{- page: {- description: 'Page number (1-indexed)',- type: 'number',- default: 1,- },- limit: {- description: 'Number of results per page',- type: 'number',- default: 100,- },- user_id: {- description: 'Filter sessions by user ID',- type: 'string',- required: false,- },- identified_only: {- description: 'Only return sessions from identified users',- type: 'string',- typeDescription: '"true" | "false"',- default: 'false',- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of session objects',- type: 'Session[]',- },- }}-/>--#### Session Object--<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',- },- traits: {- description: 'Custom user traits',- type: 'object | null',- },- 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',- type: 'string',- },- device_type: {- description: 'Device type',- type: 'string',- },- referrer: {- description: 'Referrer URL',- type: 'string',- },- channel: {- description: 'Traffic channel',- type: 'string',- },- entry_page: {- description: 'First page visited',- type: 'string',- },- exit_page: {- description: 'Last page visited',- type: 'string',- },- pageviews: {- description: 'Number of pageviews',- type: 'number',- },- events: {- description: 'Number of custom events',- type: 'number',- },- session_duration: {- description: 'Duration in seconds',- type: 'number',- },- session_start: {- description: 'Session start time',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- session_end: {- description: 'Session end time',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- utm_source: {- description: 'UTM source parameter',- type: 'string',- },- utm_medium: {- description: 'UTM medium parameter',- type: 'string',- },- utm_campaign: {- description: 'UTM campaign parameter',- 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/1/sessions?page=1&limit=20&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/sessions?page=1&limit=20&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/1/sessions23',- params={- 'page': 1,- 'limit': 20,- '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/1/sessions?page=1&limit=20&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/1/sessions?page=1&limit=20&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/1/sessions?page=1&limit=20&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/1/sessions?page=1&limit=20&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/1/sessions?page=1&limit=20&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/1/sessions?page=1&limit=20&start_date=2024-01-01&end_date=2024-01-31");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "session_id": "sess_abc123",- "user_id": "dev_xyz789",- "identified_user_id": "[email protected]",- "traits": { "plan": "pro" },- "country": "US",- "region": "California",- "city": "San Francisco",- "browser": "Chrome",- "operating_system": "macOS",- "device_type": "desktop",- "referrer": "https://google.com",- "channel": "organic",- "entry_page": "/",- "exit_page": "/pricing",- "pageviews": 5,- "events": 2,- "session_duration": 245,- "session_start": "2024-01-31T14:00:00.000Z",- "session_end": "2024-01-31T14:04:05.000Z",- "utm_source": "google",- "utm_medium": "cpc",- "utm_campaign": "brand"- }- ]-}-```--</div>-</div>-------## Get Session--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/sessions/:sessionId-```--Returns detailed information about a specific session including all events and pageviews.--### Path Parameters--<TypeTable- type={{- sessionId: {- description: 'Session ID',- type: 'string',- required: true,- },- site: {- description: 'Site ID or site identifier',- type: 'string | number',- required: true,- },- }}-/>--### Query Parameters--<TypeTable- type={{- limit: {- description: 'Number of events to return',- type: 'number',- default: 100,- },- offset: {- description: 'Number of events to skip',- type: 'number',- default: 0,- },- minutes: {- description: 'Only return events from the last N minutes',- type: 'number',- required: false,- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Session details object',- type: 'SessionDetails',- },- }}-/>--#### SessionDetails Object--<TypeTable- type={{- session: {- description: 'Session metadata',- type: 'SessionMeta',- },- events: {- description: 'Array of events in the session',- type: 'Event[]',- },- pagination: {- description: 'Pagination info for events',- type: 'Pagination',- },- }}-/>--#### Event Object--<TypeTable- type={{- timestamp: {- description: 'Event timestamp',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- pathname: {- description: 'Page path',- type: 'string',- },- hostname: {- description: 'Hostname',- type: 'string',- },- page_title: {- description: 'Page title',- type: 'string',- },- type: {- description: 'Event type',- type: 'string',- typeDescription: '"pageview" | "custom_event" | "error" | "outbound"',- },- event_name: {- description: 'Custom event name (for custom_event type)',- type: 'string',- },- props: {- description: 'Event properties',- type: '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 GET "https://app.rybbit.io/api/sites/123/sessions/sess_abc123/123?limit=50" \- -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/sessions/sess_abc123/123?limit=50',- {- 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/sessions/sess_abc123/123',- params={'limit': 50},- 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/sessions/sess_abc123/123?limit=50');-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/sessions/sess_abc123/123?limit=50')-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/sessions/sess_abc123/123?limit=50", 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/sessions/sess_abc123/123?limit=50")- .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/sessions/sess_abc123/123?limit=50"))- .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/sessions/sess_abc123/123?limit=50");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": {- "session": {- "session_id": "sess_abc123",- "user_id": "dev_xyz789",- "country": "US",- "browser": "Chrome",- "operating_system": "macOS",- "device_type": "desktop",- "session_start": "2024-01-31T14:00:00.000Z",- "session_end": "2024-01-31T14:04:05.000Z",- "session_duration": 245,- "pageviews": 5,- "events": 7,- "entry_page": "/",- "exit_page": "/pricing"- },- "events": [- {- "timestamp": "2024-01-31T14:00:00.000Z",- "pathname": "/",- "hostname": "example.com",- "page_title": "Home",- "type": "pageview",- "referrer": "https://google.com"- },- {- "timestamp": "2024-01-31T14:01:30.000Z",- "pathname": "/",- "hostname": "example.com",- "type": "custom_event",- "event_name": "cta_click",- "props": { "button": "hero" }- }- ],- "pagination": {- "total": 7,- "limit": 50,- "offset": 0,- "hasMore": false- }- }-}-```--</div>-</div>-------## Get Session Locations--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/session-locations-```--Returns aggregated session locations with coordinates for map visualization.--### 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).--### Response--<TypeTable- type={{- data: {- description: 'Array of location objects',- type: 'Location[]',- },- }}-/>--#### Location Object--<TypeTable- type={{- lat: {- description: 'Latitude coordinate',- type: 'number',- },- lon: {- description: 'Longitude coordinate',- type: 'number',- },- city: {- description: 'City name',- type: 'string',- },- country: {- description: 'Country code',- type: 'string',- },- count: {- description: 'Number of sessions from this location',- 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/1/session-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',- {- 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/1/session-locations23',- params={- '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/1/session-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'-]);--$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/1/session-locations?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/1/session-locations?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/1/session-locations?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/1/session-locations?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/1/session-locations?start_date=2024-01-01&end_date=2024-01-31");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "lat": 37.7749,- "lon": -122.4194,- "city": "San Francisco",- "country": "US",- "count": 1250- },- {- "lat": 40.7128,- "lon": -74.006,- "city": "New York",- "country": "US",- "count": 980- },- {- "lat": 51.5074,- "lon": -0.1278,- "city": "London",- "country": "GB",- "count": 650- }- ]-}-```--</div>-</div>diff --git a/docs/content/docs/api/stats/users.mdx b/docs/content/docs/api/stats/users.mdxdeleted file mode 100644index 7717ca4d2..000000000--- a/docs/content/docs/api/stats/users.mdx+++ /dev/null@@ -1,861 +0,0 @@-----title: Users-description: Retrieve user-level analytics data including user lists, sessions, and profiles-full: true------import { TypeTable } from 'fumadocs-ui/components/type-table';-import { Tab, Tabs } from 'fumadocs-ui/components/tabs';--See the [API Reference](/docs/api/stats/reference) for authentication, common parameters, and filters.--## Endpoints--<div className="flex flex-col gap-2 my-6">- <a href="#get-users" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/users</code>- </a>- <a href="#get-user-sessions" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/users/:userId/sessions</code>- </a>- <a href="#get-user-session-count" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/users/session-count</code>- </a>- <a href="#get-user-info" className="flex items-center gap-3 p-3 rounded-lg bg-fd-secondary/50 hover:bg-fd-secondary transition-colors no-underline">- <span className="px-2 py-1 text-xs font-bold rounded bg-green-500/20 text-green-600 dark:text-green-400">GET</span>- <code className="text-sm">/api/sites/:site/users/:userId</code>- </a>-</div>-------## Get Users--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/users-```--Returns a paginated list of users with their analytics data. Supports filtering by identified users only.--### 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) plus the following:--<TypeTable- type={{- page: {- description: 'Page number (1-indexed)',- type: 'number',- default: 1,- },- page_size: {- description: 'Number of results per page',- type: 'number',- default: 20,- },- sort_by: {- description: 'Field to sort by',- type: 'string',- typeDescription: '"first_seen" | "last_seen" | "pageviews" | "sessions" | "events"',- default: 'last_seen',- },- sort_order: {- description: 'Sort direction',- type: 'string',- typeDescription: '"asc" | "desc"',- default: 'desc',- },- identified_only: {- description: 'Only return users with a custom identified_user_id',- type: 'string',- typeDescription: '"true" | "false"',- default: 'false',- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of user objects',- type: 'User[]',- },- totalCount: {- description: 'Total number of users across all pages',- type: 'number',- },- page: {- description: 'Current page number',- type: 'number',- },- pageSize: {- description: 'Number of results per page',- type: 'number',- },- }}-/>--#### User Object--<TypeTable- type={{- user_id: {- description: 'Device fingerprint identifier',- type: 'string',- },- identified_user_id: {- description: 'Custom user ID when identified, empty string otherwise',- type: 'string',- },- traits: {- description: 'Custom user traits/properties',- type: 'object | null',- },- country: {- description: 'Country code',- type: 'string',- },- region: {- description: 'Region/state',- type: 'string',- },- city: {- description: 'City name',- type: 'string',- },- language: {- description: 'Browser language',- type: 'string',- },- browser: {- description: 'Browser name',- type: 'string',- },- operating_system: {- description: 'Operating system name',- type: 'string',- },- device_type: {- description: 'Device type (desktop, mobile, tablet)',- type: 'string',- },- pageviews: {- description: 'Total pageviews by this user',- type: 'number',- },- events: {- description: 'Total custom events by this user',- type: 'number',- },- sessions: {- description: 'Total sessions by this user',- type: 'number',- },- hostname: {- description: 'First hostname visited',- type: 'string',- },- first_seen: {- description: 'First activity timestamp',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- last_seen: {- description: 'Most recent activity timestamp',- type: 'string',- 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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc" \- -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/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc',- {- 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/1/users23',- params={- 'page': 1,- 'page_size': 10,- 'sort_by': 'last_seen',- 'sort_order': 'desc'- },- 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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc');-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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc')-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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc", 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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc")- .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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc"))- .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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "user_id": "abc123def456",- "identified_user_id": "[email protected]",- "traits": {- "plan": "pro",- "company": "Acme Inc"- },- "country": "US",- "region": "California",- "city": "San Francisco",- "language": "en-US",- "browser": "Chrome",- "operating_system": "macOS",- "device_type": "desktop",- "pageviews": 156,- "events": 23,- "sessions": 12,- "hostname": "example.com",- "first_seen": "2024-01-15T10:30:00.000Z",- "last_seen": "2024-01-31T14:22:00.000Z"- }- ],- "totalCount": 1247,- "page": 1,- "pageSize": 10-}-```--</div>-</div>-------## Get User Session Count--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/users/session-count-```--Returns the number of sessions per day for a specific user. Useful for visualizing user engagement over time.--### Path Parameters--<TypeTable- type={{- site: {- description: 'Site ID or site identifier',- type: 'string | number',- required: true,- },- }}-/>--### Query Parameters--<TypeTable- type={{- user_id: {- description: 'User ID (device fingerprint or identified user ID)',- type: 'string',- required: true,- },- time_zone: {- description: 'Timezone for date grouping',- type: 'string',- default: 'UTC',- typeDescription: 'IANA timezone (e.g., "America/New_York")',- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'Array of daily session counts',- type: 'DailyCount[]',- },- }}-/>--#### DailyCount Object--<TypeTable- type={{- date: {- description: 'Date',- type: 'string',- typeDescription: 'YYYY-MM-DD format',- },- sessions: {- description: 'Number of sessions on this date',- 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/1/users/session-count?user_id=abc123def456&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/1/users/session-count?user_id=abc123def456&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/1/users/session-count',- params={- 'user_id': 'abc123def456',- '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/1/users/session-count?user_id=abc123def456&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/1/users/session-count?user_id=abc123def456&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/1/users/session-count?user_id=abc123def456&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/1/users/session-count?user_id=abc123def456&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/1/users/session-count?user_id=abc123def456&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/1/users/session-count?user_id=abc123def456&time_zone=America/New_York");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": [- {- "date": "2024-01-15",- "sessions": 2- },- {- "date": "2024-01-18",- "sessions": 1- },- {- "date": "2024-01-22",- "sessions": 3- },- {- "date": "2024-01-31",- "sessions": 1- }- ]-}-```--</div>-</div>-------## Get User Info--<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">-<div>--```-GET /api/sites/:site/users/:userId-```--Returns detailed information about a specific user, including their profile traits and linked devices.--### Path Parameters--<TypeTable- type={{- userId: {- description: 'User ID (device fingerprint or identified user ID)',- type: 'string',- required: true,- },- site: {- description: 'Site ID or site identifier',- type: 'string | number',- required: true,- },- }}-/>--### Response--<TypeTable- type={{- data: {- description: 'User info object',- type: 'UserInfo',- },- }}-/>--#### UserInfo Object--<TypeTable- type={{- user_id: {- description: 'Device fingerprint identifier',- type: 'string',- },- identified_user_id: {- description: 'Custom user ID when identified',- type: 'string',- },- traits: {- description: 'Custom user traits/properties set via identify()',- type: 'object | null',- },- sessions: {- description: 'Total number of sessions',- type: 'number',- },- pageviews: {- description: 'Total pageviews',- type: 'number',- },- events: {- description: 'Total custom events',- type: 'number',- },- duration: {- description: 'Average session duration in seconds',- type: 'number',- },- country: {- description: 'Country code',- type: 'string',- },- region: {- description: 'Region/state',- type: 'string',- },- city: {- description: 'City name',- type: 'string',- },- language: {- description: 'Browser language',- type: 'string',- },- browser: {- description: 'Browser name',- type: 'string',- },- browser_version: {- description: 'Browser version',- type: 'string',- },- operating_system: {- description: 'Operating system name',- 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',- },- first_seen: {- description: 'First activity timestamp',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- last_seen: {- description: 'Most recent activity timestamp',- type: 'string',- typeDescription: 'ISO 8601 datetime',- },- linked_devices: {- description: 'Devices linked to this identified user',- type: 'LinkedDevice[]',- },- }}-/>--#### LinkedDevice Object--<TypeTable- type={{- anonymous_id: {- description: 'Anonymous device fingerprint',- type: 'string',- },- created_at: {- description: 'When the device was linked',- type: 'string',- 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/users/[email protected]/123" \- -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/users/[email protected]/123',- {- 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/users/[email protected]/123',- 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/users/[email protected]/123');-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/users/[email protected]/123')-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/users/[email protected]/123", 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/users/[email protected]/123")- .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/users/[email protected]/123"))- .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/users/[email protected]/123");-var data = await response.Content.ReadAsStringAsync();-```- </Tab>-</Tabs>--```json title="Response"-{- "data": {- "user_id": "abc123def456",- "identified_user_id": "[email protected]",- "traits": {- "name": "John Doe",- "plan": "pro",- "company": "Acme Inc"- },- "sessions": 12,- "pageviews": 156,- "events": 23,- "duration": 245,- "country": "US",- "region": "California",- "city": "San Francisco",- "language": "en-US",- "browser": "Chrome",- "browser_version": "120.0.0",- "operating_system": "macOS",- "operating_system_version": "14.2",- "device_type": "desktop",- "screen_width": 2560,- "screen_height": 1440,- "first_seen": "2024-01-15T10:30:00.000Z",- "last_seen": "2024-01-31T14:22:00.000Z",- "linked_devices": [- {- "anonymous_id": "xyz789ghi012",- "created_at": "2024-01-20T08:15:00.000Z"- }- ]- }-}-```--</div>-</div>diff --git a/docs/content/docs/api/users/info.mdx b/docs/content/docs/api/users/info.mdxnew file mode 100644index 000000000..974f8a597--- /dev/null+++ b/docs/content/docs/api/users/info.mdx@@ -0,0 +1,309 @@+---+title: Get User Info+description: Returns detailed information about a specific user, including their profile traits and linked devices.+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/users/:userId+```++Returns detailed information about a specific user, including their profile traits and linked devices.++### Path Parameters++<TypeTable+ type={{+ userId: {+ description: 'User ID (device fingerprint or identified user ID)',+ type: 'string',+ required: true,+ },+ site: {+ description: 'Site ID or site identifier',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'User info object',+ type: 'UserInfo',+ },+ }}+/>++#### UserInfo Object++<TypeTable+ type={{+ user_id: {+ description: 'Device fingerprint identifier',+ type: 'string',+ },+ identified_user_id: {+ description: 'Custom user ID when identified',+ type: 'string',+ },+ traits: {+ description: 'Custom user traits/properties set via identify()',+ type: 'object | null',+ },+ sessions: {+ description: 'Total number of sessions',+ type: 'number',+ },+ pageviews: {+ description: 'Total pageviews',+ type: 'number',+ },+ events: {+ description: 'Total custom events',+ type: 'number',+ },+ duration: {+ description: 'Average session duration in seconds',+ type: 'number',+ },+ country: {+ description: 'Country code',+ type: 'string',+ },+ region: {+ description: 'Region/state',+ type: 'string',+ },+ city: {+ description: 'City name',+ type: 'string',+ },+ language: {+ description: 'Browser language',+ type: 'string',+ },+ browser: {+ description: 'Browser name',+ type: 'string',+ },+ browser_version: {+ description: 'Browser version',+ type: 'string',+ },+ operating_system: {+ description: 'Operating system name',+ 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',+ },+ first_seen: {+ description: 'First activity timestamp',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ last_seen: {+ description: 'Most recent activity timestamp',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ linked_devices: {+ description: 'Devices linked to this identified user',+ type: 'LinkedDevice[]',+ },+ }}+/>++#### LinkedDevice Object++<TypeTable+ type={{+ anonymous_id: {+ description: 'Anonymous device fingerprint',+ type: 'string',+ },+ created_at: {+ description: 'When the device was linked',+ type: 'string',+ 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/users/[email protected]/123" \+ -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/users/[email protected]/123',+ {+ 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/users/[email protected]/123',+ 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/users/[email protected]/123');+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/users/[email protected]/123')+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/users/[email protected]/123", 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/users/[email protected]/123")+ .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/users/[email protected]/123"))+ .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/users/[email protected]/123");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": {+ "user_id": "abc123def456",+ "identified_user_id": "[email protected]",+ "traits": {+ "name": "John Doe",+ "plan": "pro",+ "company": "Acme Inc"+ },+ "sessions": 12,+ "pageviews": 156,+ "events": 23,+ "duration": 245,+ "country": "US",+ "region": "California",+ "city": "San Francisco",+ "language": "en-US",+ "browser": "Chrome",+ "browser_version": "120.0.0",+ "operating_system": "macOS",+ "operating_system_version": "14.2",+ "device_type": "desktop",+ "screen_width": 2560,+ "screen_height": 1440,+ "first_seen": "2024-01-15T10:30:00.000Z",+ "last_seen": "2024-01-31T14:22:00.000Z",+ "linked_devices": [+ {+ "anonymous_id": "xyz789ghi012",+ "created_at": "2024-01-20T08:15:00.000Z"+ }+ ]+ }+}+```++</div>+</div>diff --git a/docs/content/docs/api/users/list.mdx b/docs/content/docs/api/users/list.mdxnew file mode 100644index 000000000..3c22705b1--- /dev/null+++ b/docs/content/docs/api/users/list.mdx@@ -0,0 +1,317 @@+---+title: Get Users+description: Returns a paginated list of users with their analytics data. Supports filtering by identified users only.+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/users+```++Returns a paginated list of users with their analytics data. Supports filtering by identified users only.++### 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) plus the following:++<TypeTable+ type={{+ page: {+ description: 'Page number (1-indexed)',+ type: 'number',+ default: 1,+ },+ page_size: {+ description: 'Number of results per page',+ type: 'number',+ default: 20,+ },+ sort_by: {+ description: 'Field to sort by',+ type: 'string',+ typeDescription: '"first_seen" | "last_seen" | "pageviews" | "sessions" | "events"',+ default: 'last_seen',+ },+ sort_order: {+ description: 'Sort direction',+ type: 'string',+ typeDescription: '"asc" | "desc"',+ default: 'desc',+ },+ identified_only: {+ description: 'Only return users with a custom identified_user_id',+ type: 'string',+ typeDescription: '"true" | "false"',+ default: 'false',+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of user objects',+ type: 'User[]',+ },+ totalCount: {+ description: 'Total number of users across all pages',+ type: 'number',+ },+ page: {+ description: 'Current page number',+ type: 'number',+ },+ pageSize: {+ description: 'Number of results per page',+ type: 'number',+ },+ }}+/>++#### User Object++<TypeTable+ type={{+ user_id: {+ description: 'Device fingerprint identifier',+ type: 'string',+ },+ identified_user_id: {+ description: 'Custom user ID when identified, empty string otherwise',+ type: 'string',+ },+ traits: {+ description: 'Custom user traits/properties',+ type: 'object | null',+ },+ country: {+ description: 'Country code',+ type: 'string',+ },+ region: {+ description: 'Region/state',+ type: 'string',+ },+ city: {+ description: 'City name',+ type: 'string',+ },+ language: {+ description: 'Browser language',+ type: 'string',+ },+ browser: {+ description: 'Browser name',+ type: 'string',+ },+ operating_system: {+ description: 'Operating system name',+ type: 'string',+ },+ device_type: {+ description: 'Device type (desktop, mobile, tablet)',+ type: 'string',+ },+ pageviews: {+ description: 'Total pageviews by this user',+ type: 'number',+ },+ events: {+ description: 'Total custom events by this user',+ type: 'number',+ },+ sessions: {+ description: 'Total sessions by this user',+ type: 'number',+ },+ hostname: {+ description: 'First hostname visited',+ type: 'string',+ },+ first_seen: {+ description: 'First activity timestamp',+ type: 'string',+ typeDescription: 'ISO 8601 datetime',+ },+ last_seen: {+ description: 'Most recent activity timestamp',+ type: 'string',+ 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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc" \+ -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/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc',+ {+ 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/1/users23',+ params={+ 'page': 1,+ 'page_size': 10,+ 'sort_by': 'last_seen',+ 'sort_order': 'desc'+ },+ 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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc');+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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc')+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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc", 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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc")+ .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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc"))+ .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/1/users?page=1&page_size=10&sort_by=last_seen&sort_order=desc");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "user_id": "abc123def456",+ "identified_user_id": "[email protected]",+ "traits": {+ "plan": "pro",+ "company": "Acme Inc"+ },+ "country": "US",+ "region": "California",+ "city": "San Francisco",+ "language": "en-US",+ "browser": "Chrome",+ "operating_system": "macOS",+ "device_type": "desktop",+ "pageviews": 156,+ "events": 23,+ "sessions": 12,+ "hostname": "example.com",+ "first_seen": "2024-01-15T10:30:00.000Z",+ "last_seen": "2024-01-31T14:22:00.000Z"+ }+ ],+ "totalCount": 1247,+ "page": 1,+ "pageSize": 10+}+```++</div>+</div>diff --git a/docs/content/docs/api/users/meta.json b/docs/content/docs/api/users/meta.jsonnew file mode 100644index 000000000..305cc4786--- /dev/null+++ b/docs/content/docs/api/users/meta.json@@ -0,0 +1,4 @@+{+ "title": "Users",+ "pages": ["list", "session-count", "info"]+}diff --git a/docs/content/docs/api/users/session-count.mdx b/docs/content/docs/api/users/session-count.mdxnew file mode 100644index 000000000..79fc11f10--- /dev/null+++ b/docs/content/docs/api/users/session-count.mdx@@ -0,0 +1,219 @@+---+title: Get User Session Count+description: Returns the number of sessions per day for a specific user. Useful for visualizing user engagement 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/users/session-count+```++Returns the number of sessions per day for a specific user. Useful for visualizing user engagement over time.++### Path Parameters++<TypeTable+ type={{+ site: {+ description: 'Site ID or site identifier',+ type: 'string | number',+ required: true,+ },+ }}+/>++### Query Parameters++<TypeTable+ type={{+ user_id: {+ description: 'User ID (device fingerprint or identified user ID)',+ type: 'string',+ required: true,+ },+ time_zone: {+ description: 'Timezone for date grouping',+ type: 'string',+ default: 'UTC',+ typeDescription: 'IANA timezone (e.g., "America/New_York")',+ },+ }}+/>++### Response++<TypeTable+ type={{+ data: {+ description: 'Array of daily session counts',+ type: 'DailyCount[]',+ },+ }}+/>++#### DailyCount Object++<TypeTable+ type={{+ date: {+ description: 'Date',+ type: 'string',+ typeDescription: 'YYYY-MM-DD format',+ },+ sessions: {+ description: 'Number of sessions on this date',+ 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/1/users/session-count?user_id=abc123def456&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/1/users/session-count?user_id=abc123def456&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/1/users/session-count',+ params={+ 'user_id': 'abc123def456',+ '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/1/users/session-count?user_id=abc123def456&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/1/users/session-count?user_id=abc123def456&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/1/users/session-count?user_id=abc123def456&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/1/users/session-count?user_id=abc123def456&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/1/users/session-count?user_id=abc123def456&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/1/users/session-count?user_id=abc123def456&time_zone=America/New_York");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "data": [+ {+ "date": "2024-01-15",+ "sessions": 2+ },+ {+ "date": "2024-01-18",+ "sessions": 1+ },+ {+ "date": "2024-01-22",+ "sessions": 3+ },+ {+ "date": "2024-01-31",+ "sessions": 1+ }+ ]+}+```++</div>+</div>diff --git a/docs/source.config.ts b/docs/source.config.tsindex f11de3762..32ece145e 100644--- a/docs/source.config.ts+++ b/docs/source.config.ts@@ -9,6 +9,10 @@ import { z } from 'zod';export const { docs, meta } = defineDocs({dir: 'content/docs',docs: {+ // `method` powers the HTTP verb badge shown next to API endpoints in the sidebar+ schema: frontmatterSchema.extend({+ method: z.enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH']).optional(),+ }),postprocess: {includeProcessedMarkdown: true,},diff --git a/docs/src/components/ApiMethodBadge.tsx b/docs/src/components/ApiMethodBadge.tsxnew file mode 100644index 000000000..2716453ba--- /dev/null+++ b/docs/src/components/ApiMethodBadge.tsx@@ -0,0 +1,43 @@+import type { ReactNode } from 'react';++/**+ * Text color per HTTP verb, mirroring the inline badges used inside the API docs.+ * The sidebar badge is text-only (no pill) to stay compact, matching the+ * fumadocs-openapi look.+ */+const METHOD_COLORS: Record<string, string> = {+ GET: 'text-green-600 dark:text-green-400',+ POST: 'text-blue-600 dark:text-blue-400',+ PUT: 'text-amber-600 dark:text-amber-400',+ PATCH: 'text-amber-600 dark:text-amber-400',+ DELETE: 'text-red-600 dark:text-red-400',+};++/**+ * Sidebar label for an API endpoint page: the page name on the left and the+ * HTTP method as a colored badge on the right. Used by the page-tree+ * transformer in `src/lib/source.ts`. Server-safe (no client hooks) so it can+ * be embedded in the page tree and serialized.+ */+export function ApiSidebarLabel({+ method,+ children,+}: {+ method?: string;+ children: ReactNode;+}) {+ if (!method) return <>{children}</>;++ return (+ <span className="inline-flex w-full items-center justify-between gap-2">+ <span className="truncate">{children}</span>+ <span+ className={`shrink-0 font-mono text-[10px] font-bold tracking-wider ${+ METHOD_COLORS[method] ?? 'text-fd-muted-foreground'+ }`}+ >+ {method}+ </span>+ </span>+ );+}diff --git a/docs/src/lib/source.ts b/docs/src/lib/source.tsindex cf082ffa9..400308bbd 100644--- a/docs/src/lib/source.ts+++ b/docs/src/lib/source.ts@@ -1,3 +1,4 @@+import { ApiSidebarLabel } from '@/components/ApiMethodBadge';import { docs, meta } from '@/.source';import { InferPageType, loader } from 'fumadocs-core/source';import { toFumadocsSource } from 'fumadocs-mdx/runtime/server';@@ -16,6 +17,29 @@ export const source = loader({return createElement(icons[icon as keyof typeof icons]);}},+ pageTree: {+ // Append an HTTP method badge to sidebar items whose page has a `method`+ // frontmatter field (the API endpoint pages).+ transformers: [+ {+ file(node, filePath) {+ if (!filePath) return node;+ const file = this.storage.read(filePath);+ const method =+ file?.format === 'page'+ ? (file.data as { method?: string }).method+ : undefined;+ if (method) {+ node.name = createElement(ApiSidebarLabel, {+ method,+ children: node.name,+ });+ }+ return node;+ },+ },+ ],+ },source: toFumadocsSource(docs, meta),});