Manage a Session

Read a session's status, extend its expiry, pause or resume routing, or end it — GET, PATCH and DELETE on /masking/sessions/:id.

Manage a Session

Once a session exists you can read its status, extend its expiry, pause or resume routing, or end it early. All three operations use the session_id returned by Create a Session.

Get session status

GET /masking/sessions/:id

Returns the session's current status (active, paused, or expired) and details, including total_calls.

curl https://voice-api.edesy.in/v1/masking/sessions/3f9a1c72-5b8e-4d21-9c34-7a2e6f0b1d55 \
  -H "Authorization: Bearer vp_YOUR_API_KEY"

200 — Current session state

{
  "data": {
    "session_id": "3f9a1c72-5b8e-4d21-9c34-7a2e6f0b1d55",
    "virtual_number": "918071387146",
    "party_a": "9876543210",
    "party_b": "9123456789",
    "reference": "ORD-4821",
    "status": "active",
    "expires_at": "2026-07-14T18:30:00Z",
    "total_calls": 2,
    "created_at": "2026-07-14T18:00:00Z"
  }
}

404 — No such session

{ "error": { "code": "not_found", "message": "Session not found" } }

Extend, pause or resume

PATCH /masking/sessions/:id

Send expiry_minutes to reset the expiry to now + N minutes (for example, the order is still active), and/or status to pause or resume routing.

Parameter Type Required Description
expiry_minutes integer No Reset the session expiry to now + this many minutes (1–43200).
status string No "paused" to block routing, "active" to resume.
curl -X PATCH https://voice-api.edesy.in/v1/masking/sessions/3f9a1c72-5b8e-4d21-9c34-7a2e6f0b1d55 \
  -H "Authorization: Bearer vp_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "expiry_minutes": 30 }'

200 — Updated session

{
  "data": {
    "session_id": "3f9a1c72-5b8e-4d21-9c34-7a2e6f0b1d55",
    "virtual_number": "918071387146",
    "status": "active",
    "expires_at": "2026-07-14T19:00:00Z"
  }
}

While a session is paused, calls to the virtual number are not bridged; resume it by sending status: "active".

End a session

DELETE /masking/sessions/:id

Ends the session immediately: the virtual number stops routing between these parties and is freed for reuse. A session.expired event fires. The call is idempotent — ending an already-ended session is safe.

curl -X DELETE https://voice-api.edesy.in/v1/masking/sessions/3f9a1c72-5b8e-4d21-9c34-7a2e6f0b1d55 \
  -H "Authorization: Bearer vp_YOUR_API_KEY"

200 — Session ended

{
  "data": {
    "session_id": "3f9a1c72-5b8e-4d21-9c34-7a2e6f0b1d55",
    "virtual_number": "918071387146",
    "status": "expired"
  }
}

Sessions with an expiry_minutes also end on their own — a background sweep expires them automatically, freeing the number without an explicit DELETE.

See all error codes.