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

# 配信メッセージ テスト送信

> **プレビュー機能。仕様は今後変更される可能性があります。** 配信メッセージのテスト送信を実行します（`channel=mail` / `line` / `sms` のみ。`channel=action` は非対応で `400`）。

- `type=step` / `type=reminder` のメッセージは設定済みの日時指定を無視して即時テスト送信されます（本番配信のスケジュールはそのまま保持されます）。


`POST`

```
https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/messages/{message_id}/test-send
```

<Note>この機能はプレビュー版です。仕様が変更される場合があります。</Note>


## OpenAPI

````yaml POST /accounts/{account_id}/scenarios/{scenario_id}/messages/{message_id}/test-send
openapi: 3.0.3
info:
  title: UTAGE API
  description: |
    UTAGEのパブリックAPIです。ファネル、配信アカウント、シナリオ、メディアなどのリソースをプログラムから操作できます。

    ## 認証
    すべてのリクエストにAPIキーによるBearer認証が必要です（要素タイプエンドポイントを除く）。

    ```
    Authorization: Bearer {api_key}
    ```

    APIキーはUTAGE管理画面から発行できます。

    ## レート制限
    リクエスト数には以下の制限があります。

    | 分間上限 | 日間上限 |
    |----------|----------|
    | 60リクエスト/分 | 10,000リクエスト/日 |

    レスポンスヘッダーで現在の使用状況を確認できます。

    | ヘッダー | 説明 |
    |----------|------|
    | X-RateLimit-Limit | 分間の上限値 |
    | X-RateLimit-Remaining | 分間の残りリクエスト数 |
    | X-RateLimit-Reset | 制限がリセットされるUNIXタイムスタンプ |

    上限を超えた場合は `429 Too Many Requests` が返されます。

    ## エラーレスポンス
    エラー時は以下の形式で返されます。

    ```json
    {
      "error": {
        "code": "error_code",
        "message": "エラーメッセージ"
      }
    }
    ```
  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: ラベル・共通読者・アクション・登録経路の操作（プレビュー）
paths:
  /accounts/{account_id}/scenarios/{scenario_id}/messages/{message_id}/test-send:
    post:
      tags:
        - 配信メッセージ
      summary: 配信メッセージ テスト送信
      description: >
        **プレビュー機能。仕様は今後変更される可能性があります。** 配信メッセージのテスト送信を実行します（`channel=mail` /
        `line` / `sms` のみ。`channel=action` は非対応で `400`）。


        - `type=step` / `type=reminder`
        のメッセージは設定済みの日時指定を無視して即時テスト送信されます（本番配信のスケジュールはそのまま保持されます）。
      operationId: testSendMessage
      parameters:
        - $ref: '#/components/parameters/AccountId'
        - name: scenario_id
          in: path
          required: true
          description: シナリオID
          schema:
            type: string
        - name: message_id
          in: path
          required: true
          description: メッセージID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - to
              properties:
                to:
                  type: string
                  description: >
                    テスト送信先。媒体に応じて指定します。

                    - `mail`: メールアドレス

                    - `line`:
                    LINE友だちID（テストアカウントの友だちのみ指定可能。LINE友だち未登録の読者へは送信できません）

                    - `sms`: 電話番号
      responses:
        '200':
          description: |
            テスト送信に成功しました（`data.success=true`）。外部サービスでの送信に失敗した場合は `502` が返ります。
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      success:
                        type: boolean
                        description: テスト送信に成功したか（成功時は `true`）
        '400':
          description: |
            リクエストが不正です（`to` 未指定・形式不正、または未対応媒体 `action` のテスト送信）。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: validation_error
                  message: 送信先が不正です
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '502':
          description: >
            外部サービスとの連携（メール/LINE/SMSの送信）に失敗しました。通常のエラー形式（`error.code`）ではなく
            `data.success=false` と `data.error_message` で詳細が返ります。
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      success:
                        type: boolean
                        description: テスト送信に成功したか（失敗時は `false`）
                      error_message:
                        type: string
                        description: 送信失敗時のエラーメッセージ
              example:
                data:
                  success: false
                  error_message: 送信に失敗しました
components:
  parameters:
    AccountId:
      name: account_id
      in: path
      required: true
      description: アカウントID
      schema:
        type: string
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: エラーコード
            message:
              type: string
              description: エラーメッセージ
            details:
              type: object
              nullable: true
              description: エラーの補足情報（retry_afterやフィールド別エラー等）。エラー種別により含まれる場合があります。
  responses:
    Unauthorized:
      description: 認証エラー。APIキーが無効または未指定。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: unauthorized
              message: 認証に失敗しました
    NotFound:
      description: 指定されたリソースが見つかりません。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: not_found
              message: リソースが見つかりません
    RateLimitExceeded:
      description: レート制限超過。時間を空けて再試行してください。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: rate_limit_exceeded
              message: リクエスト上限を超えました。しばらく時間を空けて再試行してください
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: APIキーをBearerトークンとして指定

````