BuddyStat

Remove Member

Remove a member from an organization.

POST /api/auth/organization/remove-member

Removes a member from an organization. The member can be identified by member ID or email.

This endpoint uses POST, not HTTP DELETE. You cannot remove the only remaining owner of an organization.
This endpoint authenticates with your logged-in dashboard session, not an API key. Send your session cookie with the request.

Request Body

Prop

Type

Response

Returns the removed member object.

Prop

Type

Member Object

Prop

Type

Request
curl -X POST "https://app.buddystat.com/api/auth/organization/remove-member" \
  -H "Cookie: better-auth.session_token=YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"memberIdOrEmail": "[email protected]"}'
Request
const response = await fetch(
  'https://app.buddystat.com/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();
Request
import requests

response = requests.post(
    'https://app.buddystat.com/api/auth/organization/remove-member',
    json={
        'memberIdOrEmail': '[email protected]'
    },
    headers={
        'Cookie': 'better-auth.session_token=YOUR_SESSION_TOKEN'
    }
)

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

uri = URI("https://app.buddystat.com/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)
Request
body := bytes.NewBuffer([]byte(`{
  "memberIdOrEmail": "[email protected]"
}`))
req, _ := http.NewRequest("POST", "https://app.buddystat.com/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)
Request
let client = reqwest::Client::new();
let res = client
    .post("https://app.buddystat.com/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?;
Request
HttpClient client = HttpClient.newHttpClient();
String json = "{\"memberIdOrEmail\": \"[email protected]\"}";
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://app.buddystat.com/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());
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.buddystat.com/api/auth/organization/remove-member", content);
var data = await response.Content.ReadAsStringAsync();
Response
{
  "member": {
    "id": "mem_7c6d...",
    "userId": "user_5f4g...",
    "organizationId": "org_123",
    "role": "member",
    "createdAt": "2026-01-10T12:00:00.000Z"
  }
}