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

# ユーザーのメッセージ履歴を取得する

> 指定したユーザーのキャンペーンとユーザージャーニーの送受信履歴を、カーソルを使ってページ単位で取得します。

> [!NOTE]
>
> **カーソルベースのページネーション**
>
> このAPIはカーソルベースのページネーションを使用します。次のページを取得するには、レスポンスの`next_cursor`の値を、次のリクエストの`cursor`パラメーターに渡してください。`next_cursor`が`null`の場合は、最後のページです。

> [!NOTE]
>
> **主なイベント名**
>
> | イベント名 | 説明 |
> | - | - |
> | `send_success` | メッセージの送信成功 |
> | `send_failure` | メッセージの送信失敗 |
> | `push_click` | プッシュ通知のクリック |
> | `push_delivered` | プッシュ通知の到達 |
> | `in_app_message_show` | アプリ内ポップアップの表示 |
> | `in_web_message_show` | Webポップアップの表示 |
> | `main_button_click` | メインボタンのクリック |
> | `close_button_click` | 閉じるボタンのクリック |
> | `failover_text_message_send_success` | 代替SMSの送信成功 |
> | `failover_text_message_send_failure` | 代替SMSの送信失敗 |
>
> チャネルによっては、ほかのイベントも存在します。

> [!WARNING]
>
> **日付フィルターの利用条件**
>
> `start_date`と`end_date`を使用する場合は、`timezone`パラメーターも必ず渡してください。`start_date`と`end_date`は、常に両方を指定する必要があります。


## OpenAPI

````yaml /ja/api-reference/openapi.yaml get /projects/{projectId}/users/{userId}/message-history
openapi: 3.0.3
info:
  title: Notifly API
  version: 1.0.0
  contact:
    email: contact@notifly.tech
servers:
  - url: https://api.notifly.tech
    description: Notifly APIサーバー
security: []
tags:
  - name: catalog
    x-group: カタログ
paths:
  /projects/{projectId}/users/{userId}/message-history:
    get:
      summary: get-user-message-history
      operationId: getUserMessageHistory
      parameters:
        - name: projectId
          in: path
          required: true
          schema:
            type: string
            pattern: ^[0-9a-f]{32}$
          description: 32文字の16進文字列で表すプロジェクトIDです。
        - name: userId
          in: path
          required: true
          schema:
            type: string
            minLength: 1
          description: ユーザーの`external_user_id`です。
        - name: page_size
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
          description: 1ページの件数です。1から100まで指定でき、デフォルトは20件です。
        - name: cursor
          in: query
          required: false
          schema:
            type: string
          description: 前のレスポンスに含まれる`next_cursor`の値です。
        - name: channel
          in: query
          required: false
          schema:
            type: string
            enum:
              - push-notification
              - web-push-notification
              - email
              - text-message
              - kakao-alimtalk
              - kakao-friendtalk
              - kakao-brand-message
              - line
              - in-app-message
              - in-web-message
              - webhook
          description: チャネルで絞り込みます。
        - name: resource_type
          in: query
          required: false
          schema:
            type: string
            enum:
              - campaign
              - user_journey
          description: リソースの種類です。`campaign`または`user_journey`を指定します。
        - name: resource_id
          in: query
          required: false
          schema:
            type: string
          description: リソースIDです。指定する場合は`resource_type`も必須です。
        - name: start_date
          in: query
          required: false
          schema:
            type: string
            format: date
          description: >-
            検索範囲の開始日です。指定した日付も検索範囲に含まれます。`YYYY-MM-DD`形式で、`end_date`および`timezone`と一緒に指定します。
          example: '2026-03-01'
        - name: end_date
          in: query
          required: false
          schema:
            type: string
            format: date
          description: >-
            検索範囲の終了日です。指定した日付も検索範囲に含まれます。`YYYY-MM-DD`形式で、`start_date`および`timezone`と一緒に指定します。
          example: '2026-03-31'
        - name: timezone
          in: query
          required: false
          schema:
            type: string
          description: 日付の解釈に使うタイムゾーンです。`Asia/Seoul`などのIANA形式で指定します。
          example: Asia/Seoul
      responses:
        '200':
          description: メッセージ履歴を取得しました。
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      message_history:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              description: レコードIDです。
                            event_name:
                              type: string
                              description: イベント名です。
                            channel:
                              type: string
                              nullable: true
                              description: チャネルです。
                            resource_id:
                              type: string
                              nullable: true
                              description: キャンペーンIDまたはユーザージャーニーIDです。
                            sub_resource_id:
                              type: string
                              nullable: true
                              description: A/BテストのバリアントIDまたはユーザージャーニーのノードIDです。
                            resource_type:
                              type: string
                              nullable: true
                              enum:
                                - campaign
                                - user_journey
                              description: リソースの種類です。
                            created_at:
                              type: string
                              format: date-time
                              description: 作成時刻です。UTCのISO 8601形式です。
                            updated_at:
                              type: string
                              format: date-time
                              description: 更新時刻です。UTCのISO 8601形式です。
                      next_cursor:
                        type: string
                        nullable: true
                        description: 次のページを取得するカーソルです。最後のページでは`null`になります。
                  error:
                    type: string
                    nullable: true
              example:
                data:
                  message_history:
                    - id: abc123
                      event_name: send_success
                      channel: push-notification
                      resource_id: camp_001
                      sub_resource_id: var_001
                      resource_type: campaign
                      created_at: '2026-03-30T12:00:00.000Z'
                      updated_at: '2026-03-30T12:00:00.000Z'
                    - id: def456
                      event_name: push_click
                      channel: push-notification
                      resource_id: camp_001
                      sub_resource_id: var_001
                      resource_type: campaign
                      created_at: '2026-03-30T12:05:00.000Z'
                      updated_at: '2026-03-30T12:05:00.000Z'
                  next_cursor: eyJjcmVhdGVkX2F0IjoiMjAyNi0wMy0zMFQxMjowNTowMC4wMDBaIn0=
                error: null
        '400':
          description: リクエストパラメーターが不正です。
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: string
                    nullable: true
                  error:
                    type: string
              example:
                data: null
                error: Invalid project ID
        '401':
          description: 認証に失敗しました。
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: string
                    nullable: true
                  error:
                    type: string
              example:
                data: null
                error: 'Unauthorized: Invalid Authorization Token'
        '500':
          description: サーバー内部エラーです。
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: string
                    nullable: true
                  error:
                    type: string
              example:
                data: null
                error: 'Internal Server Error: some-error-message'
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: '`POST /authenticate`で発行したトークンをBearer形式で送信します。'

````

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