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

# List contacts

> Retrieves a paginated list of contacts associated with a specific company.
Supports filtering, sorting, and pagination options.




## OpenAPI

````yaml GET /v1/list-contacts/{company_id}
openapi: 3.0.3
info:
  title: SalesCaptain API Documentation Service
  description: >
    API Documentation Service for SalesCaptain platform.

    This service provides endpoints for managing and retrieving company
    information for API documentation purposes.
  version: 0.1.0
  contact:
    name: SalesCaptain API Team
    email: support@salescaptain.com
  license:
    name: Proprietary
    url: https://salescaptain.com/license
servers:
  - url: https://api.salescaptain.com
    description: Production server
security:
  - BearerAuth: []
tags:
  - name: Health
    description: Service health and status endpoints
  - name: Companies
    description: Company management and retrieval operations
  - name: Accounts
    description: Account management and retrieval operations
  - name: Conversation Profiles
    description: Conversation profile management for communication channels
  - name: Conversations
    description: Conversation management and retrieval operations
  - name: Contacts
    description: Contact management and retrieval operations
  - name: Custom Fields
    description: Custom field definition management
externalDocs:
  description: SalesCaptain API Documentation
  url: https://docs.salescaptain.com
paths:
  /v1/list-contacts/{company_id}:
    get:
      tags:
        - Contacts
      summary: List contacts for a company (paginated)
      description: >
        Retrieves a paginated list of contacts associated with a specific
        company.

        Supports filtering, sorting, and pagination options.
      operationId: listContacts
      parameters:
        - name: company_id
          in: path
          required: true
          description: Unique identifier for the company
          schema:
            type: string
            format: uuid
            example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        - name: page_number
          in: query
          required: true
          description: Page number for pagination (must be a positive integer)
          schema:
            type: integer
            minimum: 1
            example: 1
        - name: items_per_page
          in: query
          required: false
          description: Number of items per page (10-100, default 10)
          schema:
            type: integer
            minimum: 10
            maximum: 100
            default: 10
            example: 10
        - name: sort_by
          in: query
          required: false
          description: Field to sort by
          schema:
            type: string
            enum:
              - name
              - number
              - email
              - created_at
            example: created_at
        - name: sort_dir
          in: query
          required: false
          description: Sort direction (default desc)
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
            example: desc
        - name: filter
          in: query
          required: false
          description: Filter contacts by channel type
          schema:
            type: string
            enum:
              - phone
              - email
              - facebook
              - instagram
              - whatsapp
            example: phone
      responses:
        '200':
          description: Contacts fetched successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Contacts fetched successfully!
                  contacts:
                    type: object
                    properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/Contact'
                      pagination:
                        $ref: '#/components/schemas/Pagination'
              example:
                message: Contacts fetched successfully!
                contacts:
                  data:
                    - contact_id: f47ac10b-58cc-4372-a567-0e02b2c3d479
                      name: John Doe
                      phone: '+14155551234'
                      email: john.doe@example.com
                      created_at: '2024-01-15T10:30:00.000Z'
                      updated_at: '2024-02-20T14:45:00.000Z'
                      tags:
                        - VIP
                        - New Lead
                        - Follow Up
                      custom_fields:
                        - cf_name: Industry
                          cf_value: Technology
                        - cf_name: Budget
                          cf_value: '50000'
                        - cf_name: Source
                          cf_value: Website
                    - contact_id: c9d8e7f6-5a4b-3c2d-1e0f-9a8b7c6d5e4f
                      name: Jane Smith
                      phone: '+14155559876'
                      email: jane.smith@company.com
                      created_at: '2024-01-20T08:15:00.000Z'
                      updated_at: '2024-03-01T09:30:00.000Z'
                      tags:
                        - Customer
                        - Premium
                      custom_fields:
                        - cf_name: Industry
                          cf_value: Healthcare
                        - cf_name: Company Size
                          cf_value: 100-500
                    - contact_id: b8c7d6e5-4f3a-2b1c-0d9e-8f7a6b5c4d3e
                      name: Mike Johnson
                      phone: '+14155554567'
                      email: null
                      created_at: '2024-02-05T16:00:00.000Z'
                      updated_at: null
                      tags: []
                      custom_fields: []
                  pagination:
                    page_number: 1
                    items_per_page: 10
                    total_count: 156
                    total_pages: 16
        '400':
          description: Invalid or missing query parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missing_page_number:
                  summary: Missing page number
                  value:
                    status: failure
                    error: >-
                      Please provide a valid page_number (must be a positive
                      integer)
                invalid_sort_by:
                  summary: Invalid sort_by value
                  value:
                    status: failure
                    error: 'sort_by must be one of: name, number, email, created_at'
                invalid_filter:
                  summary: Invalid filter value
                  value:
                    status: failure
                    error: >-
                      filter must be one of: phone, email, facebook, instagram,
                      whatsapp
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '429':
          $ref: '#/components/responses/RateLimitError'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - BearerAuth: []
