Skip to main content
POST
Add an agent connection

Authorizations

Authorization
string
header
required

An Egma API key.

Path Parameters

agentId
string
required

The Egma agent ID returned by Register an agent or List agents.

Minimum string length: 1
Example:

"agt_01M0E4J0BBE1FVDVTZ1BSS5C97"

Query Parameters

projectId
string

Project to act in. A project-scoped API key already identifies its project.

Minimum string length: 1

Body

application/json

Choose one supported agentPlatform, connectionType, accessVariant, and modality from List supported connection options. Its fields describe config and its credentialFields describe credentials. Egma validates the complete combination before saving it.

agentPlatform
enum<string> | null
required

The platform that runs the agent. It must be compatible with the selected connection type and agent.

Available options:
retell,
livekit
connectionType
enum<string>
required

Connection type from the options catalog. Retell text mode tests a voice agent through chat; a Retell web call uses voice. LiveKit room connections can use voice or chat.

Available options:
retell_text_mode,
retell_web_call,
phone_number,
livekit_room
accessVariant
enum<string>
required

Credential method for the connection type, copied from the same catalog entry.

Available options:
retell_text_mode.api_key,
retell_web_call.api_key,
phone_number.public_e164,
livekit_room.project_credentials,
livekit_room.customer_token_endpoint
modality
enum<string>
required

How simulations communicate with the agent. Use a modality offered by the selected catalog entry.

Available options:
voice,
chat
name
string

Optional connection display name. If omitted, Egma chooses the next available numbered name.

Example:

"Staging voice"

environment
string

Optional label identifying the environment this connection reaches.

Example:

"staging"

config
object

Non-secret settings for the selected access variant. Use only its catalog fields. Retell API variants use retellAgentId; a Retell phone connection uses phoneNumber. LiveKit project credentials use url and agentName. LiveKit token endpoints use tokenEndpoint and agentName; tokenEndpoint must be a public HTTPS URL. agentName must match the name registered by your LiveKit worker. When platformAgentId is supplied for a Retell API variant, Egma derives and confirms retellAgentId from that selection.

Examples:
credentials
object

Secret fields for the selected access variant. Retell uses apiKey. LiveKit project credentials use apiKey and apiSecret. A LiveKit token endpoint requires headers: a JSON-encoded string containing a non-empty object of header names to string values. For an additional Retell connection, platformAgentId can reuse the agent's saved Retell key when credentials are omitted. For a Retell phone connection, the key confirms provider identity and is held on the agent; the phone connection itself stores no key. Responses return credential presence and hints, never the secret values.

Examples:
platformAgentId
string

Retell's agent ID from Discover agents, not an Egma agent ID. Supply it with the selected candidate to confirm the provider agent and save its identity on the Egma agent. Required for Retell phone connections. Egma uses credentials.apiKey or the key already saved on that agent. A different Retell identity on the same Egma agent is refused. Do not send this together with agentPlatformSelection.

Example:

"agent_receptionist"

pullProductionCalls
boolean

Start pulling this agent's production calls with the same save. Off unless the request says otherwise; the first switch-on imports the fixed 30-day history.

agentPlatformSelection
object

Superseded by platformAgentId beside credentials, and still accepted. Egma revalidates the selected provider agent and route during creation, then discards this object.

Response

The new connection.

connection
object
required