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

# Create a contact for an agent

> Adds a contact to the specified agent. Optionally fixes US phone numbers by adding a leading 1 if not present. Returns 400 with detailed error message if phone number validation fails.



## OpenAPI

````yaml /api-reference/openapi.json post /agents/{agentId}/contacts
openapi: 3.0.0
info:
  title: Callers API
  description: >-
    The Callers REST API. Authenticate by sending your API key in the
    `Authorization` header.
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.callers.ai
security:
  - Authorization: []
tags:
  - name: Agents
    description: Create, configure, start, and stop agents.
  - name: Agent Groups
    description: Folders that organize agents.
  - name: Contacts
    description: Add, list, and archive the contacts an agent reaches.
  - name: Calls
    description: Call history, recordings, outcomes, and live call controls.
  - name: Webhooks
    description: Subscribe to call events and inspect webhook payloads.
  - name: Contact Memory
    description: Facts an agent remembers about a contact across conversations.
  - name: Vocabulary
    description: Words and phrases that improve speech recognition.
  - name: Voices
    description: Voice library and voice cloning.
  - name: Background Noises
    description: Background sounds played during calls.
  - name: Organizations
    description: Your account, subaccounts, SIP trunks, and retention.
paths:
  /agents/{agentId}/contacts:
    post:
      tags:
        - Contacts
      summary: Create a contact for an agent
      description: >-
        Adds a contact to the specified agent. Optionally fixes US phone numbers
        by adding a leading 1 if not present. Returns 400 with detailed error
        message if phone number validation fails.
      operationId: CampaignPublicController_createContact[0]
      parameters:
        - name: agentId
          required: true
          in: path
          schema:
            type: string
        - name: fixUSPhoneNumber
          required: false
          in: query
          description: Will add 1 to the phone number if it doesn't starts with 1
          schema:
            type: boolean
        - name: ignorePhoneNumberValidation
          required: false
          in: query
          description: Skip phone number validation for contacts
          schema:
            type: boolean
        - name: x-sub-organization-id
          in: header
          schema:
            type: string
          description: >-
            Optional sub organization ID. Must belong to your main organization
            API key.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CampaignContactCreateDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createSingleContactResponseDto'
        '400':
          description: >-
            Bad Request - validation failed. The error message includes detailed
            information about which fields failed validation (e.g.,
            "phoneNumber: Phone number is not valid: 225747466045"). Invalid
            `data` returns one issue per broken rule in `data`, each with a
            machine-readable `params.code` (`data_too_large`, `too_many_keys`,
            `key_too_long`, `invalid_key`, `invalid_characters`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                  data:
                    type: array
                    items:
                      type: object
                example:
                  status: error
                  message: Validation failed
                  data:
                    - code: custom
                      path:
                        - data
                      message: >-
                        total size 7,860 characters (max 4,000; largest:
                        contactDataDescription 7,725, notes 310, email 24)
                      params:
                        code: data_too_large
                        totalLength: 7860
                        max: 4000
                        largestFields:
                          - key: contactDataDescription
                            length: 7725
                          - key: notes
                            length: 310
                          - key: email
                            length: 24
                    - code: custom
                      path:
                        - data
                      message: >-
                        field name "first name" is invalid (must start with a
                        letter, $ or _ and contain only letters, numbers, $ or
                        _)
                      params:
                        code: invalid_key
                        key: first name
                    - code: custom
                      path:
                        - data
                      message: >-
                        field "notes" contains control character U+000B
                        (allowed: tab, line breaks)
                      params:
                        code: invalid_characters
                        key: notes
                        codePoint: U+000B
        '403':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
      security:
        - Authorization: []
components:
  schemas:
    CampaignContactCreateDto:
      type: object
      properties:
        name:
          type: string
          minLength: 1
        phoneNumber:
          type: string
          minLength: 7
          maxLength: 20
          pattern: ^\+?[\d()-]+$
        phoneNumbers:
          type: array
          items:
            type: string
            minLength: 7
            maxLength: 20
            pattern: ^\+?[\d()-]+$
        timezone:
          type: string
        data:
          type: object
          additionalProperties:
            type: string
        archived:
          type: boolean
          default: false
      required:
        - name
        - data
    createSingleContactResponseDto:
      type: object
      properties:
        contactId:
          type: string
          description: ID of the created or updated contact.
        created:
          type: boolean
          description: True if a new contact was created.
        modified:
          type: boolean
          description: True if an existing contact was modified.
      required:
        - contactId
        - created
        - modified
  securitySchemes:
    Authorization:
      type: apiKey
      in: header
      name: Authorization

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.