Create Organization - Mem0

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

Python

import requests

url = "https://api.mem0.ai/api/v1/orgs/organizations/"

payload = {"name": "<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: '{"name":"<string>"}'
};

fetch('https://api.mem0.ai/api/v1/orgs/organizations/', 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/ \
  --header 'Authorization: Token <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "<string>"
}'
package main

import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

func main() {

url := "https://api.mem0.ai/api/v1/orgs/organizations/"

payload := strings.NewReader("{\n  \"name\": \"<string>\"\n}")

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))

}
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.mem0.ai/api/v1/orgs/organizations/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n  \"name\": \"<string>\"\n}",
  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}/")
  .header("Authorization", "Token <api-key>")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.mem0.ai/api/v1/orgs/organizations/")

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  \"name\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body

Sample Responses

Success Response

{
  "message": "Organization created successfully.",
  "org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}

Error Response

{
  "errors": {}
}

Authorizations

Authorization

Body

Response

Example Response

{ "message": "Organization created successfully." }