# Call a lead in a campaign now (/api-reference/calls/callNow)

## POST /api/v1/instant/call-now

Operation ID: `callNow`
Call a lead in a campaign now
Places the call immediately, outside the dial schedule, with the campaign's agent and numbers. Numbers on do-not-call are never dialed. To call any number without a campaign, use `POST /calls`.

### Request body

`application/json` (required)

```json
{
  "properties": {
    "campaignId": {
      "description": "A running campaign the lead belongs to; its agent and numbers are used.",
      "title": "Campaignid",
      "type": "string"
    },
    "leadId": {
      "description": "Lead to call. It must be on the campaign and not on do-not-call.",
      "title": "Leadid",
      "type": "string"
    }
  },
  "required": [
    "leadId",
    "campaignId"
  ],
  "title": "CallNowIn",
  "type": "object"
}
```

Example:

```json
{
  "campaignId": "e3f4a5b6-c7d8-4e9f-a0b1-c2d3e4f5a6b7",
  "leadId": "b2a7c9d1-6e3f-4a8b-9c0d-1e2f3a4b5c6d"
}
```

### Responses

#### 200 OK

Example (example):

```json
{
  "call": {
    "campaignId": "e3f4a5b6-c7d8-4e9f-a0b1-c2d3e4f5a6b7",
    "campaignName": "November renewals",
    "id": "8c1e5b7a-2d4f-4e9a-b6c3-1f0a9d8e7b65",
    "leadId": "b2a7c9d1-6e3f-4a8b-9c0d-1e2f3a4b5c6d",
    "leadName": "Asha Verma",
    "phoneNumber": "+919812345678",
    "phoneNumberId": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
    "providerCallId": "a1b2c3d4-e5f6-7a8b-9c0d-e1f2a3b4c5d6",
    "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: `parameter_invalid`.

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)
- [`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)
