> ## 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.

# イベントを記録する

> ユーザーイベントまたはグローバルイベントをNotiflyに送信します。これらのイベントはキャンペーンのトリガー、セグメントの設定、メッセージのパーソナライズに使われます。

> [!NOTE]
>
> 複数のイベントを1回のリクエストで記録するには、同じ形式のイベントオブジェクトを配列で送信します。1回につき最大500件です。


## OpenAPI

````yaml /ja/api-reference/openapi.yaml post /track-event
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:
  /track-event:
    post:
      summary: track-event
      operationId: trackEvent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - projectId
                - eventName
                - userId
              properties:
                projectId:
                  type: string
                  description: >-
                    Notiflyが発行するプロジェクトIDです。**設定 > 製品とプロジェクト情報 >
                    プロジェクト情報**で確認できます。
                eventName:
                  type: string
                  description: イベント名です。
                eventParams:
                  type: object
                  description: イベントの追加パラメーターです。
                segmentationEventParamKeys:
                  type: array
                  items:
                    type: string
                  description: セグメントの判定で特別に処理するパラメーターのキーです。指定できるのは1つまでです。
                userId:
                  type: string
                  description: ユーザー識別子です。
            example:
              projectId: example_project_1234567890abcdef
              eventName: product_view
              userId: user_abc123
      responses:
        '200':
          description: イベントを記録しました。
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: 成功時のメッセージです。
              example:
                message: Successfully tracked events 3 events
        '400':
          description: リクエスト本文の形式が不正です。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientErrorResponse'
        '401':
          description: トークンが無効か期限切れのため、認証に失敗しました。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientErrorResponse'
        '500':
          description: サーバー内部エラーです。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    ClientErrorResponse:
      type: object
      properties:
        data:
          type: string
          nullable: true
          description: エラー時はnullです。
          example: null
        error:
          type: string
          description: エラーメッセージ
          example: Invalid Authorization Token
    ErrorResponse:
      type: object
      properties:
        data:
          type: string
          nullable: true
          description: エラー時はnullです。
          example: null
        error:
          type: string
          description: エラーメッセージ
        projectId:
          type: string
          nullable: true
          description: プロジェクトIDです。500エラーの場合のみ含まれます。
          example: null
        durationMs:
          type: integer
          nullable: true
          description: 処理時間です。単位はmsで、500エラーの場合のみ含まれます。
          example: null
  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.