> ## 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 Bulk Phone Calls

Creates multiple outbound phone calls in a single request using your configured assistant.

<Info>
  For full setup and authentication options, see the Installation guide: [Installation guide](/api-reference/installation) and [Authentication](/api-reference/authentication).
</Info>

## Parameters

<ParamField body="connectionConfig" type="ConnectionConfig" required>
  Configuration for the client connection.
</ParamField>

<ParamField body="request" type="CreateBulkPhoneCallRequest" required>
  <Expandable>
    <ParamField body="phoneCalls" type="CreatePhoneCallRequest[]" required>
      <Expandable>
        <ParamField body="assistant" type="AssistantDefinition" required>
          Assistant definition used for each call.

          <Expandable>
            <ParamField body="assistantId" type="string" required>
              Assistant ID to use for the call.
            </ParamField>

            <ParamField body="version" type="string">
              Assistant version. Use `latest` to run the latest published version.
            </ParamField>
          </Expandable>
        </ParamField>

        <ParamField body="toNumber" type="string" required>
          Destination phone number in E.164 format (for example, +14155550123).
        </ParamField>

        <ParamField body="fromNumber" type="string">
          Caller ID phone number to originate the call from (E.164 format). If omitted, the system default will be used.
        </ParamField>

        <ParamField body="args" type="Map<string, google_protobuf_any_pb.Any>">
          Additional arguments passed to the call as a key-value map.
        </ParamField>

        <ParamField body="options" type="Map<string, google_protobuf_any_pb.Any>">
          Call options for runtime behavior and configuration.
        </ParamField>

        <ParamField body="metadata" type="Map<string, google_protobuf_any_pb.Any>">
          Arbitrary metadata to associate with the call for tracking and analytics.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

### Usage

<CodeGroup>
  ```ts React theme={null}
  import {
    AssistantDefinition,
    CreateBulkPhoneCall,
    ConnectionConfig,
    CreateBulkPhoneCallRequest,
    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.setTonumber("TO_NUMBER_PLACEHOLDER");

  const bulkPhoneCallRequest = new CreateBulkPhoneCallRequest();
  bulkPhoneCallRequest.addPhonecalls(phoneCallRequest);
  CreateBulkPhoneCall(connectionCfg, bulkPhoneCallRequest)
    .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);
    });

  ```

  ```javascript Node.js theme={null}
  import {
    AssistantDefinition,
    CreateBulkPhoneCall,
    ConnectionConfig,
    CreateBulkPhoneCallRequest,
    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");

  const bulkPhoneCallRequest = new CreateBulkPhoneCallRequest();
  bulkPhoneCallRequest.addPhonecalls(phoneCallRequest);
  CreateBulkPhoneCall(connectionCfg, bulkPhoneCallRequest)
    .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_bulk_phone_call,
      CreatePhoneCallRequest,
      CreateBulkPhoneCallRequest,
      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_bulk_phone_call(
      client_cfg=connectionConfig,
      request=CreateBulkPhoneCallRequest(
          phoneCalls=[call],
      ),
  )
  pprint(response)
  ```

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

  import (
  	"context"
  	"fmt"
  	"os"

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

  func main() {

  	// for more authentication check https://doc.rapida.ai/api-reference/authentication
  	connectionConfig := connections.
  		DefaultconnectionConfig(connections.WithSDK(os.Getenv("RAPIDA_API_KEY")))
  	response, err := clients.CreateBulkPhoneCall(context.Background(), connectionConfig, &protos.CreateBulkPhoneCallRequest{
  		PhoneCalls: []*protos.CreatePhoneCallRequest{
  			{
  				Assistant: &protos.AssistantDefinition{
  					AssistantId: 2227823180112723968,
  					Version:     "latest",
  				},
  				ToNumber: "+14155550123",
  			}},
  	})

  	if err != nil {
  		fmt.Printf("error while creating bulk phone calls: %+v\n", err)
  		return
  	}
  	fmt.Printf("create bulk phone calls response: %+v\n", response)
  }

  ```
</CodeGroup>

### Response

<ParamField body="code" type="int">
  Numeric status code for the operation
</ParamField>

<ParamField body="success" type="boolean">
  Indicates whether the operation was successful
</ParamField>

<ParamField body="error" type="Error">
  <Expandable>
    <ResponseField name="errorCode" type="string (uint64)">
      Stable, machine-readable numeric code. Represented as a string in JS/TS; parse only if you need numeric comparisons.
    </ResponseField>

    <ResponseField name="errorMessage" type="string">
      Developer-oriented message with diagnostic details. Avoid showing directly to end-users.
    </ResponseField>

    <ResponseField name="humanMessage" type="string">
      Human-friendly description safe for display to end-users. Localize in your app if needed.
    </ResponseField>
  </Expandable>
</ParamField>

<ParamField body="data" type="AssistantConversation[]">
  <Expandable>
    <ParamField body="id" type="string">
      Unique identifier for the conversation instance.
    </ParamField>

    <ParamField body="assistantId" type="string">
      Identifier for the Assistant associated with this conversation.
    </ParamField>

    <ParamField body="projectId" type="string">
      Project ID associated with this conversation.
    </ParamField>

    <ParamField body="organizationId" type="string">
      Organization ID related to the conversation.
    </ParamField>

    <ParamField body="source" type="string">
      Source of the conversation (e.g., "phone-call").
    </ParamField>

    <ParamField body="assistantProviderModelId" type="string">
      Identifier for the assistant provider model used in the conversation.
    </ParamField>

    <ParamField body="identifier" type="string">
      Unique identifier string for tracking this conversation.
    </ParamField>

    <ParamField body="status" type="string">
      Indicates the current status of the conversation (e.g., "ACTIVE").
    </ParamField>

    <ParamField body="createdDate" type="google.protobuf.Timestamp">
      Timestamp indicating when the conversation was created.
    </ParamField>

    <ParamField body="updatedDate" type="google.protobuf.Timestamp">
      Timestamp indicating the last update to the conversation.
    </ParamField>

    <ParamField body="metadata" type="Map<string, string>" description="Key-value pairs of metadata associated with the call.">
      <Expandable>
        <ParamField body="key" type="string">
          Metadata key (e.g., "talk.outgoing\_api\_response", "talk.client").
        </ParamField>

        <ParamField body="value" type="string">
          Metadata value, often a JSON string containing detailed data (e.g., account details, client information).
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>
