curl --request POST \
--url https://api.synthra.ai/v1/sessions/session_abc123def456/messages \
--header 'Authorization: Bearer synthra_live_abc123def456' \
--header 'Content-Type: application/json' \
--data '{
"content": "What is the current price of SOL?",
"role": "user"
}'
const response = await fetch(
'https://api.synthra.ai/v1/sessions/session_abc123def456/messages',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.SYNTHRA_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: 'What is the current price of SOL?',
role: 'user'
})
}
);
import requests
response = requests.post(
'https://api.synthra.ai/v1/sessions/session_abc123def456/messages',
headers={
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
},
json={
'content': 'What is the current price of SOL?',
'role': 'user'
}
)
{
"messageId": "msg_xyz789ghi012",
"sessionId": "session_abc123def456",
"role": "assistant",
"content": "The current price of Solana (SOL) is $147.23 USD, up 3.2% in the last 24 hours.",
"tokens": 28,
"createdAt": "2024-03-08T14:30:15Z"
}
{
"error": {
"code": "context_overflow",
"message": "Context window exceeded. Enable compression or clear session history.",
"currentTokens": 8192,
"maxTokens": 8192
}
}
Message Operations
Send Message
Send a message and receive AI response
POST
/
v1
/
sessions
/
{sessionId}
/
messages
curl --request POST \
--url https://api.synthra.ai/v1/sessions/session_abc123def456/messages \
--header 'Authorization: Bearer synthra_live_abc123def456' \
--header 'Content-Type: application/json' \
--data '{
"content": "What is the current price of SOL?",
"role": "user"
}'
const response = await fetch(
'https://api.synthra.ai/v1/sessions/session_abc123def456/messages',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.SYNTHRA_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: 'What is the current price of SOL?',
role: 'user'
})
}
);
import requests
response = requests.post(
'https://api.synthra.ai/v1/sessions/session_abc123def456/messages',
headers={
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
},
json={
'content': 'What is the current price of SOL?',
'role': 'user'
}
)
{
"messageId": "msg_xyz789ghi012",
"sessionId": "session_abc123def456",
"role": "assistant",
"content": "The current price of Solana (SOL) is $147.23 USD, up 3.2% in the last 24 hours.",
"tokens": 28,
"createdAt": "2024-03-08T14:30:15Z"
}
{
"error": {
"code": "context_overflow",
"message": "Context window exceeded. Enable compression or clear session history.",
"currentTokens": 8192,
"maxTokens": 8192
}
}
Authorization
string
required
Bearer token. Format:
Bearer synthra_live_abc123def456Path Parameters
string
required
Unique session identifier. Format:
session_<16 chars>Body Parameters
string
required
Message content. Max 10,000 characters.
string
default:"user"
Message role. Options:
user, systemboolean
default:"false"
Enable streaming response via WebSocket
object
Optional metadata to attach to message
Response
string
Unique message identifier
string
Session identifier
string
Message role (assistant)
string
AI-generated response content
number
Token count for this message
string
ISO 8601 timestamp
curl --request POST \
--url https://api.synthra.ai/v1/sessions/session_abc123def456/messages \
--header 'Authorization: Bearer synthra_live_abc123def456' \
--header 'Content-Type: application/json' \
--data '{
"content": "What is the current price of SOL?",
"role": "user"
}'
const response = await fetch(
'https://api.synthra.ai/v1/sessions/session_abc123def456/messages',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.SYNTHRA_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: 'What is the current price of SOL?',
role: 'user'
})
}
);
import requests
response = requests.post(
'https://api.synthra.ai/v1/sessions/session_abc123def456/messages',
headers={
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
},
json={
'content': 'What is the current price of SOL?',
'role': 'user'
}
)
{
"messageId": "msg_xyz789ghi012",
"sessionId": "session_abc123def456",
"role": "assistant",
"content": "The current price of Solana (SOL) is $147.23 USD, up 3.2% in the last 24 hours.",
"tokens": 28,
"createdAt": "2024-03-08T14:30:15Z"
}
{
"error": {
"code": "context_overflow",
"message": "Context window exceeded. Enable compression or clear session history.",
"currentTokens": 8192,
"maxTokens": 8192
}
}
⌘I