components:
  schemas:
    Contact:
      type: object
      description: Contact information object
      properties:
        contact_id:
          type: string
          format: uuid
          description: Unique identifier for the contact
          example: f47ac10b-58cc-4372-a567-0e02b2c3d479
        name:
          type: string
          description: Contact's full name
          example: John Doe
        phone:
          type: string
          nullable: true
          description: Contact's phone number
          example: '+14155551234'
        email:
          type: string
          format: email
          nullable: true
          description: Contact's email address
          example: john.doe@example.com
        created_at:
          type: string
          format: date-time
          description: Timestamp when the contact was created
          example: '2024-01-15T10:30:00.000Z'
        updated_at:
          type: string
          format: date-time
          nullable: true
          description: Timestamp when the contact was last updated
          example: '2024-02-20T14:45:00.000Z'
        tags:
          type: array
          description: List of tags associated with the contact
          items:
            type: string
          example:
            - VIP
            - New Lead
            - Follow Up
        custom_fields:
          type: array
          description: List of custom fields for the contact
          items:
            $ref: '#/components/schemas/CustomField'
      required:
        - contact_id
        - name
    Pagination:
      type: object
      description: Pagination metadata
      properties:
        page_number:
          type: integer
          description: Current page number
          example: 1
        items_per_page:
          type: integer
          description: Number of items per page
          example: 10
        total_count:
          type: integer
          description: Total number of items across all pages
          example: 156
        total_pages:
          type: integer
          description: Total number of pages
          example: 16
      required:
        - page_number
        - items_per_page
        - total_count
        - total_pages
    Error:
      type: object
      description: Error response object
      properties:
        error:
          type: string
          description: Error message
          example: Invalid request parameters
        code:
          type: string
          description: Error code for programmatic handling
          example: INVALID_PARAMS
        timestamp:
          type: string
          format: date-time
          description: Timestamp when the error occurred
          example: '2023-12-01T10:30:00Z'
        path:
          type: string
          description: API endpoint path where the error occurred
          example: /v1/fetch-companies
      required:
        - error
    CustomField:
      type: object
      description: Custom field key-value pair (response format)
      properties:
        cf_name:
          type: string
          description: Custom field name
          example: Industry
        cf_value:
          type: string
          description: Custom field value
          example: Technology
      required:
        - cf_name
        - cf_value
  responses:
    UnauthorizedError:
      description: Authentication token is missing or invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Unauthorized access
            code: UNAUTHORIZED
            timestamp: '2023-12-01T10:30:00Z'
            path: /v1/fetch-companies
    ForbiddenError:
      description: Access forbidden - valid token but insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Forbidden access
            code: FORBIDDEN
            timestamp: '2023-12-01T10:30:00Z'
            path: /v1/fetch-companies
    RateLimitError:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Too many requests, please try again later
            code: RATE_LIMIT_EXCEEDED
            timestamp: '2023-12-01T10:30:00Z'
            path: /v1/fetch-companies
      headers:
        X-RateLimit-Limit:
          description: Request limit per time window
          schema:
            type: integer
            example: 30
        X-RateLimit-Remaining:
          description: Remaining requests in current window
          schema:
            type: integer
            example: 0
        X-RateLimit-Reset:
          description: Time when the rate limit resets
          schema:
            type: integer
            example: 1701425400
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Problem encountered while fetching companies!
            code: INTERNAL_ERROR
            timestamp: '2023-12-01T10:30:00Z'
            path: /v1/fetch-companies
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        Authentication token required for accessing protected endpoints.

        The token should be obtained from the main SalesCaptain authentication
        service.

````