Skip to main content

Endpoint

POST https://api.graine.cloud/v1/Accounts/{AccountSid}/Calls
Content-Type: application/json
Reference: REST Call Control — Create Call

Path parameters

ParameterTypeRequiredDescription
AccountSidstringYesAccount SID

Headers

HeaderRequiredDescription
AuthorizationYesBearer token

Request body

PropertyTypeRequiredDescription
fromstringYesThe calling party number
toobjectYesDestination for the call (see Target schema)
application_sidstringNoThe application to use to control this call. Either application_sid or call_hook is required.
call_hookWebhookNoInline webhook config. Either application_sid or call_hook is required.
call_status_hookWebhookNoWebhook for call status events
answerOnBridgebooleanNoIf true, inbound leg rings until dialed number answers, then 200 OK is sent. If false, inbound is answered immediately.
timeoutintegerNoSeconds to wait for answer. Default: 60.
timeLimitintegerNoMax length of call in seconds
tagobjectNoInitial customer-supplied metadata (see Graine ‘tag’ verb)
headersobjectNoCustomer SIP headers to associate with the call
fromHoststringNoHostname for the SIP From header of the INVITE
sipRequestWithinDialogHookstringNoSIP in-dialog hook for session messages
speech_synthesis_vendorstringNoTTS vendor (required if application_sid not used)
speech_synthesis_languagestringNoTTS language (required if application_sid not used)
speech_synthesis_voicestringNoTTS voice (required if application_sid not used)
speech_recognizer_vendorstringNoSTT vendor (required if application_sid not used)
speech_recognizer_languagestringNoSTT language (required if application_sid not used)
amdobjectNoAnswering machine detection config

Target (to) schema

PropertyTypeRequiredDescription
typestringYesOne of: phone, sip, user, teams
numberstringNoPhone number (when type is phone)
sipUristringNoSIP URI (when type is sip)
namestringNoRegistered Graine user name (when type is user)
trunkstringNoCarrier name for delivery (when type is phone)
authobjectNousername, password for SIP auth when challenged
proxystringNoSIP Proxy for the outgoing INVITE
tenantstringNoMicrosoft Teams tenant (when type is teams)
vmailbooleanNoDial into Teams user voicemail (when type is teams)
overrideTostringNoSIP URI for To header in outbound INVITE

Response

201 — Call successfully created
{
  "sid": "<uuid>"
}
400 — Bad request

Example

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())
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);