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

# Get all conversations



## OpenAPI

````yaml get /v1/conversations
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: >-
    Flextell REST API referansı. Kimlik doğrulama, scope ve istek kuralları için
    API sekmesindeki rehberlere bakın.
servers:
  - url: https://app.flextell.ai/api
    description: Üretim
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/conversations:
    get:
      tags:
        - Conversation
      summary: Get all conversations
      operationId: conversation.index
      parameters:
        - name: per_page
          in: query
          description: The number of items per page.
          schema:
            type:
              - integer
              - 'null'
            minimum: 1
            maximum: 100
        - name: scope
          in: query
          description: >-
            Which conversations to list: `assigned` for the ones whose lead is
            assigned to you, `all` (the default) for every conversation you may
            see. Without permission to view all conversations the list is always
            `assigned`.
          schema:
            type:
              - string
              - 'null'
        - name: search
          in: query
          description: The search query.
          schema:
            type:
              - string
              - 'null'
            maxLength: 255
        - name: channel_type
          in: query
          description: Filter by channel type (whatsapp, instagram, etc.).
          schema:
            type:
              - string
              - 'null'
            enum:
              - whatsapp
              - instagram
              - website
              - telegram
              - null
        - name: channel_ids[]
          in: query
          description: A channel ID to filter by.
          schema:
            type: array
            items:
              type: integer
        - name: archived
          in: query
          description: >-
            Filter by archive state. Pass true for archived conversations only,
            false for active ones. Defaults to active conversations when
            omitted.
          schema:
            type:
              - boolean
              - 'null'
        - name: archive_states[]
          in: query
          description: 'An archive state: "active" or "archived".'
          schema:
            type: array
            items:
              type: string
        - name: lead_reference_source_ids[]
          in: query
          description: A lead reference source ID to filter by.
          schema:
            type: array
            items:
              type: integer
        - name: assigned_user_ids[]
          in: query
          description: A user ID to filter by.
          schema:
            type: array
            items:
              type: integer
        - name: tags[]
          in: query
          description: A tag ID to filter by.
          schema:
            type: array
            items:
              type: integer
        - name: archived_at_from
          in: query
          description: Only include conversations archived at or after this date.
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: archived_at_to
          in: query
          description: Only include conversations archived at or before this date.
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: lead
          in: query
          description: >-
            Filter by customer stage. Pass "lead" for conversations whose
            customer is still a lead, or "patient" for converted customers. Omit
            for all.
          schema:
            type:
              - string
              - 'null'
            enum:
              - lead
              - patient
              - null
        - name: has_open_task
          in: query
          description: >-
            Filter by open tasks of the customer, including the tasks added on
            its lead. Pass true for conversations with at least one open task,
            false for conversations without any.
          schema:
            type:
              - boolean
              - 'null'
        - name: group_lines
          in: query
          description: >-
            List a contact the clinic talks to on several WhatsApp lines once,
            as its most recently active line's conversation; `lines` on each row
            lists all of them. Ignored when `channel_ids` narrows the list to
            given lines.
          schema:
            type:
              - boolean
              - 'null'
        - name: X-Tenant
          in: header
          required: true
          description: >-
            Tenant identifier. Send the Tenant ID in the `X-Tenant` header to
            scope API requests to a specific tenant.
          schema:
            type: number
      responses:
        '200':
          description: Array of `ConversationResource`
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/ConversationResource'
                required:
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '428':
          description: >-
            Mandatory setup is incomplete. Finish the setup wizard first;
            `data.next_step` names the step to continue with.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    examples:
                      - false
                  error_code:
                    type: string
                    enum:
                      - SETUP_REQUIRED
                    examples:
                      - SETUP_REQUIRED
                  message:
                    type: string
                    examples:
                      - Complete the required setup steps to continue.
                  data:
                    type: object
                    properties:
                      next_step:
                        type:
                          - string
                          - 'null'
                        examples:
                          - clinic_info
                    required:
                      - next_step
                required:
                  - success
                  - error_code
                  - message
                  - data
