Rybbit
API

Organizations

Manage organizations, sites, and members

See the API Reference for authentication details.

Endpoints


Get Organization Sites

GET /api/organizations/:organizationId/sites

Returns all sites within an organization along with session counts from the last 24 hours and subscription information. Requires membership in the organization.

Path Parameters

Prop

Type

Response

Prop

Type

Site Object

Each site in the sites array contains:

Prop

Type

Subscription Object

Prop

Type

Request
curl -X GET "https://api.rybbit.io/api/organizations/org_123/sites" \
  -H "Authorization: Bearer your_api_key_here"
Request
const organizationId = 'org_123';
const response = await fetch(
  `https://api.rybbit.io/api/organizations/${organizationId}/sites`,
  {
    headers: {
      'Authorization': 'Bearer your_api_key_here'
    }
  }
);

const data = await response.json();
Request
import requests

organization_id = 'org_123'
response = requests.get(
    f'https://api.rybbit.io/api/organizations/{organization_id}/sites',
    headers={
        'Authorization': 'Bearer your_api_key_here'
    }
)

data = response.json()
Request
$organizationId = 'org_123';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.rybbit.io/api/organizations/{$organizationId}/sites");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer your_api_key_here'
]);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
Request
require 'net/http'
require 'json'

organization_id = 'org_123'
uri = URI("https://api.rybbit.io/api/organizations/#{organization_id}/sites")
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer your_api_key_here'

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)
Request
organizationId := "org_123"
req, _ := http.NewRequest("GET", "https://api.rybbit.io/api/organizations/"+organizationId+"/sites", nil)
req.Header.Set("Authorization", "Bearer your_api_key_here")

client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()

var data map[string]interface{}
json.NewDecoder(resp.Body).Decode(&data)
Request
let organization_id = "org_123";
let client = reqwest::Client::new();
let res = client
    .get(format!("https://api.rybbit.io/api/organizations/{}/sites", organization_id))
    .header("Authorization", "Bearer your_api_key_here")
    .send()
    .await?;

let data: serde_json::Value = res.json().await?;
Request
String organizationId = "org_123";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.rybbit.io/api/organizations/" + organizationId + "/sites"))
    .header("Authorization", "Bearer your_api_key_here")
    .GET()
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
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://api.rybbit.io/api/organizations/{organizationId}/sites");
var data = await response.Content.ReadAsStringAsync();
Response
{
  "organization": {
    "id": "org_123",
    "name": "Acme Inc"
  },
  "sites": [
    {
      "siteId": 456,
      "id": "site_abc123",
      "domain": "example.com",
      "name": "My Website",
      "organizationId": "org_123",
      "createdBy": "user_xyz789",
      "public": false,
      "saltUserIds": false,
      "blockBots": true,
      "sessionsLast24Hours": 1247,
      "isOwner": true
    }
  ],
  "subscription": {
    "monthlyEventCount": 45230,
    "eventLimit": 100000,
    "overMonthlyLimit": false,
    "planName": "pro",
    "status": "active",
    "isPro": true
  }
}

Create Site

POST /api/organizations/:organizationId/sites

Creates a new site within an organization. Requires admin or owner role in the organization.

Path Parameters

Prop

Type

Request Body

Prop

Type

Response

Returns the created site object with the assigned siteId.

Prop

Type

Request
curl -X POST "https://api.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}'
Request
const organizationId = 'org_123';
const response = await fetch(
  `https://api.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();
Request
import requests

organization_id = 'org_123'
response = requests.post(
    f'https://api.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()
Request
$organizationId = 'org_123';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.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);
Request
require 'net/http'
require 'json'

organization_id = 'org_123'
uri = URI("https://api.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)
Request
organizationId := "org_123"
body := bytes.NewBuffer([]byte(`{
  "domain": "example.com",
  "name": "My Website",
  "blockBots": true
}`))
req, _ := http.NewRequest("POST", "https://api.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)
Request
let organization_id = "org_123";
let client = reqwest::Client::new();
let res = client
    .post(format!("https://api.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?;
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://api.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());
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://api.rybbit.io/api/organizations/{organizationId}/sites", content);
var data = await response.Content.ReadAsStringAsync();
Response
{
  "siteId": 456,
  "id": "a1b2c3d4e5f6",
  "domain": "example.com",
  "name": "My Website",
  "organizationId": "org_123",
  "createdBy": "user_xyz789",
  "public": false,
  "saltUserIds": false,
  "blockBots": true
}

Get Organization Members

GET /api/organizations/:organizationId/members

Returns all members of an organization with their user details and roles. Requires membership in the organization.

Path Parameters

Prop

Type

Response

Prop

Type

Member Object

Each member in the data array contains:

Prop

Type

User Object

Prop

Type

Request
curl -X GET "https://api.rybbit.io/api/organizations/org_123/members" \
  -H "Authorization: Bearer your_api_key_here"
Request
const organizationId = 'org_123';
const response = await fetch(
  `https://api.rybbit.io/api/organizations/${organizationId}/members`,
  {
    headers: {
      'Authorization': 'Bearer your_api_key_here'
    }
  }
);

