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}
Authorization
string
required
Bearer token using your LAYERCODE_API_KEY.

Response

Returns JSON with details about the session, transcript, and recording status.
session_id
string
required
Connection ID for the session.
agent_id
string
required
ID of the agent.
started_at
string
ISO timestamp when the connection started.
ended_at
string
ISO timestamp when the connection ended (if ended).
duration_ms
number
Total connection duration in milliseconds.
metadata
object
Custom metadata associated with the session.
from_phone_number
string
Caller phone number (Twilio), if applicable.
from_phone_country
string
Caller country code (Twilio), if applicable.
to_phone_number
string
Agent phone number (Twilio), if applicable.
to_phone_country
string
Agent phone number country code (Twilio), if applicable.
ip_address
string
IP address of the connection.
country_code
string
Country code derived from IP address when available.
transcription_duration_seconds
number
Total seconds of user speech.
tts_duration_seconds
number
Total seconds of generated speech.
latency_ms
number
Processing latency in milliseconds.
transcript
array
Array of transcript entries. Each entry includes: timestamp, user_message, assistant_message, latency_ms.
recording_status
string
One of not_available, in_progress, completed.
recording_url
string
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
Authorization
string
required
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”.