You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: API_DOCUMENTATION.md
+20-1Lines changed: 20 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,19 @@ No authentication is enforced by the server. Add your own gateway (API key, OAut
23
23
-`Content-Type: application/json` — required for JSON POSTs.
24
24
-`Accept: application/json` or `text/event-stream` depending on `stream` usage.
25
25
-`x-mcp-mode: true` or `mcp: true` — optional. When present (any value), the request runs in **MCP mode**, returning raw documentation snippets instead of synthesized answers. See [MCP Mode](#mcp-mode).
26
+
-`x-conversation-id` — optional. Links multiple requests to the same conversation for analytics.
27
+
-`x-user-id` — optional. Anonymous user identifier for tracking usage across sessions. The server hashes this value before storage for privacy.
28
+
-`x-api-key` — optional. When present, the server uses a hash of the API key as the user identifier (takes precedence over `x-user-id`).
29
+
30
+
#### User Identification
31
+
32
+
The server derives an anonymized `user_id` for each request using the following priority:
33
+
34
+
1. If `x-api-key` header is present → hash the API key
35
+
2. Else if `x-user-id` header is present → hash the user ID
36
+
3. Else → no user identification
37
+
38
+
This allows tracking user behavior across sessions without storing sensitive identifiers.
26
39
27
40
## Health Check
28
41
@@ -366,6 +379,8 @@ Fetch paginated user queries. If no date range is provided, returns the most rec
366
379
-`query_text`_(optional)_ — filter by text contained in the query (case-insensitive).
367
380
-`limit`_(default `100`)_ — maximum rows returned.
368
381
-`offset`_(default `0`)_ — pagination offset.
382
+
-`conversation_id`_(optional)_ — filter by conversation id.
383
+
-`user_id`_(optional)_ — filter by hashed user id. Useful for tracking individual user journeys and retention.
369
384
370
385
**Response**`200 OK`
371
386
@@ -381,7 +396,9 @@ Fetch paginated user queries. If no date range is provided, returns the most rec
381
396
{ "role": "user", "content": "What is Cairo?" },
382
397
{ "role": "assistant", "content": "Cairo is a programming language..." }
383
398
],
384
-
"output": "To declare a storage variable in Cairo 1, you use the #[storage] attribute..."
399
+
"output": "To declare a storage variable in Cairo 1, you use the #[storage] attribute...",
@@ -390,6 +407,8 @@ Fetch paginated user queries. If no date range is provided, returns the most rec
390
407
}
391
408
```
392
409
410
+
The `user_id` field contains the hashed identifier derived from either the `x-api-key` or `x-user-id` header at request time. This enables user retention and usage analytics without storing raw identifiers.
411
+
393
412
## Versioning & Compatibility
394
413
395
414
- Current API version: `1.0.0` (see FastAPI metadata).
0 commit comments