🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Update API documentation to include additional pages for API Keys and Organizations
Bill Yang1dd59d8958b7
diff --git a/docs/content/docs/api/api-keys/delete.mdx b/docs/content/docs/api/api-keys/delete.mdxnew file mode 100644index 000000000..c0b3dcce7--- /dev/null+++ b/docs/content/docs/api/api-keys/delete.mdx@@ -0,0 +1,205 @@+---+title: Delete API Key+description: Revoke an API key by its id.+full: true+method: POST+---++import { Callout } from 'fumadocs-ui/components/callout';+import { TypeTable } from 'fumadocs-ui/components/type-table';+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';++<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">+<div>++```+POST /api/auth/api-key/delete+```++Revokes (deletes) an existing API key. The key is identified by its `keyId`.++<Callout type="warn">This endpoint uses **POST**, not HTTP DELETE. Revoking a key is immediate and permanent — any client still using it will start receiving 401 responses.</Callout>++<Callout type="warn">This endpoint authenticates with your logged-in dashboard **session**, not an API key. Send your session cookie with the request.</Callout>++### Request Body++<TypeTable+ type={{+ keyId: {+ description: 'The id of the API key to delete',+ type: 'string',+ required: true,+ },+ }}+/>++### Response++Returns a success flag.++<TypeTable+ type={{+ success: {+ description: 'Indicates the API key was successfully 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 POST "https://app.rybbit.io/api/auth/api-key/delete" \+ -H "Cookie: better-auth.session_token=YOUR_SESSION_TOKEN" \+ -H "Content-Type: application/json" \+ -d '{"keyId": "key_8f3a1b2c4d5e6f7g"}'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const response = await fetch(+ 'https://app.rybbit.io/api/auth/api-key/delete',+ {+ method: 'POST',+ credentials: 'include',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ keyId: 'key_8f3a1b2c4d5e6f7g'+ })+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++response = requests.post(+ 'https://app.rybbit.io/api/auth/api-key/delete',+ json={+ 'keyId': 'key_8f3a1b2c4d5e6f7g'+ },+ headers={+ 'Cookie': 'better-auth.session_token=YOUR_SESSION_TOKEN'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/auth/api-key/delete");+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);+curl_setopt($ch, CURLOPT_POST, true);+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([+ 'keyId' => 'key_8f3a1b2c4d5e6f7g'+]));+curl_setopt($ch, CURLOPT_HTTPHEADER, [+ 'Cookie: better-auth.session_token=YOUR_SESSION_TOKEN',+ 'Content-Type: application/json'+]);++$response = curl_exec($ch);+curl_close($ch);++$data = json_decode($response, true);+```+ </Tab>+ <Tab value="Ruby">+```ruby title="Request"+require 'net/http'+require 'json'++uri = URI("https://app.rybbit.io/api/auth/api-key/delete")+req = Net::HTTP::Post.new(uri)+req['Cookie'] = 'better-auth.session_token=YOUR_SESSION_TOKEN'+req['Content-Type'] = 'application/json'+req.body = {+ keyId: 'key_8f3a1b2c4d5e6f7g'+}.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(`{+ "keyId": "key_8f3a1b2c4d5e6f7g"+}`))+req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/auth/api-key/delete", body)+req.Header.Set("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+req.Header.Set("Content-Type", "application/json")++client := &http.Client{}+resp, _ := client.Do(req)+defer resp.Body.Close()++var data map[string]interface{}+json.NewDecoder(resp.Body).Decode(&data)+```+ </Tab>+ <Tab value="Rust">+```rust title="Request"+let client = reqwest::Client::new();+let res = client+ .post("https://app.rybbit.io/api/auth/api-key/delete")+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+ .json(&serde_json::json!({+ "keyId": "key_8f3a1b2c4d5e6f7g"+ }))+ .send()+ .await?;++let data: serde_json::Value = res.json().await?;+```+ </Tab>+ <Tab value="Java">+```java title="Request"+HttpClient client = HttpClient.newHttpClient();+String json = "{\"keyId\": \"key_8f3a1b2c4d5e6f7g\"}";+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/auth/api-key/delete"))+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+ .header("Content-Type", "application/json")+ .POST(HttpRequest.BodyPublishers.ofString(json))+ .build();++HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());+```+ </Tab>+ <Tab value=".NET">+```csharp title="Request"+using var client = new HttpClient();+client.DefaultRequestHeaders.Add("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN");++var content = new StringContent(+ "{\"keyId\": \"key_8f3a1b2c4d5e6f7g\"}",+ Encoding.UTF8,+ "application/json"+);++var response = await client.PostAsync("https://app.rybbit.io/api/auth/api-key/delete", content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "success": true+}+```++</div>+</div>diff --git a/docs/content/docs/api/api-keys/list.mdx b/docs/content/docs/api/api-keys/list.mdxnew file mode 100644index 000000000..5fb4c2834--- /dev/null+++ b/docs/content/docs/api/api-keys/list.mdx@@ -0,0 +1,298 @@+---+title: List API Keys+description: List the API keys for your account or organization.+full: true+method: GET+---++import { Callout } from 'fumadocs-ui/components/callout';+import { TypeTable } from 'fumadocs-ui/components/type-table';+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';++<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">+<div>++```+GET /api/auth/api-key/list+```++Returns all API keys owned by the authenticated user, or by a specific organization.++<Callout type="warn">This endpoint authenticates with your logged-in dashboard **session**, not an API key. Send your session cookie with the request.</Callout>++### Query Parameters++<TypeTable+ type={{+ organizationId: {+ description: 'Organization ID. If provided, returns organization-owned keys instead of your user-owned keys.',+ type: 'string',+ required: false,+ },+ limit: {+ description: 'Maximum number of keys to return.',+ type: 'number',+ required: false,+ },+ offset: {+ description: 'Number of keys to skip.',+ type: 'number',+ required: false,+ },+ sortBy: {+ description: 'Field to sort by (e.g. createdAt, name, expiresAt).',+ type: 'string',+ required: false,+ },+ sortDirection: {+ description: 'Sort direction.',+ type: "'asc' | 'desc'",+ required: false,+ },+ }}+/>++### Response++<TypeTable+ type={{+ apiKeys: {+ description: 'Array of API key objects.',+ type: 'ApiKey[]',+ },+ total: {+ description: 'Total number of matching keys.',+ type: 'number',+ },+ limit: {+ description: 'The limit that was applied.',+ type: 'number | null',+ },+ offset: {+ description: 'The offset that was applied.',+ type: 'number | null',+ },+ }}+/>++#### ApiKey Object++<TypeTable+ type={{+ id: {+ description: "The key's identifier",+ type: 'string',+ },+ name: {+ description: 'The label for the key',+ type: 'string | null',+ },+ start: {+ description: 'Non-secret leading characters of the key, for display',+ type: 'string | null',+ },+ prefix: {+ description: 'The key prefix',+ type: 'string | null',+ },+ userId: {+ description: 'ID of the user that owns the key',+ type: 'string',+ },+ enabled: {+ description: 'Whether the key is currently enabled',+ type: 'boolean',+ },+ expiresAt: {+ description: 'Expiration timestamp, or null if it never expires',+ type: 'string | null',+ },+ createdAt: {+ description: 'Creation timestamp',+ type: 'string',+ },+ updatedAt: {+ description: 'Last update timestamp',+ type: 'string',+ },+ rateLimitEnabled: {+ description: 'Whether rate limiting is enabled',+ type: 'boolean',+ },+ rateLimitMax: {+ description: 'Requests allowed per window',+ type: 'number | null',+ },+ rateLimitTimeWindow: {+ description: 'Window length in milliseconds',+ type: 'number | null',+ },+ requestCount: {+ description: 'Requests made in the current rate-limit window',+ type: 'number',+ },+ remaining: {+ description: 'Remaining requests, or null if not limited by count',+ type: 'number | null',+ },+ lastRequest: {+ description: 'Timestamp of the most recent request',+ type: 'string | null',+ },+ metadata: {+ description: 'Extra metadata stored on the key',+ type: 'object | null',+ },+ permissions: {+ description: 'Permissions associated with the key',+ type: 'object | 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/auth/api-key/list?limit=20" \+ -H "Cookie: better-auth.session_token=YOUR_SESSION_TOKEN"+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const response = await fetch(+ 'https://app.rybbit.io/api/auth/api-key/list?limit=20',+ {+ method: 'GET',+ credentials: 'include'+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++response = requests.get(+ 'https://app.rybbit.io/api/auth/api-key/list?limit=20',+ headers={+ 'Cookie': 'better-auth.session_token=YOUR_SESSION_TOKEN'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/auth/api-key/list?limit=20");+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);+curl_setopt($ch, CURLOPT_HTTPHEADER, [+ 'Cookie: better-auth.session_token=YOUR_SESSION_TOKEN'+]);++$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/auth/api-key/list?limit=20")+req = Net::HTTP::Get.new(uri)+req['Cookie'] = 'better-auth.session_token=YOUR_SESSION_TOKEN'++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/auth/api-key/list?limit=20", nil)+req.Header.Set("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")++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/auth/api-key/list?limit=20")+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+ .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/auth/api-key/list?limit=20"))+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+ .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("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN");++var response = await client.GetAsync("https://app.rybbit.io/api/auth/api-key/list?limit=20");+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++<Callout>The secret key value is only returned once, at creation. This endpoint returns the non-secret `start`/`prefix` for display, never the full key.</Callout>++```json title="Response"+{+ "apiKeys": [+ {+ "id": "key_8f3a1b2c4d5e6f7g",+ "name": "CI pipeline",+ "start": "rybbit_sk_live_xxxx",+ "prefix": "rybbit_sk_live_",+ "userId": "user_2a9b8c7d6e5f4g3h",+ "enabled": true,+ "expiresAt": "2026-07-25T12:00:00.000Z",+ "createdAt": "2026-06-25T12:00:00.000Z",+ "updatedAt": "2026-06-25T12:00:00.000Z",+ "rateLimitEnabled": true,+ "rateLimitMax": 200,+ "rateLimitTimeWindow": 60000,+ "requestCount": 42,+ "remaining": null,+ "lastRequest": "2026-06-25T13:30:00.000Z",+ "metadata": null,+ "permissions": null+ }+ ],+ "total": 1,+ "limit": 20,+ "offset": 0+}+```++</div>+</div>diff --git a/docs/content/docs/api/api-keys/meta.json b/docs/content/docs/api/api-keys/meta.jsonindex 179df0c94..f0d594fa7 100644--- a/docs/content/docs/api/api-keys/meta.json+++ b/docs/content/docs/api/api-keys/meta.json@@ -1,4 +1,4 @@{"title": "API Keys",- "pages": ["create"]+ "pages": ["create", "list", "update", "delete"]}diff --git a/docs/content/docs/api/api-keys/update.mdx b/docs/content/docs/api/api-keys/update.mdxnew file mode 100644index 000000000..b90020950--- /dev/null+++ b/docs/content/docs/api/api-keys/update.mdx@@ -0,0 +1,294 @@+---+title: Update API Key+description: Update an existing API key's name, enabled state, or expiry.+full: true+method: POST+---++import { Callout } from 'fumadocs-ui/components/callout';+import { TypeTable } from 'fumadocs-ui/components/type-table';+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';++<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">+<div>++```+POST /api/auth/api-key/update+```++<Callout>This endpoint uses **POST**, not PUT or PATCH.</Callout>++Updates mutable fields on an existing API key. The key is identified by its `keyId`.++<Callout type="warn">This endpoint authenticates with your logged-in dashboard **session**, not an API key. Send your session cookie with the request.</Callout>++### Request Body++<TypeTable+ type={{+ keyId: {+ description: 'The id of the API key to update',+ type: 'string',+ required: true,+ },+ name: {+ description: 'A new label for the key',+ type: 'string',+ required: false,+ },+ enabled: {+ description: 'Enable or disable the key',+ type: 'boolean',+ required: false,+ },+ expiresIn: {+ description: 'New expiry in seconds from now. Pass null to make the key never expire.',+ type: 'number | null',+ required: false,+ },+ rateLimitEnabled: {+ description: 'Enable or disable rate limiting on the key',+ type: 'boolean',+ required: false,+ },+ }}+/>++### Response++Returns the updated API key object (without the secret key value).++<TypeTable+ type={{+ id: {+ description: "The key's identifier",+ type: 'string',+ },+ name: {+ description: 'The label for the key',+ type: 'string | null',+ },+ start: {+ description: 'Non-secret leading characters of the key, for display',+ type: 'string | null',+ },+ prefix: {+ description: 'The key prefix',+ type: 'string | null',+ },+ userId: {+ description: 'ID of the user that owns the key',+ type: 'string',+ },+ enabled: {+ description: 'Whether the key is currently enabled',+ type: 'boolean',+ },+ expiresAt: {+ description: 'Expiration timestamp, or null if it never expires',+ type: 'string | null',+ },+ createdAt: {+ description: 'Creation timestamp',+ type: 'string',+ },+ updatedAt: {+ description: 'Last update timestamp',+ type: 'string',+ },+ rateLimitEnabled: {+ description: 'Whether rate limiting is enabled',+ type: 'boolean',+ },+ rateLimitMax: {+ description: 'Requests allowed per window',+ type: 'number | null',+ },+ rateLimitTimeWindow: {+ description: 'Window length in milliseconds',+ type: 'number | null',+ },+ }}+/>++**Note:** Additional fields may be present in the response object.++</div>+<div className="flex flex-col gap-4">++<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>+ <Tab value="cURL">+```bash title="Request"+curl -X POST "https://app.rybbit.io/api/auth/api-key/update" \+ -H "Cookie: better-auth.session_token=YOUR_SESSION_TOKEN" \+ -H "Content-Type: application/json" \+ -d '{"keyId": "key_8f3a1b2c4d5e6f7g", "name": "CI pipeline (rotated)", "enabled": true}'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const response = await fetch(+ 'https://app.rybbit.io/api/auth/api-key/update',+ {+ method: 'POST',+ credentials: 'include',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ keyId: 'key_8f3a1b2c4d5e6f7g',+ name: 'CI pipeline (rotated)',+ enabled: true+ })+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++response = requests.post(+ 'https://app.rybbit.io/api/auth/api-key/update',+ json={+ 'keyId': 'key_8f3a1b2c4d5e6f7g',+ 'name': 'CI pipeline (rotated)',+ 'enabled': True+ },+ headers={+ 'Cookie': 'better-auth.session_token=YOUR_SESSION_TOKEN'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/auth/api-key/update");+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);+curl_setopt($ch, CURLOPT_POST, true);+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([+ 'keyId' => 'key_8f3a1b2c4d5e6f7g',+ 'name' => 'CI pipeline (rotated)',+ 'enabled' => true+]));+curl_setopt($ch, CURLOPT_HTTPHEADER, [+ 'Cookie: better-auth.session_token=YOUR_SESSION_TOKEN',+ 'Content-Type: application/json'+]);++$response = curl_exec($ch);+curl_close($ch);++$data = json_decode($response, true);+```+ </Tab>+ <Tab value="Ruby">+```ruby title="Request"+require 'net/http'+require 'json'++uri = URI("https://app.rybbit.io/api/auth/api-key/update")+req = Net::HTTP::Post.new(uri)+req['Cookie'] = 'better-auth.session_token=YOUR_SESSION_TOKEN'+req['Content-Type'] = 'application/json'+req.body = {+ keyId: 'key_8f3a1b2c4d5e6f7g',+ name: 'CI pipeline (rotated)',+ enabled: 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"+body := bytes.NewBuffer([]byte(`{+ "keyId": "key_8f3a1b2c4d5e6f7g",+ "name": "CI pipeline (rotated)",+ "enabled": true+}`))+req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/auth/api-key/update", body)+req.Header.Set("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+req.Header.Set("Content-Type", "application/json")++client := &http.Client{}+resp, _ := client.Do(req)+defer resp.Body.Close()++var data map[string]interface{}+json.NewDecoder(resp.Body).Decode(&data)+```+ </Tab>+ <Tab value="Rust">+```rust title="Request"+let client = reqwest::Client::new();+let res = client+ .post("https://app.rybbit.io/api/auth/api-key/update")+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+ .json(&serde_json::json!({+ "keyId": "key_8f3a1b2c4d5e6f7g",+ "name": "CI pipeline (rotated)",+ "enabled": true+ }))+ .send()+ .await?;++let data: serde_json::Value = res.json().await?;+```+ </Tab>+ <Tab value="Java">+```java title="Request"+HttpClient client = HttpClient.newHttpClient();+String json = "{\"keyId\": \"key_8f3a1b2c4d5e6f7g\", \"name\": \"CI pipeline (rotated)\", \"enabled\": true}";+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/auth/api-key/update"))+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+ .header("Content-Type", "application/json")+ .POST(HttpRequest.BodyPublishers.ofString(json))+ .build();++HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());+```+ </Tab>+ <Tab value=".NET">+```csharp title="Request"+using var client = new HttpClient();+client.DefaultRequestHeaders.Add("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN");++var content = new StringContent(+ "{\"keyId\": \"key_8f3a1b2c4d5e6f7g\", \"name\": \"CI pipeline (rotated)\", \"enabled\": true}",+ Encoding.UTF8,+ "application/json"+);++var response = await client.PostAsync("https://app.rybbit.io/api/auth/api-key/update", content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "id": "key_8f3a1b2c4d5e6f7g",+ "name": "CI pipeline (rotated)",+ "start": "rybbit_sk_live_xxxx",+ "prefix": "rybbit_sk_live_",+ "userId": "user_2a9b8c7d6e5f4g3h",+ "enabled": true,+ "expiresAt": "2026-07-25T12:00:00.000Z",+ "createdAt": "2026-06-25T12:00:00.000Z",+ "updatedAt": "2026-06-26T12:00:00.000Z",+ "rateLimitEnabled": true,+ "rateLimitMax": 200,+ "rateLimitTimeWindow": 60000+}+```++</div>+</div>diff --git a/docs/content/docs/api/organizations/invite-member.mdx b/docs/content/docs/api/organizations/invite-member.mdxnew file mode 100644index 000000000..3d255e0f6--- /dev/null+++ b/docs/content/docs/api/organizations/invite-member.mdx@@ -0,0 +1,281 @@+---+title: Invite Member+description: Send an organization invitation to a user by email.+full: true+method: POST+---++import { Callout } from 'fumadocs-ui/components/callout';+import { TypeTable } from 'fumadocs-ui/components/type-table';+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';++<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">+<div>++```+POST /api/auth/organization/invite-member+```++Sends an invitation email inviting a user to join an organization with a given role. (To add an existing user directly without an email invite, see Add Member.)++<Callout type="warn">This endpoint authenticates with your logged-in dashboard **session**, not an API key. Send your session cookie with the request.</Callout>++### Request Body++<TypeTable+ type={{+ email: {+ description: 'Email address of the user to invite',+ type: 'string',+ required: true,+ },+ role: {+ description: 'Role(s) to assign. One of `owner`, `admin`, `member` (or an array of roles).',+ type: 'string | string[]',+ required: true,+ },+ organizationId: {+ description: 'The organization to invite into. Defaults to your active organization.',+ type: 'string',+ required: false,+ },+ resend: {+ description: 'Resend the invitation if the user was already invited.',+ type: 'boolean',+ required: false,+ },+ teamId: {+ description: 'Team ID(s) to add the invited user to.',+ type: 'string | string[]',+ required: false,+ },+ hasRestrictedSiteAccess: {+ description: 'Rybbit extension: restrict the invited member to specific sites. Only valid when role is `member`.',+ type: 'boolean',+ required: false,+ },+ siteIds: {+ description: 'Rybbit extension: the site IDs the member may access when `hasRestrictedSiteAccess` is true.',+ type: 'number[]',+ required: false,+ },+ }}+/>++<Callout>`hasRestrictedSiteAccess` and `siteIds` are Rybbit-specific extensions to the invitation. Site-access restrictions can only be applied to invitations with the `member` role.</Callout>++### Response++Returns the created invitation object.++<TypeTable+ type={{+ id: {+ description: "The invitation's identifier",+ type: 'string',+ },+ email: {+ description: 'Invited email address',+ type: 'string',+ },+ role: {+ description: 'Assigned role',+ type: 'string',+ },+ organizationId: {+ description: 'The organization the invite is for',+ type: 'string',+ },+ inviterId: {+ description: 'ID of the user who sent the invite',+ type: 'string',+ },+ status: {+ description: 'Invitation status (e.g. pending)',+ type: 'string',+ },+ expiresAt: {+ description: 'When the invitation expires',+ type: 'string',+ },+ hasRestrictedSiteAccess: {+ description: 'Whether the member will be restricted to specific sites',+ type: 'boolean',+ },+ siteIds: {+ description: 'Site IDs the member will be allowed to access',+ type: 'number[]',+ },+ }}+/>++</div>+<div className="flex flex-col gap-4">++<Tabs items={['cURL', 'JavaScript', 'Python', 'PHP', 'Ruby', 'Go', 'Rust', 'Java', '.NET']}>+ <Tab value="cURL">+```bash title="Request"+curl -X POST "https://app.rybbit.io/api/auth/organization/invite-member" \+ -H "Cookie: better-auth.session_token=YOUR_SESSION_TOKEN" \+ -H "Content-Type: application/json" \+ -d '{"email": "[email protected]", "role": "member"}'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const response = await fetch(+ 'https://app.rybbit.io/api/auth/organization/invite-member',+ {+ method: 'POST',+ credentials: 'include',+ headers: {+ '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++response = requests.post(+ 'https://app.rybbit.io/api/auth/organization/invite-member',+ json={+ 'email': '[email protected]',+ 'role': 'member'+ },+ headers={+ 'Cookie': 'better-auth.session_token=YOUR_SESSION_TOKEN'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/auth/organization/invite-member");+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, [+ 'Cookie: better-auth.session_token=YOUR_SESSION_TOKEN',+ 'Content-Type: application/json'+]);++$response = curl_exec($ch);+curl_close($ch);++$data = json_decode($response, true);+```+ </Tab>+ <Tab value="Ruby">+```ruby title="Request"+require 'net/http'+require 'json'++uri = URI("https://app.rybbit.io/api/auth/organization/invite-member")+req = Net::HTTP::Post.new(uri)+req['Cookie'] = 'better-auth.session_token=YOUR_SESSION_TOKEN'+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"+body := bytes.NewBuffer([]byte(`{+ "email": "[email protected]",+ "role": "member"+}`))+req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/auth/organization/invite-member", body)+req.Header.Set("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+req.Header.Set("Content-Type", "application/json")++client := &http.Client{}+resp, _ := client.Do(req)+defer resp.Body.Close()++var data map[string]interface{}+json.NewDecoder(resp.Body).Decode(&data)+```+ </Tab>+ <Tab value="Rust">+```rust title="Request"+let client = reqwest::Client::new();+let res = client+ .post("https://app.rybbit.io/api/auth/organization/invite-member")+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+ .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"+HttpClient client = HttpClient.newHttpClient();+String json = "{\"email\": \"[email protected]\", \"role\": \"member\"}";+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/auth/organization/invite-member"))+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+ .header("Content-Type", "application/json")+ .POST(HttpRequest.BodyPublishers.ofString(json))+ .build();++HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());+```+ </Tab>+ <Tab value=".NET">+```csharp title="Request"+using var client = new HttpClient();+client.DefaultRequestHeaders.Add("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN");++var content = new StringContent(+ "{\"email\": \"[email protected]\", \"role\": \"member\"}",+ Encoding.UTF8,+ "application/json"+);++var response = await client.PostAsync("https://app.rybbit.io/api/auth/organization/invite-member", content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "id": "inv_4a2b...",+ "email": "[email protected]",+ "role": "member",+ "organizationId": "org_123",+ "inviterId": "user_2a9b...",+ "status": "pending",+ "expiresAt": "2026-07-03T12:00:00.000Z",+ "hasRestrictedSiteAccess": false,+ "siteIds": []+}+```++</div>+</div>diff --git a/docs/content/docs/api/organizations/meta.json b/docs/content/docs/api/organizations/meta.jsonindex 2e0135930..05c056437 100644--- a/docs/content/docs/api/organizations/meta.json+++ b/docs/content/docs/api/organizations/meta.json@@ -1,4 +1,4 @@{"title": "Organizations",- "pages": ["list", "sites", "create-site", "members", "add-member", "event-count"]+ "pages": ["list", "sites", "create-site", "members", "add-member", "invite-member", "remove-member", "update-member-role", "event-count"]}diff --git a/docs/content/docs/api/organizations/remove-member.mdx b/docs/content/docs/api/organizations/remove-member.mdxnew file mode 100644index 000000000..6ea4a0fc5--- /dev/null+++ b/docs/content/docs/api/organizations/remove-member.mdx@@ -0,0 +1,243 @@+---+title: Remove Member+description: Remove a member from an organization.+full: true+method: POST+---++import { Callout } from 'fumadocs-ui/components/callout';+import { TypeTable } from 'fumadocs-ui/components/type-table';+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';++<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">+<div>++```+POST /api/auth/organization/remove-member+```++Removes a member from an organization. The member can be identified by member ID or email.++<Callout type="warn">This endpoint uses **POST**, not HTTP DELETE. You cannot remove the only remaining owner of an organization.</Callout>++<Callout type="warn">This endpoint authenticates with your logged-in dashboard **session**, not an API key. Send your session cookie with the request.</Callout>++### Request Body++<TypeTable+ type={{+ memberIdOrEmail: {+ description: "The member's ID or email address",+ type: 'string',+ required: true,+ },+ organizationId: {+ description: 'The organization to remove from. Defaults to your active organization.',+ type: 'string',+ required: false,+ },+ }}+/>++### Response++Returns the removed member object.++<TypeTable+ type={{+ member: {+ description: 'The member that was removed',+ type: 'Member',+ },+ }}+/>++#### Member Object++<TypeTable+ type={{+ id: {+ description: "The member record's identifier",+ type: 'string',+ },+ userId: {+ description: "The underlying user's ID",+ type: 'string',+ },+ organizationId: {+ description: 'The organization the member belonged to',+ type: 'string',+ },+ role: {+ description: "The member's role",+ type: 'string',+ },+ createdAt: {+ description: 'When the membership was created',+ 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/auth/organization/remove-member" \+ -H "Cookie: better-auth.session_token=YOUR_SESSION_TOKEN" \+ -H "Content-Type: application/json" \+ -d '{"memberIdOrEmail": "[email protected]"}'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const response = await fetch(+ 'https://app.rybbit.io/api/auth/organization/remove-member',+ {+ method: 'POST',+ credentials: 'include',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ memberIdOrEmail: '[email protected]'+ })+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++response = requests.post(+ 'https://app.rybbit.io/api/auth/organization/remove-member',+ json={+ 'memberIdOrEmail': '[email protected]'+ },+ headers={+ 'Cookie': 'better-auth.session_token=YOUR_SESSION_TOKEN'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/auth/organization/remove-member");+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);+curl_setopt($ch, CURLOPT_POST, true);+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([+ 'memberIdOrEmail' => '[email protected]'+]));+curl_setopt($ch, CURLOPT_HTTPHEADER, [+ 'Cookie: better-auth.session_token=YOUR_SESSION_TOKEN',+ 'Content-Type: application/json'+]);++$response = curl_exec($ch);+curl_close($ch);++$data = json_decode($response, true);+```+ </Tab>+ <Tab value="Ruby">+```ruby title="Request"+require 'net/http'+require 'json'++uri = URI("https://app.rybbit.io/api/auth/organization/remove-member")+req = Net::HTTP::Post.new(uri)+req['Cookie'] = 'better-auth.session_token=YOUR_SESSION_TOKEN'+req['Content-Type'] = 'application/json'+req.body = {+ memberIdOrEmail: '[email protected]'+}.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(`{+ "memberIdOrEmail": "[email protected]"+}`))+req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/auth/organization/remove-member", body)+req.Header.Set("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+req.Header.Set("Content-Type", "application/json")++client := &http.Client{}+resp, _ := client.Do(req)+defer resp.Body.Close()++var data map[string]interface{}+json.NewDecoder(resp.Body).Decode(&data)+```+ </Tab>+ <Tab value="Rust">+```rust title="Request"+let client = reqwest::Client::new();+let res = client+ .post("https://app.rybbit.io/api/auth/organization/remove-member")+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+ .json(&serde_json::json!({+ "memberIdOrEmail": "[email protected]"+ }))+ .send()+ .await?;++let data: serde_json::Value = res.json().await?;+```+ </Tab>+ <Tab value="Java">+```java title="Request"+HttpClient client = HttpClient.newHttpClient();+String json = "{\"memberIdOrEmail\": \"[email protected]\"}";+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/auth/organization/remove-member"))+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+ .header("Content-Type", "application/json")+ .POST(HttpRequest.BodyPublishers.ofString(json))+ .build();++HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());+```+ </Tab>+ <Tab value=".NET">+```csharp title="Request"+using var client = new HttpClient();+client.DefaultRequestHeaders.Add("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN");++var content = new StringContent(+ "{\"memberIdOrEmail\": \"[email protected]\"}",+ Encoding.UTF8,+ "application/json"+);++var response = await client.PostAsync("https://app.rybbit.io/api/auth/organization/remove-member", content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "member": {+ "id": "mem_7c6d...",+ "userId": "user_5f4g...",+ "organizationId": "org_123",+ "role": "member",+ "createdAt": "2026-01-10T12:00:00.000Z"+ }+}+```++</div>+</div>diff --git a/docs/content/docs/api/organizations/update-member-role.mdx b/docs/content/docs/api/organizations/update-member-role.mdxnew file mode 100644index 000000000..98f75faaf--- /dev/null+++ b/docs/content/docs/api/organizations/update-member-role.mdx@@ -0,0 +1,254 @@+---+title: Update Member Role+description: Change an organization member's role.+full: true+method: POST+---++import { Callout } from 'fumadocs-ui/components/callout';+import { TypeTable } from 'fumadocs-ui/components/type-table';+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';++<div className="grid grid-cols-1 xl:grid-cols-2 gap-8">+<div>++```+POST /api/auth/organization/update-member-role+```++Updates the role(s) assigned to an existing organization member.++<Callout>This endpoint uses **POST**, not PUT or PATCH.</Callout>++<Callout type="warn">This endpoint authenticates with your logged-in dashboard **session**, not an API key. Send your session cookie with the request.</Callout>++### Request Body++<TypeTable+ type={{+ role: {+ description: 'The new role(s) to assign. One of `owner`, `admin`, `member` (or an array of roles).',+ type: 'string | string[]',+ required: true,+ },+ memberId: {+ description: 'The ID of the member to update',+ type: 'string',+ required: true,+ },+ organizationId: {+ description: 'The organization the member belongs to. Defaults to your active organization.',+ type: 'string',+ required: false,+ },+ }}+/>++### Response++Returns the updated member object.++<TypeTable+ type={{+ member: {+ description: 'The member that was updated',+ type: 'Member',+ },+ }}+/>++#### Member Object++<TypeTable+ type={{+ id: {+ description: "The member record's identifier",+ type: 'string',+ },+ userId: {+ description: "The underlying user's ID",+ type: 'string',+ },+ organizationId: {+ description: 'The organization the member belongs to',+ type: 'string',+ },+ role: {+ description: "The member's updated role",+ type: 'string',+ },+ createdAt: {+ description: 'When the membership was created',+ 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/auth/organization/update-member-role" \+ -H "Cookie: better-auth.session_token=YOUR_SESSION_TOKEN" \+ -H "Content-Type: application/json" \+ -d '{"memberId": "mem_7c6d5e4f3g2h", "role": "admin"}'+```+ </Tab>+ <Tab value="JavaScript">+```javascript title="Request"+const response = await fetch(+ 'https://app.rybbit.io/api/auth/organization/update-member-role',+ {+ method: 'POST',+ credentials: 'include',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ memberId: 'mem_7c6d5e4f3g2h',+ role: 'admin'+ })+ }+);++const data = await response.json();+```+ </Tab>+ <Tab value="Python">+```python title="Request"+import requests++response = requests.post(+ 'https://app.rybbit.io/api/auth/organization/update-member-role',+ json={+ 'memberId': 'mem_7c6d5e4f3g2h',+ 'role': 'admin'+ },+ headers={+ 'Cookie': 'better-auth.session_token=YOUR_SESSION_TOKEN'+ }+)++data = response.json()+```+ </Tab>+ <Tab value="PHP">+```php title="Request"+$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, "https://app.rybbit.io/api/auth/organization/update-member-role");+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);+curl_setopt($ch, CURLOPT_POST, true);+curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([+ 'memberId' => 'mem_7c6d5e4f3g2h',+ 'role' => 'admin'+]));+curl_setopt($ch, CURLOPT_HTTPHEADER, [+ 'Cookie: better-auth.session_token=YOUR_SESSION_TOKEN',+ 'Content-Type: application/json'+]);++$response = curl_exec($ch);+curl_close($ch);++$data = json_decode($response, true);+```+ </Tab>+ <Tab value="Ruby">+```ruby title="Request"+require 'net/http'+require 'json'++uri = URI("https://app.rybbit.io/api/auth/organization/update-member-role")+req = Net::HTTP::Post.new(uri)+req['Cookie'] = 'better-auth.session_token=YOUR_SESSION_TOKEN'+req['Content-Type'] = 'application/json'+req.body = {+ memberId: 'mem_7c6d5e4f3g2h',+ role: 'admin'+}.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(`{+ "memberId": "mem_7c6d5e4f3g2h",+ "role": "admin"+}`))+req, _ := http.NewRequest("POST", "https://app.rybbit.io/api/auth/organization/update-member-role", body)+req.Header.Set("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+req.Header.Set("Content-Type", "application/json")++client := &http.Client{}+resp, _ := client.Do(req)+defer resp.Body.Close()++var data map[string]interface{}+json.NewDecoder(resp.Body).Decode(&data)+```+ </Tab>+ <Tab value="Rust">+```rust title="Request"+let client = reqwest::Client::new();+let res = client+ .post("https://app.rybbit.io/api/auth/organization/update-member-role")+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+ .json(&serde_json::json!({+ "memberId": "mem_7c6d5e4f3g2h",+ "role": "admin"+ }))+ .send()+ .await?;++let data: serde_json::Value = res.json().await?;+```+ </Tab>+ <Tab value="Java">+```java title="Request"+HttpClient client = HttpClient.newHttpClient();+String json = "{\"memberId\": \"mem_7c6d5e4f3g2h\", \"role\": \"admin\"}";+HttpRequest request = HttpRequest.newBuilder()+ .uri(URI.create("https://app.rybbit.io/api/auth/organization/update-member-role"))+ .header("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN")+ .header("Content-Type", "application/json")+ .POST(HttpRequest.BodyPublishers.ofString(json))+ .build();++HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());+```+ </Tab>+ <Tab value=".NET">+```csharp title="Request"+using var client = new HttpClient();+client.DefaultRequestHeaders.Add("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN");++var content = new StringContent(+ "{\"memberId\": \"mem_7c6d5e4f3g2h\", \"role\": \"admin\"}",+ Encoding.UTF8,+ "application/json"+);++var response = await client.PostAsync("https://app.rybbit.io/api/auth/organization/update-member-role", content);+var data = await response.Content.ReadAsStringAsync();+```+ </Tab>+</Tabs>++```json title="Response"+{+ "member": {+ "id": "mem_7c6d5e4f3g2h",+ "userId": "user_5f4g...",+ "organizationId": "org_123",+ "role": "admin",+ "createdAt": "2026-01-10T12:00:00.000Z"+ }+}+```++</div>+</div>