components:
  schemas:
    ConversationResource:
      type: object
      properties:
        id:
          type: integer
        record_state:
          $ref: '#/components/schemas/RecordStateResource'
        display_name:
          type: string
        address:
          anyOf:
            - type: 'null'
            - type: string
        hidden_number:
          type: boolean
          description: >-
            WhatsApp shows this contact only by an anonymous id; the number
            appears once they write from it.
        visitor_id:
          type:
            - string
            - 'null'
        source:
          type:
            - string
            - 'null'
        customer:
          type: object
          properties:
            id:
              type: integer
            first_name:
              anyOf:
                - type: string
                - type: 'null'
            last_name:
              anyOf:
                - type: string
                - type: 'null'
            phone_number:
              anyOf:
                - type: string
                - type: 'null'
            avatar_url:
              type:
                - string
                - 'null'
            is_masked:
              type: string
              description: >-
                Whether the identity fields are masked because the viewer may
                not see this lead's patient.
            is_lead_stage:
              type: boolean
            lead_id:
              type:
                - integer
                - 'null'
            lead_stage:
              type:
                - object
                - 'null'
              properties:
                id:
                  type: integer
                name:
                  type: string
                next_stage_id:
                  type:
                    - integer
                    - 'null'
              required:
                - id
                - name
                - next_stage_id
            erased_at:
              type:
                - string
                - 'null'
              format: date-time
            open_tasks_count:
              type: integer
            notes_count:
              type: integer
          required:
            - id
            - first_name
            - last_name
            - phone_number
            - avatar_url
            - is_masked
            - is_lead_stage
            - lead_id
            - lead_stage
            - erased_at
        channel:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
            type:
              type: string
            provider:
              type:
                - string
                - 'null'
            address:
              type: string
          required:
            - id
            - name
            - type
            - provider
            - address
        last_message_id:
          type:
            - integer
            - 'null'
        last_message:
          type:
            - string
            - 'null'
        last_message_at:
          type:
            - string
            - 'null'
          format: date-time
        last_message_type:
          type:
            - string
            - 'null'
        last_message_media_type:
          type:
            - string
            - 'null'
        last_message_is_customer:
          type:
            - boolean
            - 'null'
        last_message_is_deleted:
          type: boolean
        last_customer_message:
          type:
            - object
            - 'null'
          properties:
            id:
              type: integer
            message:
              type:
                - string
                - 'null'
            message_type:
              type:
                - string
                - 'null'
            media_type:
              type:
                - string
                - 'null'
            created_at:
              type:
                - string
                - 'null'
              format: date-time
            is_customer:
              type: boolean
            is_deleted:
              type: boolean
          required:
            - id
            - message
            - message_type
            - media_type
            - created_at
            - is_customer
            - is_deleted
        unread_count:
          anyOf:
            - type: string
            - type: integer
              enum:
                - 0
        agent_disabled:
          type: boolean
        agent_expires_at:
          type:
            - string
            - 'null'
          format: date-time
        agent_disabled_by_user_name:
          type:
            - string
            - 'null'
        is_archived:
          type: boolean
        archived_at:
          type:
            - string
            - 'null'
          format: date-time
        archived_by_user_name:
          type:
            - string
            - 'null'
        lines:
          type: array
          description: >-
            The contact's conversations on every WhatsApp line, newest first,
            this one included.

            More than one entry means the contact was reached on several lines.
          items:
            type: string
        tags:
          type: array
          items:
            $ref: '#/components/schemas/TagResource'
        blacklist:
          anyOf:
            - $ref: '#/components/schemas/ChannelBlacklistResource'
            - type: 'null'
      required:
        - id
        - record_state
        - display_name
        - address
        - hidden_number
        - visitor_id
        - source
        - last_message_id
        - last_message
        - last_message_at
        - last_message_type
        - last_message_media_type
        - last_message_is_customer
        - last_message_is_deleted
        - last_customer_message
        - unread_count
        - agent_disabled
        - agent_expires_at
        - agent_disabled_by_user_name
        - is_archived
        - archived_at
        - archived_by_user_name
      title: ConversationResource
    RecordStateResource:
      type: object
      properties:
        is_read_only:
          type: boolean
          description: >-
            True when every write on this record is refused; false does not
            imply the caller may write.
        reason_code:
          type:
            - string
            - 'null'
          description: >-
            Why the record is read-only (`CUSTOMER_ERASED`, or
            `LEAD_NOT_ASSIGNED` for a salesperson on another rep's lead), or
            null when it is not.
      required:
        - is_read_only
        - reason_code
      title: RecordStateResource
    TagResource:
      type: object
      properties:
        id:
          type: integer
        tenant_id:
          type: integer
        name:
          type: string
        color:
          type: string
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - tenant_id
        - name
        - color
        - created_at
        - updated_at
        - deleted_at
      title: TagResource
    ChannelBlacklistResource:
      type: object
      properties:
        id:
          type: integer
        tenant_id:
          type: integer
        reason:
          type: string
        reason_label:
          type: string
          enum:
            - Hız Limiti
            - LLM Spam
            - Manuel
            - Güvenlik Tehdidi
            - Hakaret/Küfür
        note:
          type:
            - string
            - 'null'
        blocked_at:
          type: string
          format: date-time
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
        is_active:
          type: boolean
        is_permanent:
          type: boolean
        is_expired:
          type: boolean
        remaining_time:
          type: string
        metadata:
          type:
            - array
            - 'null'
          items: {}
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
        channel:
          $ref: '#/components/schemas/RelatedChannelResource'
        customer:
          $ref: '#/components/schemas/RelatedCustomerResource'
      required:
        - id
        - tenant_id
        - reason
        - reason_label
        - note
        - blocked_at
        - expires_at
        - is_active
        - is_permanent
        - is_expired
        - remaining_time
        - metadata
        - created_at
        - updated_at
        - deleted_at
      title: ChannelBlacklistResource
    RelatedChannelResource:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        type:
          $ref: '#/components/schemas/ChannelType'
        address:
          type: string
      required:
        - id
        - name
        - type
        - address
      title: RelatedChannelResource
    RelatedCustomerResource:
      type: object
      properties:
        id:
          type: integer
        record_state:
          $ref: '#/components/schemas/RecordStateResource'
        first_name:
          anyOf:
            - type: string
            - type: 'null'
        last_name:
          anyOf:
            - type: string
            - type: 'null'
        phone_number:
          anyOf:
            - type: string
            - type: 'null'
        email:
          anyOf:
            - type: string
            - type: 'null'
        is_masked:
          type: boolean
          description: >-
            Whether the identity fields are masked because the viewer may not
            see this lead's patient.
        is_lead_stage:
          type: boolean
          description: >-
            Whether the person is still a lead (link to `/leads/{lead_id}`)
            rather than a patient (link to `/customers/{id}`).
        lead_id:
          type:
            - integer
            - 'null'
          description: >-
            The lead the person came from; kept after conversion, so check
            `is_lead_stage` before linking to it.
      required:
        - id
        - record_state
        - first_name
        - last_name
        - phone_number
        - email
        - is_masked
        - is_lead_stage
        - lead_id
      title: RelatedCustomerResource
    ChannelType:
      type: string
      enum:
        - whatsapp
        - instagram
        - website
        - telegram
      title: ChannelType
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://dev.flextell.ai/oauth/authorize
          tokenUrl: https://dev.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.