# Voip Calls API

#### Triggering Calls through API

After copying the API key, it is to be used as a header in the request to trigger the call or schedule it. `scheduleAt` is an optional date time field that is passed when the call is to be scheduled in the future. If past date is passed, an error will be raised. Users can also configure `from` phone number that is an optional phone number used to initiate the call. This phone number should be owned by the user

```bash
curl --location 'https://voicehub.dataqueue.ai/api/v1/calls/api-call' \
--header 'x-dq-api-key: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
  "to": "<voip-call-phone-number-destination>",
  "agentId": "<agent-id-to-be-used>"
  "context": {<json-dict-of-context>}
  "scheduledAt": "yyyy-mm-ddThh:mm",
  "from": "<voip-call-phone-number-source>",
}'
```

It returns a json object containing details about the call triggered

```json
{
    "id": "<generated-call-id>",
    "status": "<call-status>", // Queued or Scheduled
    "type": "voip"
}
```

#### Checking status of the call

The following endpoint allows to read through the status of the call triggered

```bash
curl --location 'https://voicehub.dataqueue.ai/api/v1/calls/status/<call-id>/' \
--header 'x-dq-api-key: <api-key>'
```

response returned is similar to that of the trigger call api response

### Getting the call Recording

The following endpoint allows to get the URL for the recording of the wanted call

```bash
curl --location 'https://voicehub.dataqueue.ai/api/v1/calls/e2e/<CallId>/recordings' \
--header 'x-dq-api-key: <api-key>'
--header 'Content-Type: application/json' \
```


---

# Agent Instructions: 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:

```
GET https://dataqueue.gitbook.io/voicehub-docs/api-reference/voip-calls-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
