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

# List messages

> ワークスペースに公開されているメッセージを一覧で取得します。
`received_at` の降順（新しい順）で返却されます。

本文は含みません。本文が必要な場合は `GET /v2/messages/{messageId}` を
個別に取得してください。それ以外の項目は詳細と同じです。

取得対象は `GET /v2/messages/{messageId}` と同じです。公開されていない
メッセージは一覧にも現れません。

ページングの継続判定は `page_info.has_next_page` だけで行ってください。
`page_info.end_cursor` は最終ページでも `null` になりません（差分同期の
checkpoint token として使えるようにするためです）。




## OpenAPI

````yaml /openapi.yaml get /v2/messages
openapi: 3.1.0
info:
  title: Frictio Public API
  version: 1.0.0-beta
servers:
  - url: https://public-api.frictio.ai
security:
  - ApiKeyAuth: []
paths:
  /v2/messages:
    get:
      summary: List messages
      description: |
        ワークスペースに公開されているメッセージを一覧で取得します。
        `received_at` の降順（新しい順）で返却されます。

        本文は含みません。本文が必要な場合は `GET /v2/messages/{messageId}` を
        個別に取得してください。それ以外の項目は詳細と同じです。

        取得対象は `GET /v2/messages/{messageId}` と同じです。公開されていない
        メッセージは一覧にも現れません。

        ページングの継続判定は `page_info.has_next_page` だけで行ってください。
        `page_info.end_cursor` は最終ページでも `null` になりません（差分同期の
        checkpoint token として使えるようにするためです）。
      operationId: listV2Messages
      parameters:
        - $ref: '#/components/parameters/workspaceId'
        - name: limit
          in: query
          required: false
          description: 1–100（デフォルト30）
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 30
        - name: cursor
          in: query
          required: false
          description: 次ページ取得用カーソル
          schema:
            type: string
        - name: ids
          in: query
          required: false
          description: |
            メッセージIDでフィルタ（カンマ区切りで最大100件、OR条件）。
            各要素は UUID 形式である必要があり、形式が違う場合は 400 になります。
            指定した ID のうち取得可能なものだけが返ります。存在しない ID や
            公開されていないメッセージの ID を含めてもエラーにはならず、結果から落ちます。
            `limit` を指定しない場合は既定の 30 件で打ち切られます。100 件をまとめて取得する
            場合は `limit=100` も指定してください。指定しないときは `page_info.has_next_page`
            を見てページングしてください。
          schema:
            type: string
          example: >-
            0d2f1b7c-3a44-4c8e-9f10-6b5e2d8a4c31,8b71e0c4-5d92-4a38-b1f7-2c460e8d95a3
        - name: thread_id
          in: query
          required: false
          description: |
            スレッドIDで絞り込みます。同一スレッドのメッセージだけを時系列で取得できます。
            空文字を指定した場合は 400 になります（絞り込みを要求しているため、未指定として
            全件を返しません）。`received_from` / `received_to` も同じ扱いです。
          schema:
            type: string
        - name: received_from
          in: query
          required: false
          description: 取得範囲の開始日時（以上）。ISO 8601 形式で指定してください。
          schema:
            type: string
            format: date-time
          example: '2026-08-01T00:00:00.000Z'
        - name: received_to
          in: query
          required: false
          description: 取得範囲の終了日時（以下）。ISO 8601 形式で指定してください。
          schema:
            type: string
            format: date-time
          example: '2026-08-27T00:00:00.000Z'
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2MessageListResponse'
        '400':
          $ref: '#/components/responses/V2BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    workspaceId:
      name: X-Workspace-Id
      in: header
      required: true
      description: ワークスペースID
      schema:
        type: string
      example: e1f2a3b4-...
  schemas:
    V2MessageListResponse:
      type: object
      required:
        - data
        - page_info
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/V2MessageListItem'
        page_info:
          $ref: '#/components/schemas/V2PageInfo'
    V2MessageListItem:
      type: object
      required:
        - id
        - header_message_id
        - thread_id
        - subject
        - received_at
        - is_internal
        - is_group_email
        - participants
      properties:
        id:
          type: string
          format: uuid
          description: |
            メッセージID。`GET /v2/activities` の `source_type` が `MESSAGE` の項目では
            `source_id` と一致します。
            UUID 形式でない値を指定した場合は 400 になります。
          example: 0d2f1b7c-3a44-4c8e-9f10-6b5e2d8a4c31
        header_message_id:
          type: string
          description: |
            RFC 5322 の `Message-ID` ヘッダ。メール送信元が付与する識別子で、
            プロバイダに依存しない重複排除キーとして使えます。
          example: <CAF=abc123@mail.gmail.com>
        thread_id:
          type:
            - string
            - 'null'
          description: |
            スレッドID。同一スレッドの判定に使えます。
            `GET /v2/messages` の `thread_id` に渡すとスレッド内のメッセージを取得できます。
            取得できない場合は `null` です。
          example: 19821a3c9f0b1d2e
        subject:
          type:
            - string
            - 'null'
          description: |
            件名。ワークスペースの共有設定で件名が公開されていない場合は `null` です。
            件名が元から空のメッセージも `null` です。この2つは区別できません。
        received_at:
          type: string
          format: date-time
          description: 送受信日時（UTC）。
          example: '2026-08-27T04:12:33.000Z'
        is_internal:
          type: boolean
          description: |
            参加者（From / To / Cc）が全員社内メンバーのメッセージかどうか。
            現在のAPIでは社内メッセージを公開対象に含めません。
        is_group_email:
          type: boolean
          description: メーリングリスト等のグループ宛メッセージかどうか。
        participants:
          type: array
          description: >
            参加者の全件。`FROM` → `TO` → `CC` → `BCC` の順、同一 `role` 内は `handle`
            の昇順で返します。
          items:
            $ref: '#/components/schemas/V2MessageParticipant'
      example:
        id: 0d2f1b7c-3a44-4c8e-9f10-6b5e2d8a4c31
        header_message_id: <CAF=abc123@mail.gmail.com>
        thread_id: 19821a3c9f0b1d2e
        subject: 'Re: 見積のご確認'
        received_at: '2026-08-27T04:12:33.000Z'
        is_internal: false
        is_group_email: false
        participants:
          - handle: sato@example.com
            display_name: 佐藤 花子
            role: FROM
            contact_id: 7a9c4e51-8b26-4d03-9f18-2e6b5c47d90a
          - handle: eigyo@syslea.co.jp
            display_name: null
            role: TO
            contact_id: null
    V2PageInfo:
      type: object
      description: |
        v2 のカーソルページネーション情報。**継続判定は `has_next_page` だけで行ってください。**
        v1 の `pagination.next_cursor` と異なり、`end_cursor` は最終ページでも `null` になりません。
      required:
        - end_cursor
        - has_next_page
      properties:
        end_cursor:
          type:
            - string
            - 'null'
          description: |
            この page の最終行を指すカーソル。`data` が空のときだけ `null` になります。
            `has_next_page` が `false` でも値が入るため、差分同期の checkpoint token として保存できます。
            「`end_cursor` が非 `null` だから次ページがある」と解釈すると、同じページを取り続ける無限ループになります。
        has_next_page:
          type: boolean
          description: |
            次ページの有無。次を取得するかはこの値だけで判断してください。
    V2Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            request_id:
              type: string
    Error:
      type: object
      required:
        - statusCode
        - message
      properties:
        statusCode:
          type: integer
          description: HTTPステータスコード
          example: 404
        message:
          type: string
          description: エラーメッセージ
          example: Meeting not found
        error:
          type: string
          description: |
            エラー種別。メッセージ文字列付きで例外が生成された場合のみ含まれます。
          example: Not Found
    V2MessageParticipant:
      type: object
      description: メッセージの参加者1名。`role` はメールヘッダ上の役割です。
      required:
        - handle
        - display_name
        - role
        - contact_id
      properties:
        handle:
          type: string
          description: メールアドレス。
          example: sato@example.com
        display_name:
          type:
            - string
            - 'null'
          description: 表示名。メールヘッダに含まれない場合は `null` です。
          example: 佐藤 花子
        role:
          type: string
          enum:
            - FROM
            - TO
            - CC
            - BCC
        contact_id:
          type:
            - string
            - 'null'
          format: uuid
          description: |
            対応する Contact のID。未紐付けの場合、または参照先が公開範囲外の場合は `null` です。
          example: 7a9c4e51-8b26-4d03-9f18-2e6b5c47d90a
  responses:
    V2BadRequest:
      description: 不正なリクエスト
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/V2Error'
    Unauthorized:
      description: APIキーが無効、失効、期限切れ、または未指定です
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            invalidApiKey:
              summary: 無効な API キー
              value:
                statusCode: 401
                message: Invalid API key
                error: Unauthorized
            missingApiKey:
              summary: API キー未指定
              value:
                statusCode: 401
                message: Missing X-Api-Key header
                error: Unauthorized
    Forbidden:
      description: 権限エラー
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 403
            message: Forbidden
    TooManyRequests:
      description: レートリミット超過
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 429
            message: Too Many Requests
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

````

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