Organizations

Create Site

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

POST /api/organizations/:organizationId/sites

Creates a new site within an organization. Requires admin or owner role in the organization; API keys need the sites:write scope.

Path Parameters

Prop

Type

Request Body

Prop

Type

Response

Returns 201 with the created site object, including the assigned siteId. type is null for web sites.

Prop

Type

Error Responses

Prop

Type

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}'
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();
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()
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);
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)
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)
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?;
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());
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();
Response (201)
{
  "siteId": 456,
  "id": "a1b2c3d4e5f6",
  "type": null,
  "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,
  "trackUrlFragments": false,
  "trackInitialPageView": true,
  "trackSpaNavigation": true,
  "trackIp": false,
  "trackButtonClicks": false,
  "trackCopy": false,
  "trackFormInteractions": false,
  "tags": []
}