Get User Info - Barndoor Documentation
Get current user info
cURL
curl --request POST \
--url https://your-org.platform.barndoor.ai/api/identity/userinfo \
--header 'Content-Type: application/json' \
--data '
{
"token": "bdai_xxxxxxxxxxxxxxxxxxxxxxxx"
}
'
import requests
url = "https://your-org.platform.barndoor.ai/api/identity/userinfo"
payload = { "token": "bdai_xxxxxxxxxxxxxxxxxxxxxxxx" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({token: 'bdai_xxxxxxxxxxxxxxxxxxxxxxxx'})
};
fetch('https://your-org.platform.barndoor.ai/api/identity/userinfo', 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://your-org.platform.barndoor.ai/api/identity/userinfo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'token' => 'bdai_xxxxxxxxxxxxxxxxxxxxxxxx'
]),
CURLOPT_HTTPHEADER => [
"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://your-org.platform.barndoor.ai/api/identity/userinfo"
payload := strings.NewReader("{\n \"token\": \"bdai_xxxxxxxxxxxxxxxxxxxxxxxx\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://your-org.platform.barndoor.ai/api/identity/userinfo")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"bdai_xxxxxxxxxxxxxxxxxxxxxxxx\"\n}")
.asString();
require 'uri'
require 'net/http'
url = URI("https://your-org.platform.barndoor.ai/api/identity/userinfo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"token\": \"bdai_xxxxxxxxxxxxxxxxxxxxxxxx\"\n}"
response = http.request(request)
puts response.read_body
Responses
- 200
{
"id": "5e52dac4-bd2a-426b-b4ba-d32d995ecada",
"organization_id": "cf586077-cab2-4574-a2f2-32d48e8d34e4",
"organization_name": "blush-chickadee",
"organization_display_name": "Acme Corp",
"name": "Jane Smith",
"account_status": "trial"
}
- 401
{
"error": "ServerNotFound",
"message": "Server with ID '123' not found",
"details": {}
}
Body
- application/json
- token
stringrequired
Your Barndoor API key (begins withbdai_). Generate one at Settings → API Tokens in the dashboard. Example:"bdai_xxxxxxxxxxxxxxxxxxxxxxxx"
- token
Response Fields
id
string<uuid>required
Unique identifier for the authenticated user. Example:"5e52dac4-bd2a-426b-b4ba-d32d995ecada"organization_id
string<uuid>required
Unique identifier for the user's organization. Example:"cf586077-cab2-4574-a2f2-32d48e8d34e4"organization_name
stringrequired
URL-friendly slug identifier for the organization. Example:"blush-chickadee"organization_display_name
stringrequired
Human-readable display name of the organization. Example:"Acme Corp"name
stringrequired
Display name of the authenticated user. Example:"Jane Smith"account_status
enum<string>default: trial
Current account tier. Available options:trial,paidExample:"trial"