# Click-to-Call

> POST /v1/click-to-call - ring your agent first, then the customer, from your Indian number. Request fields, recording, correlation IDs, hangup, errors and the Call Events you receive. Rs 1.50/min.

Source: https://edesy.in/docs/voice-api/calls/click-to-call

`POST https://voice-api.edesy.in/v1/click-to-call`

Click-to-call connects two phones. Edesy rings the **agent** first, showing your Edesy number. When the agent answers, Edesy dials the **customer** and bridges the two. The call is recorded by default, and every stage is sent to your [Call Events v1](https://edesy.in/docs/voice-api/webhooks/call-events) subscriptions. This is the same API Edesy's [LeadSquared and Zoho CRM connectors](https://edesy.in/docs/crm-integrations) use.

Auth: `Authorization: Bearer <API key>` with the `calls:write` permission. See [Authentication](https://edesy.in/docs/voice-api/getting-started/authentication).

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `agent.phone` | string | yes | The agent's phone. Rung first. Indian number, for example `+9198XXXXXXXX` |
| `customer.phone` | string | yes | The customer's phone. Dialled after the agent answers. Indian number, different from the agent's |
| `caller_id` | string | no | An active number of your workspace, shown on both legs. Left out, your first active voice number is used |
| `record` | boolean | no | Default `true`. Send `false` to skip recording (and the transcript and summary) |
| `max_duration_sec` | integer | no | Hard limit on the call, 10 to 7,200. Default 3,600 |
| `correlation` | object | no | Your own string keys and values, echoed on every Call Event. Up to 10 keys; keys up to 64 characters, values up to 256 |

Phone numbers may be written with or without `+91`, spaces or dashes. Only Indian numbers are accepted.

## Example

```bash
curl -X POST https://voice-api.edesy.in/v1/click-to-call \
  -H "Authorization: Bearer $EDESY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent":    { "phone": "+9198XXXXXXXX" },
    "customer": { "phone": "+9197XXXXXXXX" },
    "caller_id": "+9180XXXXXXXX",
    "correlation": { "crm_call_id": "call_8812", "lead_id": "L-1042" }
  }'
```

`201 Created`:

```json
{
  "data": { "call_id": "...", "status": "initiated" }
}
```

Keep `call_id`. It is `call.id` on every [Call Event](https://edesy.in/docs/voice-api/webhooks/call-events) for this call.

## Recording, notice and insights

- Recording is on unless you send `record: false`.
- When recording is on, a short notice that the call may be recorded plays to the customer by default (a workspace setting).
- Recorded calls get an automatic transcript and summary by default (a workspace setting). They arrive as `transcript.ready` and `call.analyzed` events.

## Hang up

`POST https://voice-api.edesy.in/v1/click-to-call/{call_id}/hangup`

```bash
curl -X POST https://voice-api.edesy.in/v1/click-to-call/$CALL_ID/hangup \
  -H "Authorization: Bearer $EDESY_KEY"
```

Returns `202` with `{"data":{"call_id":"...","status":"hangup_requested"}}`, `404 not_found` for an unknown call, or `409 call_ended` if the call has already ended.

## Errors

| Status | Code | Meaning |
|---|---|---|
| 400 | `validation_error` | A field is missing or invalid. `details.field` names it, for example `customer.phone` |
| 400 | `invalid_request` | The body isn't valid JSON |
| 402 | `insufficient_balance` | Add funds to your wallet |
| 409 | `NO_CALLER_ID` | The workspace has no active voice number. Buy or activate one |
| 429 | | A call limit on your workspace was reached |
| 500 | `internal_error` | Try again later |

`caller_id` that isn't an active number of your workspace returns `400 validation_error` with `details.field` = `caller_id`.

## Pricing

Rs 1.50 per minute, 60-second pulse, from your wallet, plus number rental. No separate fee for Call Events, transcripts or summaries. Prices exclude 18% GST. See [Pricing and Limits](https://edesy.in/docs/voice-api/getting-started/pricing-and-limits).

## Next

- [Call Events v1](https://edesy.in/docs/voice-api/webhooks/call-events): register an endpoint and verify signatures.
- [CRM integrations](https://edesy.in/docs/crm-integrations): the no-code LeadSquared and Zoho CRM connectors.
