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

# List Threads

> List email threads for the current user with cursor-based pagination.

Supports virtual folders:
- inbox: Non-archived, non-draft threads
- sent: Outbound threads
- drafts: Draft messages
- starred: Starred threads
- archived: Archived threads
- all: All threads (includes system emails if user has read_all permission)

If include_all_system_emails is True and the user has the messaging:emails:read_all permission,
all system emails will be included regardless of who sent them.

For the "all" folder, system emails are automatically included if the user has the permission.



## OpenAPI

````yaml get /email/threads
openapi: 3.1.0
info:
  title: Decoda API
  description: External API documentation for the Decoda Health platform.
  version: '1.0'
servers: []
security: []
paths:
  /email/threads:
    get:
      tags:
        - provider
        - email
      summary: List Threads
      description: >-
        List email threads for the current user with cursor-based pagination.


        Supports virtual folders:

        - inbox: Non-archived, non-draft threads

        - sent: Outbound threads

        - drafts: Draft messages

        - starred: Starred threads

        - archived: Archived threads

        - all: All threads (includes system emails if user has read_all
        permission)


        If include_all_system_emails is True and the user has the
        messaging:emails:read_all permission,

        all system emails will be included regardless of who sent them.


        For the "all" folder, system emails are automatically included if the
        user has the permission.
      operationId: list_threads_email_threads_get
      parameters:
        - name: TENANT
          in: header
          required: true
          schema:
            type: string
            title: Tenant
          description: The tenant you are making this request on behalf of
        - name: API-KEY
          in: header
          required: true
          schema:
            type: string
            title: Api-Key
          description: Your api key
        - name: folder
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/EmailFolder'
            description: Virtual folder to filter by
            default: INBOX
          description: Virtual folder to filter by
        - name: per_page
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            default: 50
            title: Per Page
        - name: cursor
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Cursor for pagination
            title: Cursor
          description: Cursor for pagination
        - name: search
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Search in subject and snippet
            title: Search
          description: Search in subject and snippet
        - name: before_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: Before Date
        - name: after_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: After Date
        - name: include_all_system_emails
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              Include all system emails (requires messaging:emails:read_all
              permission)
            default: false
            title: Include All System Emails
          description: >-
            Include all system emails (requires messaging:emails:read_all
            permission)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CursorPage_EmailThreadListItem_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    EmailFolder:
      type: string
      enum:
        - INBOX
        - SENT
        - DRAFTS
        - STARRED
        - ARCHIVED
        - ALL
      title: EmailFolder
      description: Virtual folder for organizing email threads in the UI.
    CursorPage_EmailThreadListItem_:
      properties:
        data:
          items:
            $ref: '#/components/schemas/EmailThreadListItem'
          type: array
          title: Data
        total:
          type: integer
          title: Total
        nextCursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Nextcursor
      type: object
      required:
        - data
        - total
      title: CursorPage[EmailThreadListItem]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    EmailThreadListItem:
      properties:
        id:
          type: string
          title: Id
        subject:
          anyOf:
            - type: string
            - type: 'null'
          title: Subject
        snippet:
          anyOf:
            - type: string
            - type: 'null'
          title: Snippet
        isRead:
          type: boolean
          title: Isread
        isStarred:
          type: boolean
          title: Isstarred
        isArchived:
          type: boolean
          title: Isarchived
        firstMessageDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Firstmessagedate
        lastMessageDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Lastmessagedate
        messageCount:
          type: integer
          title: Messagecount
          default: 0
        fromContact:
          anyOf:
            - $ref: '#/components/schemas/EmailContactResponse'
            - type: 'null'
        toContacts:
          items:
            $ref: '#/components/schemas/EmailContactResponse'
          type: array
          title: Tocontacts
          default: []
        createdDate:
          type: string
          format: date-time
          title: Createddate
        updatedDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updateddate
      type: object
      required:
        - id
        - subject
        - snippet
        - isRead
        - isStarred
        - isArchived
        - firstMessageDate
        - lastMessageDate
        - createdDate
        - updatedDate
      title: EmailThreadListItem
      description: Email thread in list responses (without full messages).
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    EmailContactResponse:
      properties:
        id:
          type: string
          title: Id
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        displayName:
          anyOf:
            - type: string
            - type: 'null'
          title: Displayname
        contactType:
          $ref: '#/components/schemas/EmailContactType'
          default: EXTERNAL
        patientIds:
          items:
            type: string
          type: array
          title: Patientids
          default: []
      type: object
      required:
        - id
        - email
        - displayName
      title: EmailContactResponse
      description: Email contact in API responses.
    EmailContactType:
      type: string
      enum:
        - INTERNAL
        - EXTERNAL
        - SYSTEM
      title: EmailContactType
      description: Type of email contact.

````