> ## 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.

# New Call (POST)

> Webhook sent when a new call is created on the platform (POST). Configured at the application level.

## Endpoint

**POST** `https://{yourserver}/webhooks/call`\
**Content-Type:** application/json

This webhook is sent when a new call is created on the platform. It is configured at the application level.

Reference: Call Hook (POST)

## Request

The request body contains call information as JSON (see CallHook schema below).

## Response

Return a **200** with a JSON payload consisting of an array of verbs to control the call.

## CallHook schema

| Property                      | Type   | Description                                                                           |
| ----------------------------- | ------ | ------------------------------------------------------------------------------------- |
| call\_sid                     | string | Unique identifier for the call                                                        |
| call\_id                      | string | Call ID on the server                                                                 |
| application\_sid              | string | Unique identifier for the Graine application controlling this call                    |
| account\_sid                  | string | Unique identifier for the Graine account                                              |
| direction                     | string | `inbound` — call originated outside Graine; `outbound` — call originated by Graine    |
| from                          | string | Calling party number                                                                  |
| to                            | string | Called party number                                                                   |
| caller\_name                  | string | Caller name, if known                                                                 |
| sip\_status                   | number | Most recent SIP status code for the call                                              |
| sip\_reason                   | string | Description of the last SIP status                                                    |
| call\_status                  | string | One of: trying, ringing, early-media, in-progress, completed, failed, busy, no-answer |
| sbc\_callid                   | string | Original call ID when the call arrived at Graine                                      |
| originating\_sip\_ip          | string | IP address that sent the call to Graine                                               |
| originating\_sip\_trunk\_name | string | Name of the carrier in Graine that received the call                                  |
| local\_sip\_address           | string | Internal address of the Feature Server handling the call                              |
| service\_provider\_sid        | string | ID of the service provider the account belongs to                                     |
| sip                           | object | The SIP request for the call (raw, headers, body, method, version, uri, payload)      |
| env\_vars                     | object | Application environment variables                                                     |

## Authentication

**Authorization:** Basic authentication (required)

## Example request

```python theme={null}
import requests

url = "https://{yourserver}/webhooks/call"

payload = {
    "call_sid": "d2515c3b-b79a-41a2-971a-445e769c823c",
    "call_id": "d2515c3b-b79a-41a2-971a-445e769c823c",
    "application_sid": "72c5c38f-9bba-40ce-aa83-aaa6be55e1b5",
    "account_sid": "bad98250-b34d-459d-9e90-f97dfb9bc519",
    "direction": "inbound",
    "from": "+12125551212",
    "to": "+14155551234",
    "caller_name": "John Doe",
    "sip_status": 100,
    "sip_reason": "Trying",
    "call_status": "trying"
}
headers = {
    "Authorization": "Basic <username>:<password>",
    "Content-Type": "application/json"
}

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

```javascript theme={null}
const url = 'https://{yourserver}/webhooks/call';
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Basic <username>:<password>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    call_sid: 'd2515c3b-b79a-41a2-971a-445e769c823c',
    call_id: 'd2515c3b-b79a-41a2-971a-445e769c823c',
    application_sid: '72c5c38f-9bba-40ce-aa83-aaa6be55e1b5',
    account_sid: 'bad98250-b34d-459d-9e90-f97dfb9bc519',
    direction: 'inbound',
    from: '+12125551212',
    to: '+14155551234',
    caller_name: 'John Doe',
    sip_status: 100,
    sip_reason: 'Trying',
    call_status: 'trying'
  })
};

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