## Get current user info

### cURL

```bash
curl --request POST \
  --url https://your-org.platform.barndoor.ai/api/identity/userinfo \
  --header 'Content-Type: application/json' \
  --data '
{
  "token": "bdai_xxxxxxxxxxxxxxxxxxxxxxxx"
}
'
```

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

```javascript
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
<?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;
}
?>
```

```go
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))
}
```

```java
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();
```

```ruby
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**

```json
{
  "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**

```json
{
  "error": "ServerNotFound",
  "message": "Server with ID '123' not found",
  "details": {}
}
```

### Body

- **application/json**
  - **token**  `string`  **required**  
    Your Barndoor API key (begins with `bdai_`). Generate one at Settings → API Tokens in the dashboard.
    **Example**: `"bdai_xxxxxxxxxxxxxxxxxxxxxxxx"`

### 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**  `string`  **required**  
  URL-friendly slug identifier for the organization.
  **Example**: `"blush-chickadee"`

- **organization_display_name**  `string`  **required**  
  Human-readable display name of the organization.
  **Example**: `"Acme Corp"`

- **name**  `string`  **required**  
  Display name of the authenticated user.
  **Example**: `"Jane Smith"`

- **account_status**  `enum<string>`  **default**: trial  
  Current account tier.
  Available options: `trial`, `paid`
  **Example**: `"trial"`
