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

# 売上一覧取得

> 売上（管理画面「売上一覧」）の一覧を取得します。商品の売上とイベントの入金を1つの一覧で返し、`sales_type`（`product` / `event`）で区別します。`sales_type=event` の行の `id` はイベントの申込者IDで、売上詳細取得・更新・入金反映・削除の対象にはなりません（申込者の詳細は `GET /events/{project_id}/applicants/{applicant_id}` で取得します。`project_id` は `event.id`）。並びは売上日時（`created_at`）の降順です。

絞り込みの注意:
- `product_id` と `event_id` は同時に指定できません（`422`）
- `payment_type=bank_transfer`、`product_id`、`product_detail_id`、または `status` に `paid` 以外を指定したときはイベントの入金行を含みません。`event_id` を指定したときは商品の売上を含みません
- `status` は管理画面の選択肢と同じ `paid` / `pending` / `failed` の3値です（`refunded` / `cancelled` は指定できませんが応答の `status` には現れます）。`failed` は決済失敗フラグの立った売上も含みます
- `date_from` / `date_to` は売上日時の日付で、`date_to` はその日の終わりまで含みます
- `phone` にハイフンを含めて指定した場合はハイフンと空白を除いて比較します。`tracking_name` は登録経路名と最初のステップの登録経路名のどちらかに部分一致します
- 商品・商品詳細・購入者・登録者のいずれかが無い商品の売上、削除済みイベントの入金は含まれません


`GET`

```
https://api.utage-system.com/v1/purchases
```


## OpenAPI

````yaml GET /purchases
openapi: 3.0.3
info:
  title: UTAGE API
  description: >
    UTAGEのパブリックAPIです。ファネル、メール・LINE配信、会員サイト、イベント・予約、決済、メディアなどのリソースをプログラムから操作できます。


    ## 認証

    すべてのリクエストにAPIキーによるBearer認証が必要です（要素タイプ・LINEメッセージタイプ・配信条件タイプの参照エンドポイントを除く）。


    ```

    Authorization: Bearer {api_key}

    ```


    APIキーはUTAGE管理画面から発行できます。APIキーが未指定・無効・無効化済みの場合、またはアカウントが利用停止中の場合は `401
    Unauthorized`（`error.code` は `unauthorized`）が返されます。


    ## レート制限

    リクエスト数には以下の制限があります。表の値は既定値で、契約内容により異なる場合があります。


    | 分間上限 | 日間上限 |

    |----------|----------|

    | 60リクエスト/分（APIキー単位・暦の1分ごと） | 10,000リクエスト/日（アカウント単位・暦日ごと） |


    レスポンスヘッダーで分間上限の窓が終わる時刻を確認できます（分間の残数と日間の残数はヘッダーに含まれません）。


    | ヘッダー | 説明 |

    |----------|------|

    | X-RateLimit-Limit | 接続元IP単位でAPI全体に掛かる制限の上限値（APIキー単位の分間上限ではありません） |

    | X-RateLimit-Remaining | 接続元IP単位の制限の残りリクエスト数（分間上限の残数ではありません） |

    | X-RateLimit-Reset | APIキー単位の分間上限で、現在の1分間の窓が終わる（次の分が始まる）UNIXタイムスタンプ |


    上限を超えた場合は `429 Too Many Requests`（`error.code` は
    `rate_limit_exceeded`）が返されます。日間上限の超過時は `X-RateLimit-Reset`
    が翌日0:00になります（`X-RateLimit-Limit` / `X-RateLimit-Remaining`
    は超過時も接続元IP単位の値です）。認証不要のエンドポイントと読者作成（`POST
    /accounts/{account_id}/scenarios/{scenario_id}/readers`、`POST
    /accounts/{account_id}/line/friends/{friend_id}/readers`）はレート制限の対象外で、`X-RateLimit-Reset`
    ヘッダーは付きません。


    データを作成するAPIには、これとは別にAPI経由の作成件数の上限があります。超過時は `429` で `total_limit_exceeded` /
    `hourly_limit_exceeded` / `monthly_limit_exceeded`
    が返され、`details.resource_type` に対象のリソース種別が含まれます。


    ## エラーレスポンス

    エラー時は以下の形式で返されます。


    ```json

    {
      "error": {
        "code": "error_code",
        "message": "エラーメッセージ"
      }
    }

    ```


    エラーの種類によっては `error.details`
    に補足情報（バリデーションの項目別エラー、`retry_after`、`resource_type` など）が含まれます。
  version: '1.0'
  contact:
    name: UTAGE サポート
