Organizations
Invite Member
Send an organization invitation to a user by email.
POST /api/auth/organization/invite-memberSends 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.)
This endpoint authenticates with your logged-in dashboard session, not an API key. Send your session cookie with the request.
Request Body
Prop
Type
hasRestrictedSiteAccess and siteIds are Rybbit-specific extensions to the invitation. Site-access restrictions can only be applied to invitations with the member role.Response
Returns the created invitation object.
Prop
Type
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": "teammate@example.com", "role": "member"}'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: 'teammate@example.com',
role: 'member'
})
}
);
const data = await response.json();import requests
response = requests.post(
'https://app.rybbit.io/api/auth/organization/invite-member',
json={
'email': 'teammate@example.com',
'role': 'member'
},
headers={
'Cookie': 'better-auth.session_token=YOUR_SESSION_TOKEN'
}
)
data = response.json()$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' => 'teammate@example.com',
'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);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: 'teammate@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)body := bytes.NewBuffer([]byte(`{
"email": "teammate@example.com",
"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)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": "teammate@example.com",
"role": "member"
}))
.send()
.await?;
let data: serde_json::Value = res.json().await?;HttpClient client = HttpClient.newHttpClient();
String json = "{\"email\": \"teammate@example.com\", \"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());using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Cookie", "better-auth.session_token=YOUR_SESSION_TOKEN");
var content = new StringContent(
"{\"email\": \"teammate@example.com\", \"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();{
"id": "inv_4a2b...",
"email": "teammate@example.com",
"role": "member",
"organizationId": "org_123",
"inviterId": "user_2a9b...",
"status": "pending",
"expiresAt": "2026-07-03T12:00:00.000Z",
"hasRestrictedSiteAccess": false,
"siteIds": []
}