> For complete lifecycle-event payload schemas and examples, use the canonical overview: Session /api/sessions; Room lifecycle, members, and room playback /api/rooms; Session playback /api/playback; Recording /api/recording; DTMF /api/keypad-input; Messages /api/messages; WebSocket Session /api/web-socket. Use /api/event-delivery for transport behavior. Endpoint pages name relevant events, but these overviews are the canonical references.

# Formats

Use these conventions whenever a request or response field uses one of these types.

## Timestamps

Timestamps use [RFC 3339](https://en.wikipedia.org/wiki/RFC_3339) /
[ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) in UTC, with a `Z` suffix and a
three-digit millisecond fraction:

```text
2025-06-06T08:53:20.000Z
```

## Phone numbers

Phone numbers use canonical international [E.164](https://en.wikipedia.org/wiki/E.164)
format with a leading `+`, for example `+972500000000`.

## WebSocket audio

WebSocket Sessions exchange raw mono audio in binary messages
without a WAV header. The required `media_format` object configures each
direction from the Session's perspective:

* `from_session` describes audio that the platform sends from the Session to
  your WebSocket server.
* `to_session` describes audio that your WebSocket server sends to the Session.

Each direction selects one supported encoding and sample-rate combination:

| Encoding    | Supported sample rates                           | Sample representation                             |
| ----------- | ------------------------------------------------ | ------------------------------------------------- |
| `pcm_s16le` | Multiples of `8000` from `8000` through `192000` | Signed 16-bit little-endian; two bytes per sample |
| `mulaw`     | `8000` only                                      | G.711 mu-law; one byte per sample                 |

You select the profile for each direction independently. The platform converts
Session audio to the selected `from_session` format and converts audio received
in the selected `to_session` format to the Session media rate as needed. Binary
message sizes may vary. Each PCM16 message must contain complete 16-bit samples;
each mu-law byte is one complete sample.

PCM16 messages can contain at most 64 KiB. A `to_session` mu-law message can
contain at most 32 KiB so its PCM16 expansion remains within that bound.

G.711 mu-law companding changes the representation of an 8 kHz sample; it does
not change the sample rate. A mu-law direction therefore uses exactly 8 kHz. A
PCM16 direction can use any supported multiple of 8 kHz.

The two directions may use different profiles. For example, your server can
receive `pcm_s16le` at 16 kHz in `from_session` and send `mulaw` at 8 kHz in
`to_session`. See [Create a WebSocket
Session](/api/sessions/connect-websocket) for the complete request schema.

The platform exchanges raw audio only. Selecting `mulaw` does not add Twilio
Media Streams JSON envelopes, base64 payloads, or control messages.