Python
import requests
url = "https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/"
payload = {
"email": "<string>",
"role": "<string>"
}
headers = {
"Authorization": "Token <api-key>",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Token <api-key>', 'Content-Type': 'application/json'},
body: '{"email":"<string>","role":"<string>"}'
};
fetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));curl --request POST \
--url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/ \
--header 'Authorization: Token <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"email": "<string>",
"role": "<string>"
}'package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/"
payload := strings.NewReader("{
\"email\": \"<string>\",
\"role\": \"<string>\"
}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Token <api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{
\"email\": \"<string>\",
\"role\": \"<string>\"
}",
CURLOPT_HTTPHEADER => [
"Authorization: Token <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/")
.header("Authorization", "Token <api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"role\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "User added to the organization."
}{
"errors": {}
}{
"message": "Organization not found"
}Organizations
Add Member
Add a new member to an organization with a specified role such as READER or OWNER access level.
POST
/
api
/
v1
/
orgs
/
organizations
/
{org_id}
/
members
/
Python
import requests
url = "https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/"
payload = {
"email": "<string>",
"role": "<string>"
}
headers = {
"Authorization": "Token <api-key>",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Token <api-key>', 'Content-Type': 'application/json'},
body: '{"email":"<string>","role":"<string>"}'
};
fetch('https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));curl --request POST \
--url https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/ \
--header 'Authorization: Token <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"email": "<string>",
"role": "<string>"
}'package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/"
payload := strings.NewReader("{
\"email\": \"<string>\",
\"role\": \"<string>\"
}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Token <api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{
\"email\": \"<string>\",
\"role\": \"<string>\"
}",
CURLOPT_HTTPHEADER => [
"Authorization: Token <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/")
.header("Authorization", "Token <api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/api/v1/orgs/organizations/{org_id}/members/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"role\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "User added to the organization."
}{
"errors": {}
}{
"message": "Organization not found"
}The API provides two roles for organization members:
READER: Allows viewing of organization resources.OWNER: Grants full administrative access to manage the organization and its resources.
Authorizations
API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'
Path Parameters
Unique identifier of the organization.
Body
application/json
Response
Member added successfully.
Example:
"User added to the organization."
Was this page helpful?
⌘I