> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.athenaintel.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.athenaintel.com/_mcp/server.

# Create Presence Token

POST https://api.athenaintel.com/api/v0/workspaces/{workspace_id}/presence-token

Admin only. Mint a short-lived, read-only Keryx token for a workspace's live presence feed (the awareness room the People page renders). The token is bound to the calling user, so Keryx narrows every frame to the documents that user may open; it can never publish presence or write document content. Requires the presence roster to be enabled for the deployment and opted in for the workspace. Computer-asset sandbox credentials are refused: call with the viewing user's own token.

Reference: https://docs.athenaintel.com/api-reference/workspaces/create-presence-token

## Authentication

- `X-API-KEY` header (required) — API Key authentication via header

## Request

### Path parameters

- `workspace_id` (string, required) — The workspace whose presence feed to read.

## Response

### 200

Successful Response

- `access_type` ("r", required) — Always r: subscribe only. The app never publishes a slot.
- `doc_id` (string, required) — Keryx document id within the org: awareness.
- `expires_at_ms` (integer, required) — Token expiry in epoch milliseconds. Re-mint before this passes; the @athenaintel/react presence client does so automatically.
- `org` (string, required) — Keryx org (room namespace): the workspace id.
- `token` (string, required) — Keryx capability token (yauth). Pass as the yauth query parameter on the WebSocket upgrade. Read-only and bound to this workspace's awareness room; Keryx narrows every frame to what the token's user may open.
- `ws_url` (string, required) — WebSocket base URL. Connect to \{ws\_url}/\{org}/\{doc\_id}?yauth=\{token}.
- `branch` (string, optional, default: main) — Document branch.

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `ctx` (ValidationErrorCtx, optional)
- `input` (any, optional)

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

## Examples

**Response**

```json
{
  "access_type": "r",
  "doc_id": "awareness",
  "expires_at_ms": 1789518600000,
  "org": "workspace_9ec609ea-ee1a-48b6-9e61-d73d9dfbb651",
  "token": "keryx-capability-token",
  "ws_url": "wss://keryx.prd.athenaintel.com/api/ws/v1",
  "branch": "main"
}
```

**SDK Code**

```python
import requests

url = "https://api.athenaintel.com/api/v0/workspaces/workspace_id/presence-token"

headers = {"X-API-KEY": "<apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.athenaintel.com/api/v0/workspaces/workspace_id/presence-token';
const options = {method: 'POST', headers: {'X-API-KEY': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.athenaintel.com/api/v0/workspaces/workspace_id/presence-token"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("X-API-KEY", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.athenaintel.com/api/v0/workspaces/workspace_id/presence-token")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<apiKey>'

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.athenaintel.com/api/v0/workspaces/workspace_id/presence-token")
  .header("X-API-KEY", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.athenaintel.com/api/v0/workspaces/workspace_id/presence-token', [
  'headers' => [
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.athenaintel.com/api/v0/workspaces/workspace_id/presence-token");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-API-KEY": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.athenaintel.com/api/v0/workspaces/workspace_id/presence-token")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```