These endpoints require an Authorization: Bearer <LAYERCODE_API_KEY>
header. The key must belong to the organization that owns the agent.
Get Session Details
GET https://api.layercode.com/v1/agents/{agent_id}/sessions/{session_id}
Bearer token using your LAYERCODE_API_KEY
.
Response
Returns JSON with details about the session, transcript, and recording status.
Connection ID for the session.
ISO timestamp when the connection started.
ISO timestamp when the connection ended (if ended).
Total connection duration in milliseconds.
Custom metadata associated with the session.
Caller phone number (Twilio), if applicable.
Caller country code (Twilio), if applicable.
Agent phone number (Twilio), if applicable.
Agent phone number country code (Twilio), if applicable.
IP address of the connection.
Country code derived from IP address when available.
transcription_duration_seconds
Total seconds of user speech.
Total seconds of generated speech.
Processing latency in milliseconds.
Array of transcript entries. Each entry includes: timestamp
, user_message
, assistant_message
, latency_ms
.
One of not_available
, in_progress
, completed
.
If recording_status
is completed
, a URL to download the WAV recording for this session connection.
Example
curl -H "Authorization: Bearer $LAYERCODE_API_KEY" \
https://api.layercode.com/v1/agents/ag-123456/sessions/lc_conn_abc123
Download Session Recording
GET https://api.layercode.com/v1/agents/{agent_id}/sessions/{session_id}/recording
Bearer token using your LAYERCODE_API_KEY
.
Returns a WAV audio file if available.
curl -L -H "Authorization: Bearer $LAYERCODE_API_KEY" \
-o session.wav \
https://api.layercode.com/v1/agents/ag-123456/sessions/lc_conn_abc123/recording
Recordings are generated after a session completes. If a recording is still processing, the details endpoint will return recording_status: “in_progress”
.