Legs API
Create a Leg
Get Leg Details
15 min
description fetches the current details of a leg using its leg sid this is useful to check the leg state (created / ringing / connected / terminal) fetch timestamps (created / start / end) pull additional runtime statuses (bridge / recording / play / gather / hold, etc ) via fields endpoint get /v2/accounts/{account sid}/legs/{leg sid} full url https //cpaas api in exotel com/v2/accounts/{account sid}/legs/{leg sid} authentication type http basic authentication username api key password api token request headers content type application/json authorization basic \<base64(api key\ api token)> path parameters parameter type required description account sid string yes exotel account sid (from exotel dashboard) leg sid string yes leg sid returned by create a leg query parameters (optional) fields use fields to request additional runtime statuses in the response type comma separated string example fields=bridge status,recording status,tx audio status,rx audio status,hold status,gather status,play status field description bridge status whether the leg is bridged or not recording status whether recording is active tx audio status transmit audio status (muted/normal) rx audio status receive audio status (muted/normal) hold status whether leg is on hold gather status whether dtmf gather is active play status whether audio playback is active tip if you don’t pass fields, the api returns the standard leg object without the additional info section example request basic request curl u "\<api key> \<api token>" \\ x get \\ https //cpaas api in exotel com/v2/accounts/\<account sid>/legs/\<leg sid> request with fields curl u "\<api key> \<api token>" \\ x get \\ "https //cpaas api in exotel com/v2/accounts/\<account sid>/legs/\<leg sid>?fields=bridge status,recording status,hold status,gather status,play status" success response http 200 – ok { "request id" "ce7b872225b348f09e80115c1ff569a3", "method" "get", "http code" 200, "response" { "error data" null, "data" { "leg sid" "2qyatxq9t4ukcuwcqjclsa9oez400000", "account sid" "ameyo5m", "contact uri" "09163816621", "exophone" "08030752400", "caller id" "8030752501", "direction" "outbound", "network type" "pstn", "time limit" 600, "state" "connected", "date created" "2026 01 19t08 02 32z", "date updated" "2026 01 19t08 03 06z", "start time" "2026 01 19t08 02 35z", "additional info" { "recording status" "not recording", "hold status" "normal", "gather status" "not gathering", "play status" "not playing", "bridge status" "not bridged" } } } } response fields core fields field description leg sid unique identifier for the leg account sid exotel account identifier contact uri destination of the leg (phone/sip uri) exophone caller id / exotel number used caller id resolved caller id presented direction inbound or outbound network type pstn or voip time limit max time allowed for the leg state current leg state (example connected, terminal) date created when leg was created date updated last update time start time when leg connected/started (if applicable) additional info (only if fields requested) field description recording status recording status hold status hold status gather status dtmf gather status play status playback status bridge status bridge connection status tx audio status transmit audio status (if requested) rx audio status receive audio status (if requested) error responses http code meaning description 400 bad request invalid fields value or malformed request 401 unauthorized invalid api key / token 403 forbidden access not allowed for this account 404 not found leg sid not found 429 too many requests rate limit exceeded 500 server error internal error notes & best practices use get leg details for polling only when needed — prefer events for real time status always log request id for debugging if you need runtime action statuses (play/record/bridge/hold), always pass fields
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.
