Sessions
Create a Web voice or simulator session
POST
/
v1
/
sessions
Create a Web voice or simulator session
curl --request POST \
--url https://api.sempera.org/v1/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>"
}
'import requests
url = "https://api.sempera.org/v1/sessions"
payload = { "agent_id": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({agent_id: '<string>'})
};
fetch('https://api.sempera.org/v1/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"object": "session",
"transport": "<string>",
"url": "<string>",
"token": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"agent_id": "<string>",
"channel": "<string>",
"status": "ready",
"voice": "<unknown>",
"speech_recognition": "<unknown>",
"voice_source": "<unknown>",
"note": "<unknown>"
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}Authorizations
A workspace API key, sent as Authorization: Bearer sempera_sk_... Each operation names the one scope it needs. Scopes, key kinds and roles are in the Authentication guide.
Headers
Replays the stored answer for a retry of the same request; 409 for a different request under the same key.
Maximum string length:
255Body
application/json
Available options:
web_voice, simulator Your identifier for the person; becomes the room participant identity.
Available options:
en, fr, es simulator only: ten digits.
Response
Created
Names the realtime media transport that url and token are for. Treat it as an opaque label: connect with the web client the guide describes (/docs/web-sdk.md), not with a Sempera protocol.
The realtime signaling URL (WebSocket).
Short-lived, single-room token for the browser. Never an API key.
⌘I
Create a Web voice or simulator session
curl --request POST \
--url https://api.sempera.org/v1/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>"
}
'import requests
url = "https://api.sempera.org/v1/sessions"
payload = { "agent_id": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({agent_id: '<string>'})
};
fetch('https://api.sempera.org/v1/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"object": "session",
"transport": "<string>",
"url": "<string>",
"token": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"agent_id": "<string>",
"channel": "<string>",
"status": "ready",
"voice": "<unknown>",
"speech_recognition": "<unknown>",
"voice_source": "<unknown>",
"note": "<unknown>"
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}{
"error": {
"code": "AGENT_ENV_UNPINNED",
"message": "<string>",
"request_id": "<string>",
"field": "<string>",
"scope": "<string>",
"reason": "<string>"
}
}