---
title: "Fetch all Email accounts"
method: POST
path: "/v1/email-accounts"
tags: ["email-accounts"]
---

# Fetch all Email accounts

`POST /v1/email-accounts`

## Request

- Base URL: `https://developer.saleshandy.com` (the document declares no server; this is the origin it was published from)
- URL: `https://developer.saleshandy.com/v1/email-accounts`
- Auth: API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/saleshandy/apis/develop-with-saleshandy/docs/v1/email-accounts/post.ts> (a function with typed inputs; its response is checked against the schema)

## Request body

- GetAllEmailAccountDto
  - `search` string: Search term for filtering email accounts based on email or firstName or lastName
  - `pageSize` number: Number of items per page. Maximum pageSize is 100.
  - `page` number: Page number for pagination. Defaults to the first page.
  - `sortByKey` 'created-date' | 'health-score' | 'remaining-quota' | 'clientFirstName'
  - `sort` 'ASC' | 'DESC': Sort order for the results, either ascending or descending.
  - `sequenceIds` array[]: List of sequence IDs to filter the email accounts.
    - unknown[]
      - unknown
  - `clientIds` array[]: Array of email account IDs associated with the user.
    - unknown[]
      - unknown
  - `addedBy` array[]: List of user IDs who added the email accounts.
    - unknown[]
      - unknown
  - `status` number: Filter email accounts by status. 0 for Inactive, 1 for Active, 2 for Suspended.
  - `emailServiceProvider` string[]: List of email service providers associated with the email accounts.

## Response `200`

Successfully fetched all email account list

- FetchAllEmailAccountResponseDto
  - `emails` Email[]: List of email accounts
    - `id` string: Unique ID of the email account
    - `fromName` string: Name of the email sender
    - `fromEmail` string: Sender email address
    - `type` number: Type of email account (1: Gmail, 2: Microsoft, 3: SmtpImap)
    - `status` number: Status of the email account (0: Inactive, 1: Active, 2: InProgress)
    - `isDefault` boolean: Indicates true if this email account is the default account for the user
    - `createdAt` string: Account creation timestamp
    - `healthScore` number: Health score of the email account
    - `user` UserDto
      - `firstName` string: First name of the user
      - `lastName` string: Last name of the user
    - `sequences` Sequence[]: List of sequences associated with the email account
      - `id` string: Unique identifier for the sequence
      - `title` string: Title of the sequence
      - `active` boolean: Indicates whether the sequence is active or not
      - `steps` Step[]: Steps included in the sequence
        - `id` string: Unique identifier for the step in the sequence
        - `name` string: Name of the step in the sequence
      - `client` Client
        - `id` string: Unique identifier for the client associated with the sequence
        - `companyName` string: Company name of the client
        - `firstName` string: First name of the client
        - `lastName` string: Last name of the client
      - `user` SequenceUser
        - `id` number: Unique identifier for the sequence owner
        - `firstName` string: First name of the sequence owner
        - `lastName` string: Last name of the sequence owner
        - `email` string: Email address of the sequence owner
    - `settings` Setting[]: List of settings for the email account
      - `id` string: Unique ID of the setting
      - `code` string: Code of the setting
      - `value` string: Value of the setting
      - `modifiedAt` string: Timestamp of the last modification
    - `client` ClientDto
      - `id` string: Unique ID of the client
      - `firstName` string: First name of the client
      - `lastName` string: Last name of the client
      - `email` string: Email of the client
      - `status` string: Status of the client
      - `companyName` string: Company name of the client
    - `hashId` string: Hash ID of the email account
  - `meta` MetaDto
    - `totalItems` number: Total number of items
    - `currentPage` number: Current page number
    - `itemsPerPage` number: Number of items per page
    - `totalPages` number: Total number of pages
    - `itemCount` number: Number of items on the current page
  - `connectedEmailsCount` number: Number of connected email accounts
  - `disconnectedEmailsCount` number: Number of disconnected email accounts

## Other responses

- `400`: <b><i> Error Codes : </i></b><br><br> >* <b>Status:</b> 40107 &nbsp;&nbsp;<b>Description:</b> The sequence input is invalid. Please check and try again. >* <b>Status:</b> 40202 &nbsp;&nbsp;<b>Description:</b> The client input is invalid. Please check and try again. >* <b>Status:</b> 40203 &nbsp;&nbsp;<b>Description:</b> The addedBy input is invalid. Please check and try again. >* <b>Status:</b> 40204 &nbsp;&nbsp;<b>Description:</b> The emailServiceProvider input is invalid. Please check and try again
- `500`: 5001: Internal server error, please try again later<br><br>

---

[API](https://skmtc.dev/saleshandy/apis/develop-with-saleshandy.md) - [All operations](https://skmtc.dev/saleshandy/apis/develop-with-saleshandy/llms.txt) - [OpenAPI document](https://skmtc.dev/saleshandy/apis/develop-with-saleshandy/revisions/e7a29c931aa7?raw)
