Organizations

Add Organization Member

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. You cannot assign a role above your own.

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. You cannot assign a role above your own.

Call this with your dashboard session or a personal API key; keys need the org:write scope. An organization API key passes the role check but has no user behind it, so the request returns 401.

Path Parameters

Prop

Type

Request Body

Prop

Type

Response

Returns 201 with a success message when the user is added.

Prop

Type

Error Responses

Prop

Type

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": "newuser@example.com", "role": "member"}'
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: 'newuser@example.com',
      role: 'member'
    })
  }
);

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

organization_id = 'org_123'
response = requests.post(
    f'https://app.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://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' => '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://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: '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://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)
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": "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://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());
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://app.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 (403 - Not an admin)
{
  "error": "Insufficient role",
  "code": "FORBIDDEN",
  "message": "Insufficient role",
  "resolution": "Use a credential with the required scope and Site or Organization access.",
  "required": "admin"
}

Every error body also carries code, message and resolution; see Error Responses.