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

# Create a call

> Create a new outbound call via the REST API

## Endpoint

**POST** `https://api.graine.cloud/v1/Accounts/{AccountSid}/Calls`\
**Content-Type:** application/json

Reference: REST Call Control — Create Call

## Path parameters

| Parameter  | Type   | Required | Description |
| ---------- | ------ | -------- | ----------- |
| AccountSid | string | Yes      | Account SID |

## Headers

| Header        | Required | Description  |
| ------------- | -------- | ------------ |
| Authorization | Yes      | Bearer token |

## Request body

| Property                     | Type    | Required | Description                                                                                                             |
| ---------------------------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------- |
| from                         | string  | Yes      | The calling party number                                                                                                |
| to                           | object  | Yes      | Destination for the call (see Target schema)                                                                            |
| application\_sid             | string  | No       | The application to use to control this call. Either application\_sid or call\_hook is required.                         |
| call\_hook                   | Webhook | No       | Inline webhook config. Either application\_sid or call\_hook is required.                                               |
| call\_status\_hook           | Webhook | No       | Webhook for call status events                                                                                          |
| answerOnBridge               | boolean | No       | If true, inbound leg rings until dialed number answers, then 200 OK is sent. If false, inbound is answered immediately. |
| timeout                      | integer | No       | Seconds to wait for answer. Default: 60.                                                                                |
| timeLimit                    | integer | No       | Max length of call in seconds                                                                                           |
| tag                          | object  | No       | Initial customer-supplied metadata (see Graine 'tag' verb)                                                              |
| headers                      | object  | No       | Customer SIP headers to associate with the call                                                                         |
| fromHost                     | string  | No       | Hostname for the SIP From header of the INVITE                                                                          |
| sipRequestWithinDialogHook   | string  | No       | SIP in-dialog hook for session messages                                                                                 |
| speech\_synthesis\_vendor    | string  | No       | TTS vendor (required if application\_sid not used)                                                                      |
| speech\_synthesis\_language  | string  | No       | TTS language (required if application\_sid not used)                                                                    |
| speech\_synthesis\_voice     | string  | No       | TTS voice (required if application\_sid not used)                                                                       |
| speech\_recognizer\_vendor   | string  | No       | STT vendor (required if application\_sid not used)                                                                      |
| speech\_recognizer\_language | string  | No       | STT language (required if application\_sid not used)                                                                    |
| amd                          | object  | No       | Answering machine detection config                                                                                      |

### Target (to) schema

| Property   | Type    | Required | Description                                         |
| ---------- | ------- | -------- | --------------------------------------------------- |
| type       | string  | Yes      | One of: phone, sip, user, teams                     |
| number     | string  | No       | Phone number (when type is phone)                   |
| sipUri     | string  | No       | SIP URI (when type is sip)                          |
| name       | string  | No       | Registered Graine user name (when type is user)     |
| trunk      | string  | No       | Carrier name for delivery (when type is phone)      |
| auth       | object  | No       | username, password for SIP auth when challenged     |
| proxy      | string  | No       | SIP Proxy for the outgoing INVITE                   |
| tenant     | string  | No       | Microsoft Teams tenant (when type is teams)         |
| vmail      | boolean | No       | Dial into Teams user voicemail (when type is teams) |
| overrideTo | string  | No       | SIP URI for To header in outbound INVITE            |

## Response

**201** — Call successfully created

```json theme={null}
{
  "sid": "<uuid>"
}
```

**400** — Bad request

## Example

```python theme={null}
import requests

url = "https://api.graine.cloud/v1/Accounts/AccountSid/Calls"

payload = {
    "from": "16175551212",
    "to": {
        "type": "phone",
        "number": "+16172375080"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

```javascript theme={null}
const url = 'https://api.graine.cloud/v1/Accounts/AccountSid/Calls';
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    from: '16175551212',
    to: { type: 'phone', number: '+16172375080' }
  })
};

const response = await fetch(url, options);
const data = await response.json();
console.log(data);
```
