> For the complete documentation index, see [llms.txt](https://docs.plumvoice.com/fuse/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.plumvoice.com/fuse/apis/outbound-calls/outbound-call.md).

# Queue Call

{% hint style="success" %}
**-** **NEW! -  Interactive API docs, now live!**

Visit [api-docs.plumvoice.com](https://api-docs.plumvoice.com) to **read** Plum API documentation, **build and test requests** in our interactive API sandbox, **review** the responses, and **share** it all with your team.
{% endhint %}

{% hint style="danger" %}
If you plan to queue **more than one** call at a time, use the [Queue Multiple Calls](/fuse/apis/outbound-calls/multiple-outbound-calls.md) API Method. Looping the Single Call API for individual calls can cause DDoS, which will result in all calls failing.
{% endhint %}

## Queuing An Outbound Call

<mark style="color:green;">`POST`</mark> `https://fuse.plumvoice.com/api/apps/{application_id}/{deployment_id}/queue`

Queue an outbound call

#### Path Parameters

| Name            | Type   | Description                                                                                                                                                                                              |
| --------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| application\_id | number | <p>Application ID number.</p><p></p><p>To find this number, <a href="/pages/-MJCrBvC0VgWv3SbsmEK#locating-the-application-and-deployment-id">see the following instructions from Outbound Calls</a>.</p> |
| deployment\_id  | number | <p>Deployment ID number.</p><p></p><p>To find this number, <a href="/pages/-MJCrBvC0VgWv3SbsmEK#locating-the-application-and-deployment-id">see the following instructions from Outbound Calls</a>.</p>  |

#### Headers

| Name         | Type   | Description                                         |
| ------------ | ------ | --------------------------------------------------- |
| Content-type | string | multipart/form-data                                 |
| Accept       | string | application/x-www-form-urlencoded, application/json |

#### Request Body

| Name             | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| phone\_number    | string  | <p>This is the destination phone number for the outbound call.<br>There are multiple ways to format phone numbers. They can include the 'tel:' prefix and/or the ANI and postd suffixes, e.g. ani=8009957586 and/or postd=2.<br><br>tel:+16175551234;ani=8009957586 <em>(this sets the caller ID)</em><br><br>A masking number should be used for outbound calls calls as Fuse do not have a default caller ID value, and shows a destination for the person to respond and return the call.</p> |
| start\_timestamp | string  | Unix timestamp indicating when to begin the outbound dialing attempts. If not specified, the calls go out immediately.                                                                                                                                                                                                                                                                                                                                                                           |
| end\_timestamp   | string  | Unix timestamp indicating when to stop attempting the outbound call.                                                                                                                                                                                                                                                                                                                                                                                                                             |
| max\_attempts    | integer | Total number of times (integer between 1-10) to attempt calling a specific number (if previous attempts are not completed successfully). This field requires *reattempt\_wait* field to be set.                                                                                                                                                                                                                                                                                                  |
| reattempt\_wait  | integer | <p>Interval (in seconds) to wait before retrying the outbound call after a failure. This is only required when you set a <em>max\_attempts</em> value greater than one, which indicates additional retry attempts.<br><br>Valid values range from 60 to 86400 (1 minute to 1 day).</p>                                                                                                                                                                                                           |
| metadata         | string  | <p>JSON object of key⇒value pairs of variables and their related values for use with an application at run time.<br><br>Ex: {“first\_name”:“Steve”,“last\_name”:“Smith”}<br>These variables can be access as <strong>first\_name</strong> and <strong>last\_name</strong> respectively within the application.</p>                                                                                                                                                                               |
| result\_url      | string  | <p>Callback URL to your REST service that processes the call status results when the call is completed, canceled, or all attempts have been exhausted. The POST body matches the format of the <em>call\_details</em> attribute from the outbound call status API response.</p><p></p><p>For more information on <em>result\_url</em>, see documentation <a href="/pages/-M58QnLYb72U7xZvis9d#result-callbacks">here</a>.</p>                                                                    |
| is\_pci          | integer | For customers who have been granted access to our HIPAA / PCI compliant secure environment setting this flag to 1 will cause connected outbound calls to execute within that secure environment. (Integer 0 or 1).                                                                                                                                                                                                                                                                               |

{% tabs %}
{% tab title="200 Note the 'Link' header. It's possible to use this URI to check the status of the outbound call)." %}
{% tabs %}
{% tab title="JSON" %}

```javascript
<!-- Response Headers -->

HTTP/1.1 200 OK
Date: Mon, 07 Nov 2016 17:03:29 GMT
Server: Apache/2.2.29 (Unix) mod_ssl/2.2.29 OpenSSL/1.0.2d PHP/5.4.45
X-Powered-By: PHP/5.4.45
Link: https://fuse.plumvoice.com/api/outbound/761
Content-Length: 15
Content-Type: application/json

<!-- Response Body -->

{
   "call_id":761
}
```

{% endtab %}

{% tab title="XML" %}

```markup
<!-- Response Headers -->

HTTP/1.1 200 OK
Date: Mon, 07 Nov 2016 17:05:29 GMT
Server: Apache/2.2.29 (Unix) mod_ssl/2.2.29 OpenSSL/1.0.2d PHP/5.4.45
X-Powered-By: PHP/5.4.45
Link: https://fuse.plumvoice.com/api/outbound/771
Content-Length: 62
Content-Type: application/xml

<!-- Response Body -->

<?xml version="1.0"?>
<result>
  <call_id>771</call_id>
</result>
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="400 Example: start\_timestamp was after the end\_timestamp " %}
{% tabs %}
{% tab title="JSON" %}

```javascript
{ "error": "The end_timestamp cannot be earlier than the start_timestamp." }
```

{% endtab %}

{% tab title="XML" %}

```markup
<?xml version="1.0"?>
<result>
    <error>The end_timestamp cannot be earlier than the start_timestamp.</error>
</result>
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

### **Possible Response Codes**

* **200**: success, call successfully queued.
* **400**: supplied data improperly formatted or invalid
* **401**: authentication headers invalid or the account is inactive
* **403**: the user attempting to queue the outbound call does not have appropriate permissions
* **404**: deployment not found
* **405**: invalid HTTP method supplied (only POST allowed)
* **409**: user, deployment, or application previously deleted
* **500**: database error

The return structure will contain the following item(s):

| Name     | Data Type | Always Present | Description                                                                                                                                                                                                                       |
| -------- | --------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| error    | string    | no             | This indicates which error occurred if the HTTP code is not 200.                                                                                                                                                                  |
| call\_id | int       | no             | A 200 HTTP code returns this value, which is the unique identifier for an outbound call when the request is successful. Users can use the *call\_id* value to look up call details in the call details API method outlined below. |

{% hint style="info" %}
**Note**: The returned 'Link' header provides the URI for checking the status of the most recent outbound call attempt.
{% endhint %}

### **Sample Code**

This sample PHP code makes a request to queue a new outbound call. This triggers an outbound call that goes out immediately and makes a single attempt to connect:

```php
<?php
// account and application settings
$email = '<your_email_address>';
$developer_key = '<your_developer_key>';
$application_id = '<your_application_id>';
$deployment_id = '<your_deployment_id>';
$phone_number = '<phone_number_to_dial>';

// build the URL and POST parameters
$url = 'https://fuse.plumvoice.com/api/apps/'.$application_id.'/'.$deployment_id.'/queue';
$params = array('phone_number'=>$phone_number);

$ch = curl_init();
curl_setopt($ch, CURLOPT_USERPWD, $email.':'.$developer_key);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/json", "Content-type: application/x-www-form-urlencoded"));
$result = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
var_dump($result);
var_dump($http_code);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.plumvoice.com/fuse/apis/outbound-calls/outbound-call.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
