# Call a lead now (/api-reference/calls/callLeadNow)

## POST /api/v1/leads/{lead_id}/call-now

Operation ID: `callLeadNow`
Call a lead now
Calls the lead right away through the first running campaign it belongs to, using that campaign's agent and caller ID. The lead's do-not-call flag, the campaign's daily cap and your concurrent call limit still apply; each refusal has its own error code.

### Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `lead_id` | path | yes | Lead ID. |

### Responses

#### 200 OK

Example (example):

```json
{
  "call": {
    "campaignId": "3f6c1b2a-7d4e-4a1b-9c2d-5e6f7a8b9c0d",
    "campaignName": "December renewals",
    "id": "c4d5e6f7-a8b9-4c0d-9e1f-2a3b4c5d6e7f",
    "leadId": "5d2f8a1e-3b4c-4d6e-9f0a-1b2c3d4e5f60",
    "leadName": "Asha Rao",
    "phoneNumber": "+919876543210",
    "phoneNumberId": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
    "status": "initiated"
  },
  "success": true
}
```

#### 400 Bad request: `bad_request`, `campaign_has_no_agent`, `dial_rejected`.

Example (The request could not be processed.):

```json
{
  "detail": "The request could not be processed.",
  "error": {
    "code": "bad_request",
    "docUrl": "https://docs.callmitra.ai/errors/bad_request",
    "message": "The request could not be processed.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "invalid_request_error"
  }
}
```

Example (Campaign has no agent assigned.):

```json
{
  "detail": "Campaign has no agent assigned.",
  "error": {
    "code": "campaign_has_no_agent",
    "docUrl": "https://docs.callmitra.ai/errors/campaign_has_no_agent",
    "message": "Campaign has no agent assigned.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "invalid_request_error"
  }
}
```

Example (The carrier rejected the call.):

```json
{
  "detail": "The carrier rejected the call.",
  "error": {
    "code": "dial_rejected",
    "docUrl": "https://docs.callmitra.ai/errors/dial_rejected",
    "message": "The carrier rejected the call.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "invalid_request_error"
  }
}
```

#### 401 Unauthorized: `api_key_expired`, `invalid_api_key`, `unauthenticated`.

Example (The API key has expired.):

```json
{
  "detail": "The API key has expired.",
  "error": {
    "code": "api_key_expired",
    "docUrl": "https://docs.callmitra.ai/errors/api_key_expired",
    "message": "The API key has expired.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "authentication_error"
  }
}
```

Example (The API key is invalid or has been revoked.):

```json
{
  "detail": "The API key is invalid or has been revoked.",
  "error": {
    "code": "invalid_api_key",
    "docUrl": "https://docs.callmitra.ai/errors/invalid_api_key",
    "message": "The API key is invalid or has been revoked.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "authentication_error"
  }
}
```

Example (Authentication required.):

```json
{
  "detail": "Authentication required.",
  "error": {
    "code": "unauthenticated",
    "docUrl": "https://docs.callmitra.ai/errors/unauthenticated",
    "message": "Authentication required.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "authentication_error"
  }
}
```

#### 402 Payment required: `payment_required`.

Example (Your account does not have enough balance or an active plan for this request.):

```json
{
  "detail": "Your account does not have enough balance or an active plan for this request.",
  "error": {
    "code": "payment_required",
    "docUrl": "https://docs.callmitra.ai/errors/payment_required",
    "message": "Your account does not have enough balance or an active plan for this request.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "billing_error"
  }
}
```

#### 403 Forbidden: `api_key_scope_denied`, `permission_denied`.

Example (The API key does not have the scope required for this request.):

```json
{
  "detail": "The API key does not have the scope required for this request.",
  "error": {
    "code": "api_key_scope_denied",
    "docUrl": "https://docs.callmitra.ai/errors/api_key_scope_denied",
    "message": "The API key does not have the scope required for this request.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "permission_error"
  }
}
```

Example (You do not have permission to perform this action.):

```json
{
  "detail": "You do not have permission to perform this action.",
  "error": {
    "code": "permission_denied",
    "docUrl": "https://docs.callmitra.ai/errors/permission_denied",
    "message": "You do not have permission to perform this action.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "permission_error"
  }
}
```

