> ## Documentation Index
> Fetch the complete documentation index at: https://doc.rapida.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Phone Call

Creates an outbound phone call to the specified number using your configured assistant.

> [!NOTE]
>
> For full setup and authentication options, see the Installation guide: [Installation guide](https://doc.rapida.ai/api-reference/installation.md) and [Authentication](https://doc.rapida.ai/api-reference/authentication.md).

## Parameters

**connectionConfig** `ConnectionConfig` *required*

Configuration for the client connection.

**request** `CreatePhoneCallRequest` *required*

**assistant** `AssistantDefinition` *required*

Assistant definition used for the call.

**assistantId** `string` *required*

Assistant ID to use for the call.

**version** `string`

Assistant version. Use `latest` to run the latest published version.

**toNumber** `string` *required*

Destination phone number in E.164 format (for example, +14155550123).

**fromNumber** `string`

Caller ID phone number to originate the call from (E.164 format). If omitted, the system default will be used.

**args** `Map\<string, google_protobuf_any_pb.Any\>`

Additional arguments passed to the call as a key-value map.

**options** `Map\<string, google_protobuf_any_pb.Any\>`

Runtime overrides for this call. Use namespaced keys such as `experience.*`, `listen.*`, `speak.*`, `speaker.*`, `model.*`, or `agentkit.*`.

**metadata** `Map\<string, google_protobuf_any_pb.Any\>`

Arbitrary metadata to associate with the call for tracking and analytics.

## Runtime options

Use `options` to override saved assistant and deployment settings for one outbound call. Runtime options do not update the assistant version or Phone Call deployment.

```json theme={null}
{
  "assistant": {
    "assistantId": "2230142097179373568",
    "version": "latest"
  },
  "toNumber": "+14155550123",
  "fromNumber": "+14155550100",
  "args": {
    "name": "Jane"
  },
  "options": {
    "experience.greeting": "Hi {{name}}, this is Rapida calling about your appointment.",
    "experience.greeting_interruptible": false,
    "listen.language": "en",
    "listen.model": "nova-3",
    "speak.voice.id": "VOICE_ID_PLACEHOLDER",
    "speak.language": "en",
    "model.name": "gpt-4o-mini"
  }
}
```

| Option group | What it overrides | Reference |
| - | - | - |
| `experience.*` | Greeting, idle timeout, error message, and maximum session duration for this call. | [Experience](https://doc.rapida.ai/assistants/configuration/experience.md#runtime-overrides) |
| `listen.*` | Speech-to-text, language, model, audio format, and provider-specific transcription settings. | [Listen](https://doc.rapida.ai/assistants/configuration/listen.md#runtime-overrides) |
| `speak.*` / `speaker.*` | Text-to-speech voice, language, model, audio format, pronunciation, pauses, and ambient audio. | [Speak](https://doc.rapida.ai/assistants/configuration/speak.md#runtime-overrides) |
| `model.*` | Model provider options for this call, such as model name, temperature, credential, or connection settings. | [Create Assistant](https://doc.rapida.ai/assistants/create-assistant.md#runtime-model-overrides) |
| `agentkit.*` | AgentKit connection policy and metadata for this call. | [AgentKit](https://doc.rapida.ai/assistants/agentkit.md#runtime-overrides) |

> [!TIP]
>
> Use `args` for prompt and greeting variables, such as `{{name}}`. Use `options` for runtime configuration overrides, such as `experience.greeting`, `listen.model`, or `speak.voice.id`.

### Usage

```ts React theme={null}
import {
  ConnectionConfig,
  CreatePhoneCall,
  AssistantDefinition,
  CreatePhoneCallRequest,
} from '@rapidaai/react';

const connectionCfg = ConnectionConfig.DefaultConnectionConfig(
  ConnectionConfig.WithSDK({
    ApiKey: "YOUR_API_KEY_PLACEHOLDER",
  })
);

const phoneCallRequest = new CreatePhoneCallRequest();
const assistant = new AssistantDefinition();
assistant.setAssistantid("ASSISTANT_ID_PLACEHOLDER");
assistant.setVersion("latest");
phoneCallRequest.setAssistant(assistant);
phoneCallRequest.setFromnumber("FROM_NUMBER_PLACEHOLDER");
phoneCallRequest.setTonumber("TO_NUMBER_PLACEHOLDER");

CreatePhoneCall(connectionCfg, phoneCallRequest)
.then(x => {
    console.log(x);
    if (x.getSuccess()) {
    return;
    }
    const err = x.getError();
    if (err?.getHumanmessage()) console.error(err.getHumanmessage());
})
.catch(x => {
    console.dir(x);
});
```

```javascript Node.js theme={null}
import {
  AssistantDefinition,
  CreatePhoneCall,
  ConnectionConfig,
  CreatePhoneCallRequest,
} from "@rapidaai/nodejs";

let connectionCfg = ConnectionConfig.DefaultConnectionConfig(
  ConnectionConfig.WithSDK({
    ApiKey: "YOUR_API_KEY_PLACEHOLDER",
  })
);
const phoneCallRequest = new CreatePhoneCallRequest();
// define assistant
const assistant = new AssistantDefinition();
assistant.setAssistantid("ASSISTANT_ID_PLACEHOLDER");
assistant.setVersion("latest");
phoneCallRequest.setAssistant(assistant);
phoneCallRequest.setTonumber("TO_NUMBER_PLACEHOLDER");

CreatePhoneCall(connectionCfg, phoneCallRequest)
  .then((x) => {
    if (x.getSuccess()) {
      console.dir(x.getData().toObject());
      return;
    }
    const err = x.getError();
    if (err?.getHumanmessage()) console.error(err.getHumanmessage());
  })
  .catch((x) => {
    console.dir(x);
  });


```

```python Python theme={null}
import os
from rapida import (
    ConnectionConfig,
    create_phone_call,
    CreatePhoneCallRequest,
    AssistantDefinition,
)
from pprint import pprint

connectionConfig = ConnectionConfig.default_connection_config(
    ConnectionConfig.with_sdk(os.getenv("RAPIDA_API_KEY"))
)
call = CreatePhoneCallRequest(
    assistant=AssistantDefinition(
        assistantId=2230142097179373568,
        version="latest",
    ),
    toNumber="+14155550123",
)
response = create_phone_call(client_cfg=connectionConfig, request=call)
pprint(response)
```

```go Go theme={null}
package main

import (
	"context"
	"fmt"
	"os"

	"github.com/rapidaai/rapida-go/rapida/clients"
	"github.com/rapidaai/rapida-go/rapida/connections"
	protos "github.com/rapidaai/rapida-go/protos"
)

func main() {
	connectionConfig := connections.DefaultconnectionConfig(
		connections.WithSDK(os.Getenv("RAPIDA_API_KEY")),
	)
	response, err := clients.CreatePhoneCall(
		context.Background(),
		connectionConfig,
		&protos.CreatePhoneCallRequest{
			Assistant: &protos.AssistantDefinition{
				AssistantId: 2230142097179373568,
				Version:     "latest",
			},
			ToNumber:   "+14155550123",
			FromNumber: "+14155550124",
		},
	)
	if err != nil {
		fmt.Printf("error while creating phone call: %+v\n", err)
		return
	}
	fmt.Printf("create phone call response: %+v\n", response)
}
```

### Response

**code** `int`

Numeric status code for the operation

**success** `boolean`

Indicates whether the operation was successful

**error** `Error`

**errorCode** `string (uint64)`

Stable, machine-readable numeric code. Represented as a string in JS/TS; parse only if you need numeric comparisons.

**errorMessage** `string`

Developer-oriented message with diagnostic details. Avoid showing directly to end-users.

**humanMessage** `string`

Human-friendly description safe for display to end-users. Localize in your app if needed.

**data** `AssistantConversation`

**id** `string`

Unique identifier for the conversation instance.

**assistantId** `string`

Identifier for the Assistant associated with this conversation.

**projectId** `string`

Project ID associated with this conversation.

**organizationId** `string`

Organization ID related to the conversation.

**source** `string`

Source of the conversation (e.g., "phone-call").

**assistantProviderModelId** `string`

Identifier for the assistant provider model used in the conversation.

**identifier** `string`

Unique identifier string for tracking this conversation.

**status** `string`

Indicates the current status of the conversation (e.g., "ACTIVE").

**createdDate** `google.protobuf.Timestamp`

Timestamp indicating when the conversation was created.

**updatedDate** `google.protobuf.Timestamp`

Timestamp indicating the last update to the conversation.

**metadata** `Map\<string, string\>`

**key** `string`

Metadata key (e.g., "talk.outgoing\_api\_response", "talk.client").

**value** `string`

Metadata value, often a JSON string containing detailed data (e.g., account details, client information).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.