> ## 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]
>
> **前日分のデータを確認する時間**
>
> 前日分のデータは午前7時（KST）以降に確認してください。

> [!NOTE]
>
> **集計日**
>
> 日別データは、各イベントが発生した日付で集計、表示されます。たとえば、7月23日に送信したキャンペーンで7月24日にクリックが発生した場合、送信イベントは7月23日、クリックイベントは7月24日の集計に含まれます。

> [!NOTE]
>
> **メッセージ統計の詳細取得との違い**
>
> [メッセージ統計の詳細取得](https://docs.notifly.tech/ja/api-reference/get-campaign-statistics-retrieval.md)では、キャンペーンの指定が必要です。このAPIは、指定期間に集計されたキャンペーンとユーザージャーニーの日別件数を返します。`tags`を指定した場合は、指定したタグのいずれかに一致するキャンペーンのみが返され、ユーザージャーニーは含まれません。


## OpenAPI

````yaml /ja/api-reference/openapi.yaml post /v1/projects/{projectId}/statistics
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:
  /v1/projects/{projectId}/statistics:
    post:
      summary: get-campaign-statistics
      operationId: getCampaignStatistics
      parameters:
        - name: projectId
          in: path
          required: true
          schema:
            type: string
          description: プロジェクトIDです。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - start
                - end
              properties:
                start:
                  type: string
                  format: date
                  description: 集計対象の開始日です。韓国標準時（KST）の`yyyy-MM-dd`形式で指定します。
                end:
                  type: string
                  format: date
                  description: 集計対象の終了日です。韓国標準時（KST）の`yyyy-MM-dd`形式で指定します。リクエスト当日は対象外です。
                tags:
                  oneOf:
                    - type: array
                      items:
                        type: string
                    - type: string
                  description: >-
                    タグの配列またはカンマ区切りの文字列です。いずれかのタグに一致するキャンペーンが対象で、ユーザージャーニーは除外されます。
            example:
              start: '2025-06-01'
              end: '2025-06-07'
      responses:
        '200':
          description: 統計を取得しました。
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CampaignStatistics'
              example:
                - date: '2025-06-01'
                  resource_type: campaign
                  campaign_id: campaign_example
                  campaign_name: Welcome
                  variant_id: null
                  variant_name: null
                  tags:
                    - summer
                  channel: push-notification
                  channel_subtype: text
                  brand_message_target: null
                  message:
                    title: Welcome
                    body: Hello
                  message_sent: 1500
                  message_failed: 23
                  delivered: 1477
                  click: 234
                  conversion:
                    - name: purchase
                      type: total_count_conversion
                      count: 45
                - date: '2025-06-01'
                  resource_type: user_journey
                  user_journey_id: journey_example
                  user_journey_name: Onboarding
                  user_journey_node_id: node_example
                  user_journey_node_name: Welcome
                  channel: kakao-alimtalk
                  channel_subtype: null
                  brand_message_target: null
                  message: {}
                  message_sent: 892
                  message_failed: 5
                  delivered: null
                  click: 156
                  conversion: []
        '400':
          description: 日付の形式や範囲など、リクエストパラメーターが不正です。
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
              example:
                error: InvalidRequest
                message: ...
        '401':
          description: 認証に失敗しました。
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: Unauthorized
        '408':
          description: リクエストがタイムアウトしました。
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: RequestTimeout
        '500':
          description: サーバー内部エラーです。
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
              example:
                error: InternalServerError
                message: ...
      security:
        - bearerAuth: []
components:
  schemas:
    CampaignStatistics:
      type: object
      properties:
        date:
          type: string
          format: date
          description: 統計データの日付です。形式は`YYYY-MM-DD`です。
        resource_type:
          type: string
          enum:
            - campaign
            - user_journey
          description: リソースのタイプです。
        message:
          type: object
          nullable: true
          description: メッセージの内容です。構造はチャネルによって異なります。
        campaign_id:
          type: string
          nullable: true
          description: キャンペーンIDです。キャンペーンリソースの場合のみ存在します。
        campaign_name:
          type: string
          nullable: true
          description: キャンペーン名です。キャンペーンリソースの場合のみ存在します。
        variant_id:
          type: string
          nullable: true
          description: キャンペーンのA/BテストのバリアントIDです。バリアントIDがないキャンペーン行ではnullになります。
        variant_name:
          type: string
          nullable: true
          description: キャンペーンのA/Bテストのバリアント名です。バリアント名がないキャンペーン行ではnullになります。
        tags:
          type: array
          items:
            type: string
          description: キャンペーンタグのリストです。
        user_journey_id:
          type: string
          nullable: true
          description: ユーザージャーニーIDです。ユーザージャーニーリソースの場合のみ存在します。
        user_journey_name:
          type: string
          nullable: true
          description: ユーザージャーニー名です。ユーザージャーニーリソースの場合のみ存在します。
        user_journey_node_id:
          type: string
          nullable: true
          description: ユーザージャーニーのノードIDです。ユーザージャーニーリソースの場合のみ存在します。
        user_journey_node_name:
          type: string
          nullable: true
          description: ユーザージャーニーのノード名です。ユーザージャーニーリソースの場合のみ存在します。
        channel:
          type: string
          description: 送信チャネルの情報です。
        channel_subtype:
          type: string
          nullable: true
          description: 配信チャネルのサブタイプです。
        brand_message_target:
          type: string
          nullable: true
          description: カカオブランドメッセージの対象です。
        message_sent:
          type: integer
          nullable: true
          description: 送信成功数です。ポップアップでは表示回数です。チャネルが未対応の場合はnullです。
        message_failed:
          type: integer
          nullable: true
          description: 送信失敗数です。チャネルが未対応の場合はnullです。
        delivered:
          type: integer
          nullable: true
          description: 受信者に到達したメッセージ数です。チャネルがこの指標に対応していない場合は`null`です。
        click:
          type: integer
          nullable: true
          description: クリックされたメッセージ数です。チャネルがこの指標に対応していない場合は`null`です。
        conversion:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                description: コンバージョン名です。
              type:
                type: string
                description: コンバージョンのタイプです。
              count:
                type: number
                description: コンバージョン数またはコンバージョン売上の合計です。
          description: コンバージョンデータの配列です。
  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.