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

# Add Contact to Book

> Adds a new contact to an existing contact book.



## OpenAPI

````yaml POST /contacts/books/{name}
openapi: 3.0.0
info:
  title: ECSEND Developer API
  description: Public API for programmatically sending SMS and managing campaigns/contacts.
  version: 1.0.0
servers:
  - url: https://ecsend.paysgator.com
    description: Production Base URL
security:
  - ApiKeyAuth: []
paths:
  /contacts/books/{name}:
    parameters:
      - name: name
        in: path
        required: true
        description: Name of the contact book
        schema:
          type: string
    post:
      tags:
        - Contacts
      summary: Add a contact to a book
      description: Adds a new contact to an existing contact book.
      operationId: addContactToBook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddContactRequest'
      responses:
        '201':
          description: Contact added
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddContactResponse'
        '400':
          description: Missing required field
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Contact book not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    AddContactRequest:
      type: object
      required:
        - phoneNumber
      properties:
        phoneNumber:
          type: string
          example: +25884xxxxxxx
        contactName:
          type: string
          example: John Doe
    AddContactResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        contact:
          $ref: '#/components/schemas/Contact'
    Error:
      type: object
      properties:
        error:
          type: string
          example: Unauthorized. Invalid or missing X-Api-Key.
    Contact:
      type: object
      properties:
        phoneNumber:
          type: string
          example: +25884xxxxxxx
        name:
          type: string
          example: John Doe
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

````