# Create web call (legacy path)

> POST https://api.nabrah.ai/api/ext/make-web-call

Group: Web calls. Page: https://www.nabrah.ai/en/docs/api-reference/web-calls/create-web-call-legacy-path

Legacy path kept for existing integrations. New integrations should use [Create web call](https://www.nabrah.ai/en/docs/api-reference/web-calls/create-web-call.md).

Backward-compatible alias of POST /api/ext/web/make-web-call — starts a browser/WebRTC voice session with an agent and returns a connection token. Pass the agent_id and optionally an identity, prompt variables, and extra_data; the response token is what your frontend uses to join the live audio session. Prefer the canonical /api/ext/web/make-web-call for new integrations; this path is kept only for compatibility.

## Alias notice

- **Equivalent to /api/ext/web/make-web-call**: Same request body (WebCallRequest) and response (token). Use the canonical /api/ext/web/make-web-call going forward.

## Request fields

- **agent_id**: UUID of the agent that will answer the web call. List agents with GET /api/ext/agent. Fields: `agent_id`.
- **identity**: Optional client/participant identity for the session, used to label the joining user in the realtime connection. Fields: `identity`.
- **variables / extra_data**: Optional prompt template variables and free-form context passed into the call. Fields: `variables`, `extra_data`.

## Response

- **token**: Connection token your browser/WebRTC client uses to join the live voice session. Treat it as short-lived and single-session. Fields: `token`.

## Authorization

- `X-API-Key` (string, header, required): your workspace API key.

## Body (application/json)

### Example: Minimal

Start a web call with just an agent.

```json
{
  "agent_id": "00000000-0000-4000-8000-000000000000"
}
```

### Example: Full

Web call with participant identity, variables, and extra context.

```json
{
  "agent_id": "00000000-0000-4000-8000-000000000000",
  "identity": "user-12345",
  "variables": {
    "customer_name": "Ahmed"
  },
  "extra_data": "Logged-in user, premium tier"
}
```

## Response

### 200 Successful Response

Content type: `application/json`

```json
{
  "token": "string"
}
```

### 422 Validation Error

Content type: `application/json`

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
```

## Request examples

### cURL

```bash
curl --request POST \
  --url 'https://api.nabrah.ai/api/ext/make-web-call' \
  --header 'X-API-Key: <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "agent_id": "00000000-0000-4000-8000-000000000000"
}'
```

### Python

```python
import requests

url = "https://api.nabrah.ai/api/ext/make-web-call"
headers = {
    "X-API-Key": "<your-api-key>",
}
payload = {
    "agent_id": "00000000-0000-4000-8000-000000000000"
}

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

### JavaScript

```javascript
const response = await fetch("https://api.nabrah.ai/api/ext/make-web-call", {
  method: "POST",
  headers: {
    "X-API-Key": "<your-api-key>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "agent_id": "00000000-0000-4000-8000-000000000000"
  }),
});

const data = await response.json();
console.log(data);
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	payload := strings.NewReader(`{
  "agent_id": "00000000-0000-4000-8000-000000000000"
}`)

	req, _ := http.NewRequest("POST", "https://api.nabrah.ai/api/ext/make-web-call", payload)
	req.Header.Set("X-API-Key", "<your-api-key>")
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	out, _ := io.ReadAll(res.Body)
	fmt.Println(string(out))
}
```
