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

# アクション更新

> アクションを更新します。指定したフィールドのみ変更される部分更新です。
`details` を指定すると動作は全件置き換えになります（空配列で全削除。省略すると現在の動作を維持）。
取得応答の `details` をそのまま送り返した場合、変更の無い動作は参照先の存在確認をせずに保持します。
`type=google_spreadsheet` の動作を新しく指定・変更する場合、Googleスプレッドシート連携が使えない環境では 400（`bad_request`）になります。
タブ名（`spreadsheet_sheet_name`）をシートに解決できない場合は 422（`details.{動作の位置}.spreadsheet_sheet_name`）で、何も保存しません。


`PATCH`

```
https://api.utage-system.com/v1/accounts/{account_id}/actions/{action_id}
```


## OpenAPI

````yaml PATCH /accounts/{account_id}/actions/{action_id}
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:
  /accounts/{account_id}/actions/{action_id}:
    patch:
      tags:
        - ラベル・共通読者・登録経路
      summary: アクション更新
      description: >
        アクションを更新します。指定したフィールドのみ変更される部分更新です。

        `details` を指定すると動作は全件置き換えになります（空配列で全削除。省略すると現在の動作を維持）。

        取得応答の `details` をそのまま送り返した場合、変更の無い動作は参照先の存在確認をせずに保持します。

        `type=google_spreadsheet` の動作を新しく指定・変更する場合、Googleスプレッドシート連携が使えない環境では
        400（`bad_request`）になります。

        タブ名（`spreadsheet_sheet_name`）をシートに解決できない場合は
        422（`details.{動作の位置}.spreadsheet_sheet_name`）で、何も保存しません。
      operationId: updateAction
      parameters:
        - $ref: '#/components/parameters/AccountId'
        - name: action_id
          in: path
          required: true
          description: アクションID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  maxLength: 255
                  description: 管理用名称
                action_group_id:
                  type: string
                  nullable: true
                  description: >-
                    アクショングループのID（`GET /accounts/{account_id}/action-groups`
                    で取得）。null を指定すると未分類に変更します。存在しないIDは 422
                is_archived:
                  type: boolean
                  description: アーカイブ状態（true でアーカイブ、false で解除）
                details:
                  type: array
                  maxItems: 100
                  description: 動作の配列（配列順が実行順。最大100件）。指定すると全件置き換え
                  items:
                    $ref: '#/components/schemas/MessageActionDetail'
      responses:
        '200':
          description: 更新されたアクション
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/MessageAction'
        '400':
          description: Googleスプレッドシート連携が使えない環境で `type=google_spreadsheet` の動作を新しく指定・変更した
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: bad_request
                  message: Googleスプレッドシート連携は利用できません
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
components:
  parameters:
    AccountId:
      name: account_id
      in: path
      required: true
      description: 配信アカウントID
      schema:
        type: string
  schemas:
    MessageActionDetail:
      type: object
      description: >
        アクションの動作1件。`type` で動作の種類を指定し、種類ごとに使う項目が異なります。種類に関係ない項目は無視されます。

        ID はすべて各一覧・取得 API が返す文字列の ID です。種類ごとの項目（**太字**は必須）:


        - `scenario`（シナリオ遷移）:
        **scenario_id**・**scenario_action**・scenario_registration_type・use_inheriting_partner・use_inheriting_phone

        - `scenario_another_account`（別配信アカウントのシナリオに登録・停止）:
        **account_id**・**scenario_id**・**scenario_action**・scenario_registration_type・use_inheriting_partner・use_inheriting_phone

        - `message`（LINEメッセージ送信）: **message**

        - `template`（LINEテンプレートを送信）: **line_template_id**

        - `richmenuswitch`（LINEリッチメニューを変更）: rich_menu_id

        - `label`（ラベルを変更）: add_label_id・delete_label_id（いずれか必須）

        - `label_another_account`（別配信アカウントのラベルを変更）:
        **account_id**・add_label_id・delete_label_id（いずれか必須）

        - `webhook`（webhook）: **url**・data

        - `bundle_course`（バンドルへ登録）/ `bundle_course_cancel`（バンドルを停止）:
        **bundle_course_id**

        - `subscription_cancel`（継続課金を停止）: **product_id**

        - `share_funnel`（ファネルの共有ライセンスを発行）/
        `share_funnel_cancel`（ファネルの共有ライセンスを停止）: **funnel_id**

        - `google_spreadsheet`（Googleスプレッドシートへ追記）:
        **spreadsheet_account_id**・**spreadsheet_url**・**spreadsheet_sheet_name**・**sheet**


        更新で取得応答の動作をそのまま送り返した場合、変更の無い動作は参照先の存在確認をせずに保持します。

        項目の検証エラーは 422 で、`details` のキーは `details.{動作の位置}.{項目}` です（配信メッセージ API では
        `action_details.{位置}.{項目}`）。
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - webhook
            - scenario
            - scenario_another_account
            - label
            - label_another_account
            - message
            - template
            - richmenuswitch
            - share_funnel
            - share_funnel_cancel
            - bundle_course
            - bundle_course_cancel
            - subscription_cancel
            - google_spreadsheet
          example: scenario
          description: 動作の種類
        scenario_id:
          type: string
          nullable: true
          description: >-
            シナリオID（`scenario` は対象の配信アカウント、`scenario_another_account` は
            `account_id` の配信アカウントのシナリオ）
        scenario_action:
          type: string
          enum:
            - register
            - stop
          description: シナリオ動作。`register`=シナリオに登録、`stop`=シナリオを停止(配信解除)
        scenario_registration_type:
          type: string
          enum:
            - prohibit_multiple_registrations
            - allow_reregistration
            - allow_multiple_registrations
          default: prohibit_multiple_registrations
          description: >-
            重複登録。`prohibit_multiple_registrations`=禁止する(解除済みの場合でも再登録しない)、`allow_reregistration`=禁止する(解除済みの場合は再登録する)、`allow_multiple_registrations`=許可する。省略時は
            `prohibit_multiple_registrations`
        use_inheriting_partner:
          type: boolean
          default: false
          description: 紹介パートナー情報を引き継ぐか
        use_inheriting_phone:
          type: boolean
          default: false
          description: 電話番号を引き継ぐか
        account_id:
          type: string
          nullable: true
          description: 別の配信アカウントのID（同じ利用者の配信アカウント。対象の配信アカウント自身は指定できません）
        add_label_id:
          type: string
          nullable: true
          description: >-
            付けるラベルのID（`label` は対象の配信アカウント、`label_another_account` は `account_id`
            の配信アカウントのラベル）
        delete_label_id:
          type: string
          nullable: true
          description: 外すラベルのID
        message:
          type: string
          nullable: true
          description: LINEで送信するメッセージ本文。配信済みメッセージから取得した置換URLや `rid` パラメータ付きのURLは指定できません
        line_template_id:
          type: string
          nullable: true
          description: LINEテンプレートのID
        rich_menu_id:
          type: string
          nullable: true
          description: LINEリッチメニューのID。null のときはデフォルトメニューに変更します
        url:
          type: string
          maxLength: 1024
          description: webhook の送信先URL（`https://` で始まる1024文字以内。置き換え文字を含められます）
        data:
          type: array
          maxItems: 100
          description: webhook で送信するパラメータ（最大100件。`name`・`value` はそれぞれ必須・255文字以内）
          items:
            type: object
            properties:
              name:
                type: string
                maxLength: 255
                description: パラメータ名
              value:
                type: string
                maxLength: 255
                description: パラメータ値（置き換え文字を含められます）
        bundle_course_id:
          type: string
          nullable: true
          description: バンドルのID
        product_id:
          type: string
          nullable: true
          description: 商品ID（継続課金の商品詳細を持つ商品）
        funnel_id:
          type: string
          nullable: true
          description: >-
            ファネルID（共有元として設定しているファネル。`GET /funnels` の `share_source_only=true`
            で取得できます）
        spreadsheet_account_id:
          type: string
          nullable: true
          description: >-
            Googleアカウント（Googleスプレッドシート連携）のID（`GET /google-spreadsheet-accounts`
            で取得）
        spreadsheet_url:
          type: string
          maxLength: 255
          nullable: true
          description: >-
            スプレッドシートURL（255文字以内。`https://docs.google.com/spreadsheets/d/{スプレッドシートID}/edit`
            のようにIDの直後に `/` を含む形式）
        spreadsheet_sheet_name:
          type: string
          maxLength: 255
          nullable: true
          description: >-
            書き込み先シートのタブ名（255文字以内）。新しい動作では必須。更新で
            GoogleアカウントとスプレッドシートURLを変えない場合は省略でき、現在のシートを維持します。応答では保存しているシートのタブ名（Google
            から取得できない場合や連携が使えない環境では null）
        sheet:
          type: array
          minItems: 1
          maxItems: 100
          description: 書き込む列と値（1〜100件。`name`=列、`value`=値。各255文字以内）
          items:
            type: object
            properties:
              name:
                type: string
                maxLength: 255
                nullable: true
                description: 列
              value:
                type: string
                maxLength: 255
                nullable: true
                description: 値
    MessageAction:
      type: object
      properties:
        id:
          type: string
          description: アクションID
        name:
          type: string
          description: 管理用名称
        action_group_id:
          type: string
          nullable: true
          description: アクショングループのID（未分類の場合は null）
        is_archived:
          type: boolean
          description: アーカイブ状態
        details:
          type: array
          description: 動作（配列順が実行順）
          items:
            $ref: '#/components/schemas/MessageActionDetail'
        created_at:
          type: string
          description: 作成日時（Y-m-d H:i:s）
        updated_at:
          type: string
          description: 更新日時（Y-m-d H:i:s）
    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`
                の項目別エラーの値は通常はメッセージの配列ですが、会員サイト更新・コース更新の変更時だけ行う検証では文字列です。
  responses:
    Unauthorized:
      description: 認証エラー。APIキーが未指定・無効・無効化済み、またはアカウントが利用停止中。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: unauthorized
              message: APIキーが無効です
    NotFound:
      description: 指定されたリソースが見つかりません（`error.code` は `not_found`。`message` は資源ごとに異なります）。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: not_found
              message: ページが見つかりません
    ValidationError:
      description: >-
        バリデーションエラー（`error.code` は `validation_error`）。`details`
        に項目ごとのエラーメッセージが入ります（項目に紐づかない検証では `details` なし）。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: validation_error
              message: 入力内容に誤りがあります
              details:
                name:
                  - 管理用タイトルは必須です
    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.