Authentication
Use an Agent API Key (ak_*) in the Authorization header:
Path Parameters
The agent’s public ID (ag_*)
Request Body
User message text
Session ID for conversation continuity
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
curl -X POST https://api.thinnest.ai/v1/agents/{agent_id}/chat \
-H "Authorization: Bearer $THINNESTAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "What products do you offer?",
"session_id": "sess_website_visitor_001"
}'
import requests
url = "https://api.thinnest.ai/v1/agents/{agent_id}/chat"
headers = {
"Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
"Content-Type": "application/json",
}
payload = {
"message": "What products do you offer?",
"session_id": "sess_website_visitor_001"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
const response = await fetch("https://api.thinnest.ai/v1/agents/{agent_id}/chat", {
method: "POST",
headers: {
"Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"message": "What products do you offer?",
"session_id": "sess_website_visitor_001"
}),
});
const data = await response.json();
console.log(data);
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{
"message": "What products do you offer?",
"session_id": "sess_website_visitor_001"
}`)
req, _ := http.NewRequest("POST", "https://api.thinnest.ai/v1/agents/{agent_id}/chat", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer YOUR_THINNESTAI_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
{
"response": "We offer three product lines: Starter, Professional, and Enterprise...",
"session_id": "sess_website_visitor_001",
"usage": {
"input_tokens": 42,
"output_tokens": 85,
"total_tokens": 127
}
}
Chat with an agent using API key authentication (for third-party integrations).
curl -X POST https://api.thinnest.ai/v1/agents/{agent_id}/chat \
-H "Authorization: Bearer $THINNESTAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "What products do you offer?",
"session_id": "sess_website_visitor_001"
}'
import requests
url = "https://api.thinnest.ai/v1/agents/{agent_id}/chat"
headers = {
"Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
"Content-Type": "application/json",
}
payload = {
"message": "What products do you offer?",
"session_id": "sess_website_visitor_001"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
const response = await fetch("https://api.thinnest.ai/v1/agents/{agent_id}/chat", {
method: "POST",
headers: {
"Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"message": "What products do you offer?",
"session_id": "sess_website_visitor_001"
}),
});
const data = await response.json();
console.log(data);
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{
"message": "What products do you offer?",
"session_id": "sess_website_visitor_001"
}`)
req, _ := http.NewRequest("POST", "https://api.thinnest.ai/v1/agents/{agent_id}/chat", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer YOUR_THINNESTAI_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
ak_*) in the Authorization header:
curl -X POST https://api.thinnest.ai/v1/agents/ag_c47e7c97_b2f2/chat \
-H "Authorization: Bearer ak_your_agent_api_key" \
-H "Content-Type: application/json" \
-d '{"message": "Hello"}'
200{
"response": "We offer three product lines: Starter, Professional, and Enterprise...",
"session_id": "sess_website_visitor_001",
"usage": {
"input_tokens": 42,
"output_tokens": 85,
"total_tokens": 127
}
}
/chat| Endpoint | Auth | Use Case |
|---|---|---|
POST /chat | Auth0 JWT | Dashboard, internal apps |
POST /v1/agents/{id}/chat | Agent API Key (ak_*) | Websites, third-party apps, embed widgets |
| Code | Description |
|---|---|
401 | Missing or invalid API key |
402 | Insufficient balance |
404 | Agent not found |
429 | Rate limit exceeded (60 req/min per key) |