#### 404 Not found: `campaign_not_found`, `lead_not_found`, `lead_not_on_campaign`.

Example (Campaign not found.):

```json
{
  "detail": "Campaign not found.",
  "error": {
    "code": "campaign_not_found",
    "docUrl": "https://docs.callmitra.ai/errors/campaign_not_found",
    "message": "Campaign not found.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "not_found_error"
  }
}
```

Example (Lead not found.):

```json
{
  "detail": "Lead not found.",
  "error": {
    "code": "lead_not_found",
    "docUrl": "https://docs.callmitra.ai/errors/lead_not_found",
    "message": "Lead not found.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "not_found_error"
  }
}
```

Example (Lead is not on this campaign.):

```json
{
  "detail": "Lead is not on this campaign.",
  "error": {
    "code": "lead_not_on_campaign",
    "docUrl": "https://docs.callmitra.ai/errors/lead_not_on_campaign",
    "message": "Lead is not on this campaign.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "not_found_error"
  }
}
```

#### 409 Conflict: `campaign_call_limit_reached`, `campaign_dial_busy`, `campaign_no_eligible_leads`, `campaign_not_running`, `carrier_capacity_reached`, `lead_call_in_progress`, `number_on_dnc`.

Example (Campaign already has an active call in progress.):

```json
{
  "detail": "Campaign already has an active call in progress.",
  "error": {
    "code": "campaign_call_limit_reached",
    "docUrl": "https://docs.callmitra.ai/errors/campaign_call_limit_reached",
    "message": "Campaign already has an active call in progress.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "conflict_error"
  }
}
```

Example (Campaign dial in progress.):

```json
{
  "detail": "Campaign dial in progress.",
  "error": {
    "code": "campaign_dial_busy",
    "docUrl": "https://docs.callmitra.ai/errors/campaign_dial_busy",
    "message": "Campaign dial in progress.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "conflict_error"
  }
}
```

Example (No leads available for calling.):

```json
{
  "detail": "No leads available for calling.",
  "error": {
    "code": "campaign_no_eligible_leads",
    "docUrl": "https://docs.callmitra.ai/errors/campaign_no_eligible_leads",
    "message": "No leads available for calling.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "conflict_error"
  }
}
```

Example (Campaign is not active.):

```json
{
  "detail": "Campaign is not active.",
  "error": {
    "code": "campaign_not_running",
    "docUrl": "https://docs.callmitra.ai/errors/campaign_not_running",
    "message": "Campaign is not active.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "conflict_error"
  }
}
```

Example (The phone number or carrier account is at its call limit.):

```json
{
  "detail": "The phone number or carrier account is at its call limit.",
  "error": {
    "code": "carrier_capacity_reached",
    "docUrl": "https://docs.callmitra.ai/errors/carrier_capacity_reached",
    "message": "The phone number or carrier account is at its call limit.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "conflict_error"
  }
}
```

Example (Lead already has an active call.):

```json
{
  "detail": "Lead already has an active call.",
  "error": {
    "code": "lead_call_in_progress",
    "docUrl": "https://docs.callmitra.ai/errors/lead_call_in_progress",
    "message": "Lead already has an active call.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "conflict_error"
  }
}
```

Example (This number is on the DNC list and will not be dialed.):

```json
{
  "detail": "This number is on the DNC list and will not be dialed.",
  "error": {
    "code": "number_on_dnc",
    "docUrl": "https://docs.callmitra.ai/errors/number_on_dnc",
    "message": "This number is on the DNC list and will not be dialed.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "conflict_error"
  }
}
```

#### 422 Invalid parameters: `lead_has_no_campaign`, `parameter_invalid`.

Example (Lead is not on a campaign.):

```json
{
  "detail": [
    {
      "loc": [
        "body",
        "phone"
      ],
      "msg": "Field required",
      "type": "missing"
    }
  ],
  "error": {
    "code": "lead_has_no_campaign",
    "docUrl": "https://docs.callmitra.ai/errors/lead_has_no_campaign",
    "message": "Lead is not on a campaign.",
    "param": "phone",
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "invalid_request_error"
  }
}
```