servers:
  - url: https://api.utage-system.com/v1
    description: UTAGE API
security:
  - BearerAuth: []
tags:
  - name: ファネル
    description: ファネルの作成・更新・一覧取得
  - name: ステップ
    description: ファネル内のステップの作成・更新・並び替え・一覧取得
  - name: ページ
    description: ステップ内のページの作成・更新・取得・削除・一覧取得
  - name: 配信アカウント
    description: 配信アカウントの作成・一覧取得
  - name: シナリオ
    description: シナリオの作成・一覧取得
  - name: メディア
    description: 動画・音声・通常メディアの一覧取得・アップロード・名称変更
  - name: 要素タイプ
    description: ファネルページ・レッスン・HTMLメールの要素タイプ定義、LINEメッセージタイプ・配信条件タイプの取得（認証不要）
  - name: ファネル統計
    description: ファネルの集計データ・登録者・登録経路の取得
  - name: 配信メッセージ
    description: 配信メッセージの作成・更新・テスト送信・配信統計、置き換え文字の取得
  - name: 読者
    description: 読者の作成・更新・取得、ラベル・配信履歴・開封/クリック履歴の取得
  - name: LINE
    description: LINE友だち・カスタム送信者・1対1チャット・テンプレート・テンプレートグループ・リッチメニュー・自動応答の操作
  - name: ラベル・共通読者・登録経路
    description: ラベル・共通読者・アクション・登録経路の操作
  - name: 登録経路
    description: ファネルの登録経路・登録経路グループの作成・取得・更新・削除
  - name: ファネルアクション
    description: ファネルアクション（管理画面「アクション設定」）の作成・取得・更新・削除とアクショングループの一覧取得
  - name: 登録フォーム・読者項目
    description: 読者項目と登録フォーム項目の作成・更新・取得・削除・並び替え
  - name: 連携
    description: Googleスプレッドシート連携アカウント・広告連携設定の一覧取得
  - name: 会員サイト
    description: 会員サイトの一覧取得・作成・取得・更新・削除・並び替え
  - name: コース
    description: 会員サイト配下のコースの一覧取得・作成・取得・更新・削除・並び替え
  - name: コースグループ
    description: コースグループの一覧取得・作成・取得・更新・削除
  - name: バンドル
    description: バンドル（受講生に開放するコース・コミュニティグループのセット）の一覧取得・作成・取得・更新・削除・並び替え
  - name: レッスン
    description: 会員サイトのレッスン・レッスングループの操作と、レッスンごと受講状況・受講完了者の取得
  - name: 受講生
    description: 会員サイトの受講生の作成・更新・取得・削除、受講状況・操作履歴の取得、コース・バンドルの登録受講生一覧
  - name: 登録コース・コミュニティ
    description: 受講生のバンドル・単一コース・コミュニティグループへの登録の追加・更新・解除・一覧取得
  - name: コミュニティグループ
    description: 会員サイトのコミュニティグループの一覧取得
  - name: イベント
    description: イベント（セミナー・説明会、個別相談・個別予約）の一覧取得・作成・取得・更新・削除
  - name: 日程
    description: イベントの日程の一覧取得・作成・取得・更新・削除
  - name: 日程設定
    description: 個別相談・個別予約タイプのイベントの日程設定（開催する曜日・時間帯・特定日の開催設定・担当者・日程の表示期間）の取得・更新
  - name: 申込フォーム・申込者項目
    description: イベントの申込フォームの基本項目・申込者項目の取得・更新
  - name: 申込者
    description: イベントの申込者の一覧取得・詳細取得・更新
  - name: イベントグループ
    description: イベントグループ（イベント一覧の「グループ管理」）の作成・更新・一覧取得・削除
  - name: 担当者
    description: 担当者（個別相談・個別予約の「担当者設定」）の作成・更新・一覧取得・削除と連携用リンクの発行・削除
  - name: 商品
    description: 商品の一覧取得・作成・取得・更新・削除・並び替え
  - name: 商品グループ
    description: 商品グループの一覧取得・作成・取得・更新・削除
  - name: 商品詳細
    description: 商品配下の商品詳細（価格・支払方法・決済代行会社・支払回数・購入後の動作・通知設定）の作成・更新・並び替え・取得・削除
  - name: 売上
    description: 売上の一覧・詳細取得、領収書・請求書設定の更新、銀行振込の入金反映、削除、月別・日別売上集計