const data = await response.json();
Request
import requests

organization_id = 'org_123'
response = requests.get(
    f'https://api.rybbit.io/api/organizations/{organization_id}/members',
    headers={
        'Authorization': 'Bearer your_api_key_here'
    }
)

data = response.json()
Request
$organizationId = 'org_123';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.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);
Request
require 'net/http'
require 'json'

organization_id = 'org_123'
uri = URI("https://api.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)
Request
organizationId := "org_123"
req, _ := http.NewRequest("GET", "https://api.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)
Request
let organization_id = "org_123";
let client = reqwest::Client::new();
let res = client
    .get(format!("https://api.rybbit.io/api/organizations/{}/members", organization_id))
    .header("Authorization", "Bearer your_api_key_here")
    .send()
    .await?;

let data: serde_json::Value = res.json().await?;
Request
String organizationId = "org_123";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.rybbit.io/api/organizations/" + organizationId + "/members"))
    .header("Authorization", "Bearer your_api_key_here")
    .GET()
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
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://api.rybbit.io/api/organizations/{organizationId}/members");
var data = await response.Content.ReadAsStringAsync();
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": "john@example.com"
      }
    },
    {
      "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": "jane@example.com"
      }
    }
  ]
}

Add Organization Member

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

Prop

Type

Request Body

Prop

Type

Response

Returns a success message when the user is added successfully.

Prop

Type

Error Responses

Prop

Type

Request
curl -X POST "https://api.rybbit.io/api/organizations/org_123/members" \
  -H "Authorization: Bearer your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"email": "newuser@example.com", "role": "member"}'
Request
const organizationId = 'org_123';
const response = await fetch(
  `https://api.rybbit.io/api/organizations/${organizationId}/members`,
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer your_api_key_here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      email: 'newuser@example.com',
      role: 'member'
    })
  }
);

const data = await response.json();
Request
import requests

organization_id = 'org_123'
response = requests.post(
    f'https://api.rybbit.io/api/organizations/{organization_id}/members',
    json={
        'email': 'newuser@example.com',
        'role': 'member'
    },
    headers={
        'Authorization': 'Bearer your_api_key_here'
    }
)

data = response.json()
Request
$organizationId = 'org_123';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.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' => 'newuser@example.com',
    '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);
Request
require 'net/http'
require 'json'

organization_id = 'org_123'
uri = URI("https://api.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: 'newuser@example.com',
  role: 'member'
}.to_json

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)
Request
organizationId := "org_123"
body := bytes.NewBuffer([]byte(`{
  "email": "newuser@example.com",
  "role": "member"
}`))
req, _ := http.NewRequest("POST", "https://api.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)
Request
let organization_id = "org_123";
let client = reqwest::Client::new();
let res = client
    .post(format!("https://api.rybbit.io/api/organizations/{}/members", organization_id))
    .header("Authorization", "Bearer your_api_key_here")
    .json(&serde_json::json!({
        "email": "newuser@example.com",
        "role": "member"
    }))
    .send()
    .await?;

let data: serde_json::Value = res.json().await?;
Request
String organizationId = "org_123";
HttpClient client = HttpClient.newHttpClient();
String json = "{\"email\": \"newuser@example.com\", \"role\": \"member\"}";
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.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());
Request
var organizationId = "org_123";
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");

var content = new StringContent(
    "{\"email\": \"newuser@example.com\", \"role\": \"member\"}",
    Encoding.UTF8,
    "application/json"
);

var response = await client.PostAsync($"https://api.rybbit.io/api/organizations/{organizationId}/members", content);
var data = await response.Content.ReadAsStringAsync();
Response
{
  "message": "User added to organization successfully"
}
Error Response (400 - Already a Member)
{
  "error": "User is already a member of this organization"
}
Error Response (404 - User Not Found)
{
  "error": "User not found"
}
Error Response (401 - Unauthorized)
{
  "error": "Unauthorized"
}