Example (One or more parameters are invalid.):

```json
{
  "detail": [
    {
      "loc": [
        "body",
        "phone"
      ],
      "msg": "Field required",
      "type": "missing"
    }
  ],
  "error": {
    "code": "parameter_invalid",
    "docUrl": "https://docs.callmitra.ai/errors/parameter_invalid",
    "message": "One or more parameters are invalid.",
    "param": "phone",
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "invalid_request_error"
  }
}
```

#### 429 Too many requests: `campaign_daily_cap_reached`, `concurrent_call_limit_reached`, `rate_limit_exceeded`.

Example (Daily call limit reached for this campaign.):

```json
{
  "detail": "Daily call limit reached for this campaign.",
  "error": {
    "code": "campaign_daily_cap_reached",
    "docUrl": "https://docs.callmitra.ai/errors/campaign_daily_cap_reached",
    "message": "Daily call limit reached for this campaign.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "rate_limit_error"
  }
}
```

Example (Merchant concurrent call limit reached.):

```json
{
  "detail": "Merchant concurrent call limit reached.",
  "error": {
    "code": "concurrent_call_limit_reached",
    "docUrl": "https://docs.callmitra.ai/errors/concurrent_call_limit_reached",
    "message": "Merchant concurrent call limit reached.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "rate_limit_error"
  }
}
```

Example (Too many requests. Slow down and retry later.):

```json
{
  "detail": "Too many requests. Slow down and retry later.",
  "error": {
    "code": "rate_limit_exceeded",
    "docUrl": "https://docs.callmitra.ai/errors/rate_limit_exceeded",
    "message": "Too many requests. Slow down and retry later.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "rate_limit_error"
  }
}
```

#### 500 Server error: `internal_error`.

Example (Something went wrong on our side.):

```json
{
  "detail": "Something went wrong on our side.",
  "error": {
    "code": "internal_error",
    "docUrl": "https://docs.callmitra.ai/errors/internal_error",
    "message": "Something went wrong on our side.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "api_error"
  }
}
```

#### 502 Error: `dial_failed`.

Example (Failed to place outbound call.):

```json
{
  "detail": "Failed to place outbound call.",
  "error": {
    "code": "dial_failed",
    "docUrl": "https://docs.callmitra.ai/errors/dial_failed",
    "message": "Failed to place outbound call.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "api_error"
  }
}
```

### Error codes

- [`bad_request`](/errors/bad_request)
- [`campaign_has_no_agent`](/errors/campaign_has_no_agent)
- [`dial_rejected`](/errors/dial_rejected)
- [`api_key_expired`](/errors/api_key_expired)
- [`invalid_api_key`](/errors/invalid_api_key)
- [`unauthenticated`](/errors/unauthenticated)
- [`payment_required`](/errors/payment_required)
- [`api_key_scope_denied`](/errors/api_key_scope_denied)
- [`permission_denied`](/errors/permission_denied)
- [`campaign_not_found`](/errors/campaign_not_found)
- [`lead_not_found`](/errors/lead_not_found)
- [`lead_not_on_campaign`](/errors/lead_not_on_campaign)
- [`campaign_call_limit_reached`](/errors/campaign_call_limit_reached)
- [`campaign_dial_busy`](/errors/campaign_dial_busy)
- [`campaign_no_eligible_leads`](/errors/campaign_no_eligible_leads)
- [`campaign_not_running`](/errors/campaign_not_running)
- [`carrier_capacity_reached`](/errors/carrier_capacity_reached)
- [`lead_call_in_progress`](/errors/lead_call_in_progress)
- [`number_on_dnc`](/errors/number_on_dnc)
- [`lead_has_no_campaign`](/errors/lead_has_no_campaign)
- [`parameter_invalid`](/errors/parameter_invalid)
- [`campaign_daily_cap_reached`](/errors/campaign_daily_cap_reached)
- [`concurrent_call_limit_reached`](/errors/concurrent_call_limit_reached)
- [`rate_limit_exceeded`](/errors/rate_limit_exceeded)
- [`internal_error`](/errors/internal_error)
- [`dial_failed`](/errors/dial_failed)
