Legs API
Legs APIs — Introduction
GET — Get Events for a Leg
12 min
description retrieve all external events generated for a specific leg , including lifecycle events and action level events this api is useful for debugging, auditing, and reconstructing the event timeline for a leg method get endpoint /v2/accounts/{accountsid}/legs/{legsid}/external events full url https //cpaas api in exotel com/v2/accounts/{accountsid}/legs/{legsid}/external events authentication use basic authentication authorization basic \<base64 apikey apitoken> api credentials can be found in my exotel com → developer settings request query parameters parameter name mandatory / optional type description event name optional string filters events by a specific event name (e g , leg answered, recording started) sample request get /v2/accounts/{accountsid}/legs/{legsid}/external events sample request with filter get /v2/accounts/{accountsid}/legs/{legsid}/external events?event name=leg answered response response parameters parameter name type description sid string unique sid of the leg event type string type of event (leg action event, leg lifecycle event) account sid string account sid associated with the leg external events array list of external event objects external event object each item in external events contains field type description endpoint response boolean whether the event was successfully delivered error string error message, if delivery failed date created string (iso 8601) event creation timestamp date updated string (iso 8601) event update timestamp event info object detailed event metadata event info object field type description event sid string unique sid of the event event type string event type (leg action event, leg lifecycle event) event name string name of the event event timestamp object timestamp when the event occurred action sid string associated action sid action custom parameter string custom parameter passed during action execution data object event specific payload sample response { "request id" "ce7b872225b348f09e80115c1ff569a3", "method" "get", "http code" 202, "response" { "error data" null, "data" { "sid" "2q47dakkscvff1ibpdpp7kjse6j00000", "event type" "leg lifecycle event", "account sid" "sprinklr2m", "external events" \[ { "endpoint response" true, "error" "", "date created" "2024 12 11t09 41 21 98089381z", "date updated" "2024 12 11t09 41 22 186124012z", "event info" { "event sid" "2q47dipypqbenwgennwxrtb6ywb00000", "event type" "leg lifecycle event", "event name" "channel created", "event timestamp" { "seconds" 1733148727, "nanos" 963868626 }, "action sid" "2pfeo9kg9ycqujlbghjyh2gaja400000", "action custom parameter" "start uni stream action custom param", "data" { "account sid" "sprinklr2m", "caller id" "08030752501", "contact uri" "09163816622", "custom param" "abc", "date created" "2024 12 11t09 41 21 98089381z", "date updated" "2024 12 11t09 41 22 186124012z", "dc code" "101", "direction" "outbound", "exophone" "08030752400", "leg sid" "2q47dakkscvff1ibpdpp7kjse6j00000", "network type" "pstn", "nso code" "a8140aaa ce40 11ed 9a09 0242ac110003", "start time" "2024 12 11t09 41 22 186124012z", "state" "created", "time limit" 14400 } } } ] } } } notes for developers events are returned in chronological order this api is read only and does not affect leg execution useful for debugging failed actions verifying event delivery building event replay or analytics pipelines
Have a question?
Our super-smart AI, knowledgeable support team and an awesome community will get you an answer in a flash.
To ask a question or participate in discussions, you'll need to authenticate first.
