curl --request PATCH \
--url https://api.braintrust.dev/v1/organization/members \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"invite_users": {
"ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"emails": [
"<string>"
],
"service_accounts": [
{
"name": "<string>",
"token_name": "<string>"
}
],
"send_invite_emails": true,
"group_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"group_names": [
"<string>"
],
"group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"group_name": "<string>"
},
"remove_users": {
"ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"emails": [
"<string>"
]
},
"org_name": "<string>",
"org_id": "<string>"
}
'import requests
url = "https://api.braintrust.dev/v1/organization/members"
payload = {
"invite_users": {
"ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"emails": ["<string>"],
"service_accounts": [
{
"name": "<string>",
"token_name": "<string>"
}
],
"send_invite_emails": True,
"group_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"group_names": ["<string>"],
"group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"group_name": "<string>"
},
"remove_users": {
"ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"emails": ["<string>"]
},
"org_name": "<string>",
"org_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
invite_users: {
ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
emails: ['<string>'],
service_accounts: [{name: '<string>', token_name: '<string>'}],
send_invite_emails: true,
group_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
group_names: ['<string>'],
group_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
group_name: '<string>'
},
remove_users: {ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'], emails: ['<string>']},
org_name: '<string>',
org_id: '<string>'
})
};
fetch('https://api.braintrust.dev/v1/organization/members', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.braintrust.dev/v1/organization/members",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'invite_users' => [
'ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'emails' => [
'<string>'
],
'service_accounts' => [
[
'name' => '<string>',
'token_name' => '<string>'
]
],
'send_invite_emails' => true,
'group_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'group_names' => [
'<string>'
],
'group_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'group_name' => '<string>'
],
'remove_users' => [
'ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'emails' => [
'<string>'
]
],
'org_name' => '<string>',
'org_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.braintrust.dev/v1/organization/members"
payload := strings.NewReader("{\n \"invite_users\": {\n \"ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"emails\": [\n \"<string>\"\n ],\n \"service_accounts\": [\n {\n \"name\": \"<string>\",\n \"token_name\": \"<string>\"\n }\n ],\n \"send_invite_emails\": true,\n \"group_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"group_names\": [\n \"<string>\"\n ],\n \"group_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"group_name\": \"<string>\"\n },\n \"remove_users\": {\n \"ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"emails\": [\n \"<string>\"\n ]\n },\n \"org_name\": \"<string>\",\n \"org_id\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.braintrust.dev/v1/organization/members")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"invite_users\": {\n \"ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"emails\": [\n \"<string>\"\n ],\n \"service_accounts\": [\n {\n \"name\": \"<string>\",\n \"token_name\": \"<string>\"\n }\n ],\n \"send_invite_emails\": true,\n \"group_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"group_names\": [\n \"<string>\"\n ],\n \"group_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"group_name\": \"<string>\"\n },\n \"remove_users\": {\n \"ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"emails\": [\n \"<string>\"\n ]\n },\n \"org_name\": \"<string>\",\n \"org_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.braintrust.dev/v1/organization/members")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"invite_users\": {\n \"ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"emails\": [\n \"<string>\"\n ],\n \"service_accounts\": [\n {\n \"name\": \"<string>\",\n \"token_name\": \"<string>\"\n }\n ],\n \"send_invite_emails\": true,\n \"group_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"group_names\": [\n \"<string>\"\n ],\n \"group_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"group_name\": \"<string>\"\n },\n \"remove_users\": {\n \"ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"emails\": [\n \"<string>\"\n ]\n },\n \"org_name\": \"<string>\",\n \"org_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"org_id": "<string>",
"send_email_error": "<string>",
"added_users": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "<string>",
"api_key": "<string>",
"token_name": "<string>"
}
]
}"<string>""<string>""<string>""<string>""<string>"Modify organization membership
Add or remove members, create service accounts.
curl --request PATCH \
--url https://api.braintrust.dev/v1/organization/members \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"invite_users": {
"ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"emails": [
"<string>"
],
"service_accounts": [
{
"name": "<string>",
"token_name": "<string>"
}
],
"send_invite_emails": true,
"group_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"group_names": [
"<string>"
],
"group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"group_name": "<string>"
},
"remove_users": {
"ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"emails": [
"<string>"
]
},
"org_name": "<string>",
"org_id": "<string>"
}
'import requests
url = "https://api.braintrust.dev/v1/organization/members"
payload = {
"invite_users": {
"ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"emails": ["<string>"],
"service_accounts": [
{
"name": "<string>",
"token_name": "<string>"
}
],
"send_invite_emails": True,
"group_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"group_names": ["<string>"],
"group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"group_name": "<string>"
},
"remove_users": {
"ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"emails": ["<string>"]
},
"org_name": "<string>",
"org_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
invite_users: {
ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
emails: ['<string>'],
service_accounts: [{name: '<string>', token_name: '<string>'}],
send_invite_emails: true,
group_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
group_names: ['<string>'],
group_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
group_name: '<string>'
},
remove_users: {ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'], emails: ['<string>']},
org_name: '<string>',
org_id: '<string>'
})
};
fetch('https://api.braintrust.dev/v1/organization/members', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.braintrust.dev/v1/organization/members",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'invite_users' => [
'ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'emails' => [
'<string>'
],
'service_accounts' => [
[
'name' => '<string>',
'token_name' => '<string>'
]
],
'send_invite_emails' => true,
'group_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'group_names' => [
'<string>'
],
'group_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'group_name' => '<string>'
],
'remove_users' => [
'ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'emails' => [
'<string>'
]
],
'org_name' => '<string>',
'org_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.braintrust.dev/v1/organization/members"
payload := strings.NewReader("{\n \"invite_users\": {\n \"ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"emails\": [\n \"<string>\"\n ],\n \"service_accounts\": [\n {\n \"name\": \"<string>\",\n \"token_name\": \"<string>\"\n }\n ],\n \"send_invite_emails\": true,\n \"group_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"group_names\": [\n \"<string>\"\n ],\n \"group_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"group_name\": \"<string>\"\n },\n \"remove_users\": {\n \"ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"emails\": [\n \"<string>\"\n ]\n },\n \"org_name\": \"<string>\",\n \"org_id\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.braintrust.dev/v1/organization/members")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"invite_users\": {\n \"ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"emails\": [\n \"<string>\"\n ],\n \"service_accounts\": [\n {\n \"name\": \"<string>\",\n \"token_name\": \"<string>\"\n }\n ],\n \"send_invite_emails\": true,\n \"group_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"group_names\": [\n \"<string>\"\n ],\n \"group_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"group_name\": \"<string>\"\n },\n \"remove_users\": {\n \"ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"emails\": [\n \"<string>\"\n ]\n },\n \"org_name\": \"<string>\",\n \"org_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.braintrust.dev/v1/organization/members")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"invite_users\": {\n \"ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"emails\": [\n \"<string>\"\n ],\n \"service_accounts\": [\n {\n \"name\": \"<string>\",\n \"token_name\": \"<string>\"\n }\n ],\n \"send_invite_emails\": true,\n \"group_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"group_names\": [\n \"<string>\"\n ],\n \"group_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"group_name\": \"<string>\"\n },\n \"remove_users\": {\n \"ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"emails\": [\n \"<string>\"\n ]\n },\n \"org_name\": \"<string>\",\n \"org_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"org_id": "<string>",
"send_email_error": "<string>",
"added_users": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "<string>",
"api_key": "<string>",
"token_name": "<string>"
}
]
}"<string>""<string>""<string>""<string>""<string>"Authorizations
Most Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.
Body
Members to add/remove
Users to invite to the organization
Show child attributes
Show child attributes
Users to remove from the organization
Show child attributes
Show child attributes
For nearly all users, this parameter should be unnecessary. But in the rare case that your API key belongs to multiple organizations, or in case you want to explicitly assert the organization you are modifying, you may specify the name of the organization.
For nearly all users, this parameter should be unnecessary. But in the rare case that your API key belongs to multiple organizations, or in case you want to explicitly assert the organization you are modifying, you may specify the id of the organization.
Response
A success status
success The id of the org that was modified.
If invite emails failed to send for some reason, the patch operation will still complete, but we will return an error message here
If service accounts with tokens were created, this will contain the added users with their API keys
Show child attributes
Show child attributes
Was this page helpful?