MCP is live.Set upAsk the community
OmniDimension
Sessions

Create session

Create a voice Session: a short-lived, single-conversation reservation that lets a client hold a live voice chat with your agent. This is step 1 of 2. Creating the Session does not start any audio on its own; it returns a ws_url that a client then connects to over WebSocket to actually talk.

Connect the client and talk

The ws_url alone does nothing until a client connects to it. Creating the session is step 1; connecting a client is step 2. Your API key stays on your server: the client only ever receives the ws_url, which is single use and expires.

  • The token is valid to connect for 15 minutes after creation.
  • It covers one conversation and dies when that conversation ends.
  • Connect to the ws_url exactly as returned. Never build, edit, or cache it; the format is not part of the contract.
  • If the connection drops mid-call, reconnecting to the same ws_url re-attaches to the same conversation, so a brief network blip does not lose the call.

Two client paths, both using the same ws_url:

  • Browser: the @omnidim-ai/client web SDK handles microphone capture, agent audio playback, barge-in, and transcripts.
  • Any other platform: speak the wire protocol in Web call protocol: 16 kHz mono PCM16 frames in, audio and transcript events out.
POST/sessions/create
Body
5 fields
·

Reseller keys only: the id of one of your direct client users. The call then acts as that client, on that client's agents, numbers, campaigns and balance. Calls, sessions and bulk campaigns spend that client's balance and concurrency. Omit it to act on your own account. Send it as a JSON integer in the body. null, 0, false or your own user id also means your own account. Any other value that is not a positive integer id is refused with 400 invalid_request. A key that is not a reseller's gets 403 when it names someone else. A user who is not your direct client gets 404.

ID of the agent the session talks to.

The session type. Only voice is supported.

Per-session variables that personalize the conversation. Set server-side, so visitors cannot tamper with them. Two reserved keys are read as instructions for this session and never reach the agent: __languages and __post_call_actions.

languages
post call actions
Email
Enabled
Recipients
Include
Extracted variables
No items yet.
Trigger call statuses
Webhook
Enabled
Url
Include
Extracted variables
No items yet.
Trigger call statuses
Omni crm
Enabled
Include
Extracted variables
No items yet.
Trigger call statuses
Cloud whatsapp
Enabled
Include
Extracted variables
No items yet.
Trigger call statuses
Phone number id
Template id
Template variables
No items yet.
Templates
No items yet.
Workflow
Enabled
Include
Extracted variables
No items yet.
Trigger call statuses
Workflow id
curl -X POST 'https://backend.omnidim.io/api/v1/sessions/create' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "user_id": 1234,
  "agent_id": 158910,
  "type": "voice",
  "custom_variables": {
    "name": "Demo User"
  },
  "metadata": {
    "crm_lead_id": "lead_9876",
    "source": "website_form"
  }
}'
Example response
synthetic
{
  "session_id": 4521,
  "token": "sess_51gF2qw8LxNz0vY4mT7Ka3RjD9pBcE6HuWiQnZsX0oM",
  "expires_at": "2026-07-17T12:15:00Z",
  "ws_url": "wss://live.omnidim.io/chat/start_voice_chat?request_token=sess_51gF2qw8LxNz0vY4mT7Ka3RjD9pBcE6HuWiQnZsX0oM",
  "post_call_actions_applied": [
    "email",
    "webhook"
  ],
  "post_call_actions_ignored": [
    {
      "channel": "webhook",
      "code": "invalid_url",
      "message": "Webhook URL must point to an address reachable from the internet. Local and private network addresses cannot receive your call data. If you are testing locally, use a tunnel URL instead."
    }
  ]
}

Authorization

BearerAuth
headerAuthorizationBearer <token>

Bearer token authentication. Obtain your API key from the OmniDimension dashboard.

Request Body

application/json
user_id?ClientUserId

Reseller keys only: the id of one of your direct client users. The call then acts as that client, on that client's agents, numbers, campaigns and balance. Calls, sessions and bulk campaigns spend that client's balance and concurrency. Omit it to act on your own account. Send it as a JSON integer in the body. null, 0, false or your own user id also means your own account. Any other value that is not a positive integer id is refused with 400 invalid_request. A key that is not a reseller's gets 403 when it names someone else. A user who is not your direct client gets 404.

agent_id*integer

ID of the agent the session talks to.

type*"voice"

The session type. Only voice is supported.

Default"voice"
Value in"voice"
custom_variables?

Per-session variables that personalize the conversation. Set server-side, so visitors cannot tamper with them. Two reserved keys are read as instructions for this session and never reach the agent: __languages and __post_call_actions.

metadata?

Key-value pairs stored on the session for your own tracking (e.g. CRM or lead IDs). Not shared with the agent; echoed back as metadata in the post-call webhook so you can correlate results with your records.

Response body

application/json

Response Body

Session created.

application/json
session_id?integer

Correlate this with call logs and support requests.

token?string

The Session Token. Single conversation, unguessable.

expires_at?string

End of the 15-minute connect window (UTC).

Formatdate-time
ws_url?string

Connect your client to this URL as returned.

post_call_actions_applied?array<string>

Channels from __post_call_actions that will run for this session. Present only when __post_call_actions was sent.

post_call_actions_ignored?

Items from __post_call_actions that were skipped. Present only when __post_call_actions was sent. When nothing was applied, the agent's own post-call actions run.