---
updatedAt: 2026-04-27T13:21:37.000Z
agentTools:
  projectIndex: https://developers.karte.io/llms.txt
---

# Create action

アクションの作成を行います。
テンプレートバージョンV3のテンプレートを指定した作成には対応していません

#### Required Scope
APIの実行に必要なScopeです。
```
beta.action.action.create
```

#### Required Role
管理画面でScopeを追加する際に必要な権限です。
```
接客サービス > 接客サービスの作成・編集
```


# OpenAPI definition

````json
{
  "openapi": "3.0.0",
  "servers": [
    {
      "url": "https://api.karte.io",
      "description": "Production server"
    },
    {
      "url": "https://api-jp.karte.io",
      "description": "Production JP server. リージョン固定オプションのプロジェクトはこちらのエンドポイントを利用してください."
    }
  ],
  "info": {
    "version": "2.0.0",
    "title": "Action"
  },
  "paths": {
    "/v2beta/action/action/create": {
      "post": {
        "tags": [
          "Action"
        ],
        "summary": "Create action",
        "description": "アクションの作成を行います。\nテンプレートバージョンV3のテンプレートを指定した作成には対応していません\n\n#### Required Scope\nAPIの実行に必要なScopeです。\n```\nbeta.action.action.create\n```\n\n#### Required Role\n管理画面でScopeを追加する際に必要な権限です。\n```\n接客サービス > 接客サービスの作成・編集\n```\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "template_id",
                  "query",
                  "campaign_id"
                ],
                "properties": {
                  "campaign_id": {
                    "type": "string",
                    "pattern": "^[a-f\\d]{24}$"
                  },
                  "template_id": {
                    "type": "string",
                    "pattern": "^[a-f\\d]{24}$"
                  },
                  "query": {
                    "$ref": "#/components/schemas/RequestCreateMessage"
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "campaign_id": "1234567890abcdef12345678",
                "template_id": "1234567890abcdef12345678",
                "query": {
                  "name": "name"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - variables配列にdata_typeが未指定、または不正な値が含まれている場合",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "エラーメッセージ"
                    }
                  },
                  "required": [
                    "error"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "error": "variables[0].data_type is required"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "x-karte-api",
            "schema": {
              "type": "string"
            },
            "description": "今後利用する可能性のある予約語です。現在は設定不要です。"
          },
          {
            "in": "header",
            "name": "authorization",
            "schema": {
              "type": "string"
            },
            "description": "認証情報を含むトークンです。\"Authorization\" ヘッダーに `Bearer <token>` の形式で設定してください。"
          },
          {
            "in": "header",
            "name": "content-type",
            "schema": {
              "type": "string"
            },
            "description": "リクエストのコンテンツタイプを指定します。通常は `application/json` を使用してください。"
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "RequestCreateMessage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "content": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "html",
              "source_html",
              "style",
              "less",
              "source_script",
              "script"
            ],
            "description": "※APIでアクションを管理する場合は、変数展開前の値利用を推奨しません（ [詳細はこちら](https://developers.karte.io/reference/deprecated-fields-of-actions) ）。 アクション・テンプレートの内容",
            "properties": {
              "html": {
                "type": "string",
                "description": "アクション・テンプレートのHTML（変数展開後）"
              },
              "source_html": {
                "type": "string",
                "nullable": true,
                "description": "アクション・テンプレートのHTML（変数展開前）"
              },
              "style": {
                "type": "string",
                "description": "アクション・テンプレートのCSS（変数展開後）"
              },
              "less": {
                "type": "string",
                "description": "アクション・テンプレートのCSS（変数展開前）。less形式"
              },
              "source_script": {
                "type": "string",
                "nullable": true,
                "description": "アクション・テンプレートのJavaScript（変数展開前）"
              },
              "script": {
                "type": "string",
                "description": "アクション・テンプレートのJavaScript（変数展開後）"
              }
            }
          },
          "variables": {
            "type": "array",
            "nullable": true,
            "description": "※APIでアクションを管理する場合は、利用を推奨しません（ [詳細はこちら](https://developers.karte.io/reference/deprecated-fields-of-actions) ） アクション・テンプレートの変数",
            "items": {
              "$ref": "#/components/schemas/ActionVariable"
            }
          }
        }
      },
      "Message": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "content": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "html": {
                "type": "string"
              },
              "source_html": {
                "type": "string",
                "nullable": true
              },
              "style": {
                "type": "string"
              },
              "less": {
                "type": "string"
              },
              "source_script": {
                "type": "string",
                "nullable": true
              },
              "script": {
                "type": "string"
              },
              "inlined_html": {
                "type": "string"
              },
              "text": {
                "type": "string"
              },
              "link": {
                "type": "string"
              },
              "options": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "required": [
              "html",
              "source_html",
              "style",
              "less",
              "source_script",
              "script"
            ],
            "additionalProperties": false
          },
          "variables": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "object",
              "additionalProperties": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "boolean"
                  }
                ]
              }
            }
          },
          "template_version": {
            "type": "string",
            "enum": [
              "1.0",
              "2.0",
              "3.0"
            ]
          },
          "template_content_types": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "string",
              "enum": [
                "embed",
                "remote_config",
                "webchat",
                "talk_permission",
                "survey",
                "survey2",
                "mail",
                "sms",
                "line",
                "messenger",
                "facebook_push",
                "native_app_push",
                "rewrite",
                "script",
                "customer_support"
              ]
            }
          },
          "require_plugin": {
            "type": "string",
            "nullable": true
          },
          "plugin_type": {
            "type": "string",
            "enum": [
              "webpopup",
              "talk",
              "event_delay",
              "remote_config",
              "webhook",
              "smc",
              "amazon_eventbridge",
              "talk_assign"
            ]
          },
          "view_type": {
            "type": "string",
            "enum": [
              "card",
              "notify",
              "script",
              "widget",
              "webchat"
            ]
          },
          "auto_generate_text_mail_from_html": {
            "type": "boolean"
          },
          "folders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "help": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "additionalProperties": true
            }
          },
          "shorten_id": {
            "type": "string"
          }
        },
        "additionalProperties": false,
        "required": [
          "id",
          "content",
          "template_content_types",
          "plugin_type",
          "variables",
          "require_plugin",
          "view_type",
          "template_version",
          "folders"
        ]
      },
      "ActionVariable": {
        "type": "object",
        "required": [
          "data_type"
        ],
        "additionalProperties": true,
        "properties": {
          "name": {
            "type": "string",
            "description": "変数名"
          },
          "value": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              }
            ],
            "description": "変数値"
          },
          "label": {
            "type": "string",
            "description": "変数のラベル"
          },
          "data_type": {
            "type": "string",
            "description": "変数のデータ型。APIでactionを作成/更新する際は必須。\n指定可能な値: `text`, `image`, `icon`, `color`, `number`, `boolean`, `url`, `jsonArray`, `collection`, `actionTable`, `dataTable`, `native_command`, `datahub_query_field`\n"
          },
          "is_required": {
            "type": "boolean",
            "description": "必須フラグ"
          },
          "is_hidden": {
            "type": "boolean",
            "description": "非表示フラグ"
          },
          "help": {
            "type": "string",
            "description": "ヘルプテキスト"
          }
        }
      }
    },
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "x-explorer-enabled": false
}
````