paths:
  /purchases:
    get:
      tags:
        - 売上
      summary: 売上一覧取得
      description: >
        売上（管理画面「売上一覧」）の一覧を取得します。商品の売上とイベントの入金を1つの一覧で返し、`sales_type`（`product` /
        `event`）で区別します。`sales_type=event` の行の `id`
        はイベントの申込者IDで、売上詳細取得・更新・入金反映・削除の対象にはなりません（申込者の詳細は `GET
        /events/{project_id}/applicants/{applicant_id}` で取得します。`project_id` は
        `event.id`）。並びは売上日時（`created_at`）の降順です。


        絞り込みの注意:

        - `product_id` と `event_id` は同時に指定できません（`422`）

        - `payment_type=bank_transfer`、`product_id`、`product_detail_id`、または
        `status` に `paid` 以外を指定したときはイベントの入金行を含みません。`event_id`
        を指定したときは商品の売上を含みません

        - `status` は管理画面の選択肢と同じ `paid` / `pending` / `failed` の3値です（`refunded` /
        `cancelled` は指定できませんが応答の `status` には現れます）。`failed` は決済失敗フラグの立った売上も含みます

        - `date_from` / `date_to` は売上日時の日付で、`date_to` はその日の終わりまで含みます

        - `phone` にハイフンを含めて指定した場合はハイフンと空白を除いて比較します。`tracking_name`
        は登録経路名と最初のステップの登録経路名のどちらかに部分一致します

        - 商品・商品詳細・購入者・登録者のいずれかが無い商品の売上、削除済みイベントの入金は含まれません
      operationId: listPurchases
      parameters:
        - name: date_from
          in: query
          description: 期間の開始日（YYYY-MM-DD）。売上日時がこの日以降の売上
          schema:
            type: string
        - name: date_to
          in: query
          description: 期間の終了日（YYYY-MM-DD）。売上日時がこの日までの売上
          schema:
            type: string
        - name: payment_type
          in: query
          description: >-
            支払方法で絞り込み。credit_card: クレジットカード払い / bank_transfer:
            銀行振込（イベントの入金行は含まれなくなります）
          schema:
            type: string
            enum:
              - credit_card
              - bank_transfer
        - name: product_id
          in: query
          description: 商品IDで絞り込み（イベントの入金行は含まれなくなります）。`event_id` とは同時に指定できません
          schema:
            type: string
        - name: event_id
          in: query
          description: イベントIDで絞り込み（そのイベントの入金行だけになり、商品の売上は含まれません）。`product_id` とは同時に指定できません
          schema:
            type: string
        - name: product_detail_id
          in: query
          description: 商品詳細IDで絞り込み（イベントの入金行は含まれなくなります）
          schema:
            type: string
        - name: amount_from
          in: query
          description: 金額の下限（この金額以上の売上）
          schema:
            type: integer
        - name: amount_to
          in: query
          description: 金額の上限（この金額以下の売上）
          schema:
            type: integer
        - name: name
          in: query
          description: 購入者の名前で部分一致検索
          schema:
            type: string
        - name: mail
          in: query
          description: 購入者のメールアドレスで部分一致検索
          schema:
            type: string
        - name: phone
          in: query
          description: 購入者の電話番号で部分一致検索（ハイフンを含めて指定するとハイフンと空白を除いて比較します）
          schema:
            type: string
        - name: tracking_name
          in: query
          description: 登録経路名で部分一致検索（登録経路名と最初のステップの登録経路名のどちらかに一致）
          schema:
            type: string
        - name: status
          in: query
          description: >-
            ステータスで絞り込み。paid: 決済成功 / pending: 振込待ち / failed: 決済失敗（paid
            以外を指定するとイベントの入金行は含まれなくなります）
          schema:
            type: string
            enum:
              - paid
              - pending
              - failed
        - name: is_test_mode
          in: query
          description: 決済モードで絞り込み（true はテストモード、false は本番モード。未指定は両方）
          schema:
            type: boolean
        - $ref: '#/components/parameters/Page'
        - $ref: '#/components/parameters/PerPage'
      responses:
        '200':
          description: 売上一覧
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/PaymentPurchaseListItem'
                  meta:
                    $ref: '#/components/schemas/PaginationMeta'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: >
            絞り込みパラメータが不正です（`validation_error`。`details`
            に項目別のエラー）。日付の形式（`YYYY-MM-DD` 以外、実在しない日付）、enum 外の値、`product_id` と
            `event_id` の同時指定に返ります。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: validation_error
                  message: 入力内容に誤りがあります
                  details:
                    event_id:
                      - product_id と同時に指定できません
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
components:
  parameters:
    Page:
      name: page
      in: query
      description: ページ番号
      schema:
        type: integer
        minimum: 1
    PerPage:
      name: per_page
      in: query
      description: 1ページあたりの件数（既定20・最大100。超過時は100に丸められます）
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 20
  schemas:
    PaymentPurchaseListItem:
      type: object
      description: 売上一覧の1行（商品の売上とイベントの入金で同じ構造）
      properties:
        id:
          type: string
          description: 売上ID（`sales_type=event` の行はイベントの申込者ID）
        sales_type:
          type: string
          enum:
            - product
            - event
          description: '種別。product: 商品の売上 / event: イベントの入金'
        created_at:
          type: string
          nullable: true
          description: 売上日時（Y-m-d H:i:s）
        updated_at:
          type: string
          nullable: true
          description: 更新日時（Y-m-d H:i:s）
        product:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PaymentPurchaseReference'
          description: 商品（`sales_type=event` は null）
        product_detail:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PaymentPurchaseReference'
          description: 商品詳細（`sales_type=event` は null）
        event:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PaymentPurchaseReference'
          description: イベント（`sales_type=product` は null）
        amount:
          type: integer
          nullable: true
          description: 金額（円）。イベントの入金は入金額
        payment_type:
          type: string
          enum:
            - credit_card
            - bank_transfer
          description: >-
            支払方法。credit_card: クレジットカード払い / bank_transfer: 銀行振込（イベントの入金は常に
            credit_card）
        status:
          type: string
          enum:
            - paid
            - pending
            - failed
            - refunded
            - cancelled
          description: >-
            ステータス。paid: 決済成功 / pending: 振込待ち / failed: 決済失敗 / refunded: 返金済み /
            cancelled: キャンセル。決済失敗フラグの立った売上は保存されたステータスに関わらず failed（イベントの入金は常に
            paid）
        is_test_mode:
          type: boolean
          description: 決済モード（true はテストモード、false は本番モード）
        customer:
          $ref: '#/components/schemas/PaymentPurchaseCustomer'
        tracking_name:
          type: string
          nullable: true
          description: 登録経路名
        first_step_tracking_name:
          type: string
          nullable: true
          description: 最初のステップの登録経路名
        partner:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/PaymentPurchasePartnerSummary'
          description: パートナー（紹介者が無い売上・イベントの入金は null）
    PaginationMeta:
      type: object
      properties:
        current_page:
          type: integer
          description: 現在のページ番号
        per_page:
          type: integer
          description: 1ページあたりの件数
        total:
          type: integer
          description: 全件数
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: エラーコード
            message:
              type: string
              description: エラーメッセージ
            details:
              type: object
              nullable: true
              description: >-
                エラーの補足情報（`retry_after` /
                `resource_type`、項目別のエラーメッセージ等）。エラー種別により含まれる場合があります。`422`
                の項目別エラーの値は通常はメッセージの配列ですが、会員サイト更新・コース更新の変更時だけ行う検証では文字列です。
    PaymentPurchaseReference:
      type: object
      description: 売上が紐づく商品・商品詳細・イベント
      properties:
        id:
          type: string
          description: ID（商品ID / 商品詳細ID / イベントID）
        name:
          type: string
          nullable: true
          description: 名称（商品名 / 商品詳細の名称 / イベント名）。商品詳細の名称は売上に記録された購入時点の名称で、商品詳細を改名しても変わりません
    PaymentPurchaseCustomer:
      type: object
      description: 購入者（商品の売上は購入者情報、イベントの入金は申込者情報）
      properties:
        name:
          type: string
          nullable: true
          description: 名前
        mail:
          type: string
          nullable: true
          description: メールアドレス
        phone:
          type: string
          nullable: true
          description: 電話番号
        zipcode:
          type: string
          nullable: true
          description: 郵便番号
        pref:
          type: string
          nullable: true
          description: 都道府県
        city:
          type: string
          nullable: true
          description: 市区町村
        address:
          type: string
          nullable: true
          description: 番地
        building:
          type: string
          nullable: true
          description: 建物名
    PaymentPurchasePartnerSummary:
      type: object
      description: パートナー（一覧用）
      properties:
        name:
          type: string
          description: パートナー名
  responses:
    Unauthorized:
      description: 認証エラー。APIキーが未指定・無効・無効化済み、またはアカウントが利用停止中。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: unauthorized
              message: APIキーが無効です
    RateLimitExceeded:
      description: >-
        レート制限超過（`rate_limit_exceeded`）。`X-RateLimit-Reset`
        の時刻（`details.retry_after` がある場合はその日時）以降に再試行してください。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: rate_limit_exceeded
              message: レート制限を超過しました
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: APIキーをBearerトークンとして指定

````

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