# Place a test call (/api-reference/agents/testCallAgent)

## POST /api/v1/agents/{agent_id}/test-call

Operation ID: `testCallAgent`
Place a test call
Calls `destination` from one of your numbers so you can hear the agent. Not a campaign call and not billed; free plans have a test-call allowance.

### Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `agent_id` | path | yes |  |

### Request body

`application/json` (required)

```json
{
  "description": "Place a test call from one of your numbers.",
  "properties": {
    "destination": {
      "description": "E.164 or local number to dial.",
      "minLength": 3,
      "title": "Destination",
      "type": "string"
    },
    "dynamicValues": {
      "additionalProperties": true,
      "description": "Values for the script's placeholders, e.g. `{\"name\": \"Asha\"}`.",
      "title": "Dynamicvalues",
      "type": "object"
    },
    "phoneNumberId": {
      "description": "Your phone number id to call from.",
      "minLength": 1,
      "title": "Phonenumberid",
      "type": "string"
    }
  },
  "required": [
    "phoneNumberId",
    "destination"
  ],
  "title": "AgentTestCallIn",
  "type": "object"
}
```

Example:

```json
{
  "destination": "+919812345678",
  "phoneNumberId": "8a1d4c2e-0b7f-4e9a-9c3d-5f6e7a8b9c0d"
}
```

### Responses

#### 200 OK

Example (example):

```json
{
  "callId": "c2b7e0d4-1f3a-4b5c-8d9e-0a1b2c3d4e5f",
  "message": "Test call initiated",
  "phoneNumber": "+919812345678",
  "success": true
}
```

#### 400 Bad request: `agent_test_call_failed`.

Example (The test call could not be placed.):

```json
{
  "detail": "The test call could not be placed.",
  "error": {
    "code": "agent_test_call_failed",
    "docUrl": "https://docs.callmitra.ai/errors/agent_test_call_failed",
    "message": "The test call could not be placed.",
    "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: `agent_not_found`, `phone_number_not_found`.

Example (Agent not found.):

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

Example (Phone number not found.):

```json
{
  "detail": "Phone number not found.",
  "error": {
    "code": "phone_number_not_found",
    "docUrl": "https://docs.callmitra.ai/errors/phone_number_not_found",
    "message": "Phone number not found.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "not_found_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: `rate_limit_exceeded`.

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"
  }
}
```

### Error codes

- [`agent_test_call_failed`](/errors/agent_test_call_failed)
- [`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)
- [`agent_not_found`](/errors/agent_not_found)
- [`phone_number_not_found`](/errors/phone_number_not_found)
- [`parameter_invalid`](/errors/parameter_invalid)
- [`rate_limit_exceeded`](/errors/rate_limit_exceeded)
- [`internal_error`](/errors/internal_error)
