> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uselevers.com/llms.txt
> Use this file to discover all available pages before exploring further.

> Initiate an AI-powered phone call to a contact for automated collections and communication

# Call Contact

## Authorization

All endpoints require Bearer token authentication.

| Header          | Type   | Required | Description                                               |
| --------------- | ------ | -------- | --------------------------------------------------------- |
| `Authorization` | string | Yes      | Bearer authentication header of the form `Bearer <token>` |

### Getting Your API Key

See the [Quickstart guide](/quickstart) for instructions on obtaining your API credentials.

## Use Cases

* **Automated Collections**: AI can handle payment reminders and negotiate payment terms
* **Customer Communication**: Handle routine customer inquiries without human intervention

## Request Body

| Parameter              | Type          | Required | Description                                                                                               |
| ---------------------- | ------------- | -------- | --------------------------------------------------------------------------------------------------------- |
| `numberToCall`         | string        | Yes      | Phone number to call. A contact is automatically created if one doesn't exist.                            |
| `firstName`            | string        | No       | Contact's first name (used when creating or updating the contact)                                         |
| `lastName`             | string        | No       | Contact's last name (used when creating or updating the contact)                                          |
| `email`                | string        | No       | Contact's email address (used when creating or updating the contact)                                      |
| `contactUuid`          | string (UUID) | No       | Explicitly link the call to a specific contact                                                            |
| `aiSettingsTemplateId` | string (UUID) | No       | AI settings template ID for customizing call behavior                                                     |
| `metadata`             | object        | No       | Extra payload data included in webhook responses as `requestMetadata`                                     |
| `promptTags`           | object        | No       | Key-value pairs for variable substitution in the system prompt template. See [Prompt Tags](#prompt-tags). |
| `updateExisting`       | boolean       | No       | When `true`, updates `firstName`, `lastName`, and `email` if an existing contact is found                 |

## Response

Returns a 201 status on successful initiation of the call.

## AI Call Features

The AI calling system includes:

* **Natural Conversation**: Advanced voice AI that understands context and responds naturally
* **Customizable Scripts**: Use `aiSettingsTemplateId` to customize the conversation flow
* **Call Recording**: All calls are recorded for quality assurance and compliance
* **Smart Routing**: Intelligently routes to human agents when needed

## Prompt Tags

`promptTags` is an optional object of key-value pairs used for **template variable substitution** in the system prompt. Each key maps to a placeholder in your prompt template, and the value replaces it before the call starts.

This is separate from `metadata` — `metadata` is stored on the call log and included in webhooks, while `promptTags` is consumed at call time to populate the system prompt.

### How It Works

Your system prompt template uses `{{key}}` placeholders. When the call is initiated, each `{{key}}` is replaced with the corresponding value from `promptTags`.

**System prompt template:**

```
You are a collections agent. The customer owes {{amount}} due by {{due_date}}.
Be professional and offer payment plan options if the customer cannot pay in full.
```

**Request with promptTags:**

```json theme={null}
{
  "numberToCall": "+1234567890",
  "firstName": "John",
  "aiSettingsTemplateId": "550e8400-e29b-41d4-a716-446655440000",
  "promptTags": {
    "amount": "$500.00",
    "due_date": "January 15, 2026"
  }
}
```

**Resulting system prompt sent to the AI:**

```
You are a collections agent. The customer owes $500.00 due by January 15, 2026.
Be professional and offer payment plan options if the customer cannot pay in full.
```

### Adding Guardrails

You can also use promptTags to inject additional instructions dynamically:

```json theme={null}
{
  "numberToCall": "+1234567890",
  "firstName": "Jane",
  "aiSettingsTemplateId": "550e8400-e29b-41d4-a716-446655440000",
  "promptTags": {
    "amount": "$1,200.00",
    "due_date": "February 1, 2026",
    "guardrail": "Do not mention late fees. If the customer asks about penalties, redirect to their account portal."
  }
}
```

### Prompt Tags vs Metadata

| Field        | Purpose                                             | Where It Goes                                                         |
| ------------ | --------------------------------------------------- | --------------------------------------------------------------------- |
| `promptTags` | Variable substitution in the system prompt template | Consumed at call time, injected into the prompt                       |
| `metadata`   | Arbitrary data attached to the call record          | Stored on call log, included in webhook payloads as `requestMetadata` |


## OpenAPI

````yaml post /ai/phone-calls/action/call
openapi: 3.1.0
info:
  title: api_service
  description: Provide API endpoints for other services
  version: 0.169.9
servers:
  - url: /api-service/v1
security:
  - JWTAuth: []
paths:
  /ai/phone-calls/action/call:
    post:
      tags:
        - ai-features
        - Phone Calls
        - public
      summary: Call Contact
      operationId: call_contact_ai_phone_calls_action_call_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OutboundAIPhoneCallSchema'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    OutboundAIPhoneCallSchema:
      properties:
        updateExisting:
          type: boolean
          title: Updateexisting
          default: false
        numberToCall:
          type: string
          maxLength: 100
          minLength: 1
          title: Numbertocall
        firstName:
          anyOf:
            - type: string
            - type: 'null'
          title: Firstname
        lastName:
          anyOf:
            - type: string
            - type: 'null'
          title: Lastname
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
        promptTags:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Prompttags
          description: >-
            Key-value pairs injected as template variables into system/knowledge
            base prompt.
        contactUuid:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Contactuuid
        aiSettingsTemplateId:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Aisettingstemplateid
        countryCode:
          anyOf:
            - type: string
              maxLength: 2
              minLength: 2
              pattern: ^[A-Z]{2}$
            - type: 'null'
          title: Countrycode
          description: >-
            ISO 3166-1 alpha-2 region code (e.g. 'SA', 'US') to parse local
            numbers.
      type: object
      required:
        - numberToCall
      title: OutboundAIPhoneCallSchema
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    JWTAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Enter JWT token obtained from authentication endpoint. Format: Bearer
        <your_token>

````