> ## 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 accounts by ID

> Retrieves a list of all accounts associated with the authenticated user for a specific company.
Returns account details including access level, contact information, and last login time.




## OpenAPI

````yaml GET /v1/fetch-all-accounts/{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/fetch-all-accounts/{company_id}:
    get:
      tags:
        - Accounts
      summary: Fetch all accounts for authenticated user
      description: >
        Retrieves a list of all accounts associated with the authenticated user
        for a specific company.

        Returns account details including access level, contact information, and
        last login time.
      operationId: fetchAllAccounts
      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
      responses:
        '200':
          description: Accounts fetched successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Accounts fetched successfully!
                  accounts:
                    type: array
                    items:
                      $ref: '#/components/schemas/AccountDetail'
              example:
                message: Accounts fetched successfully!
                accounts:
                  - account_id: acc-1234-5678-90ab-cdef12345678
                    access_level: administrator
                    last_login: '2026-03-12T10:30:00.000Z'
                    email: john.doe@example.com
                    mobile: '+1234567890'
                    first_name: John
                    last_name: Doe
                  - account_id: acc-abcd-efgh-ijkl-mnop12345678
                    access_level: user
                    last_login: '2026-03-10T14:45:00.000Z'
                    email: jane.smith@example.com
                    mobile: '+0987654321'
                    first_name: Jane
                    last_name: Smith
        '400':
          description: Bad request - Missing or invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: failure
                error: 'Required parameters missing: company_id'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '429':
          $ref: '#/components/responses/RateLimitError'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - BearerAuth: []
components:
  schemas:
    AccountDetail:
      type: object
      description: Detailed account information
      properties:
        account_id:
          type: string
          description: Unique account identifier
          example: acc-1234-5678-90ab-cdef12345678
        access_level:
          type: string
          description: User's access level within the account
          enum:
            - owner
            - administrator
            - user
          example: administrator
        last_login:
          type: string
          format: date-time
          description: Timestamp of the user's last login
          example: '2026-03-12T10:30:00.000Z'
        email:
          type: string
          format: email
          description: User's email address
          example: john.doe@example.com
        mobile:
          type: string
          description: User's mobile phone number
          example: '+1234567890'
        first_name:
          type: string
          description: User's first name
          example: John
        last_name:
          type: string
          description: User's last name
          example: Doe
      required:
        - account_id
        - access_level
        - email
        - first_name
        - last_name
    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
  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.

````