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

# 創建 Iframe 組件

> 創建一個新的可嵌入聊天組件配置，並將其關聯到某個 API 密鑰。

## 請求

<ParamField body="api_key_id" type="string" required>
  要關聯此組件的 API 密鑰 ID。該組件將使用此密鑰的額度、Brand Soul 以及允許的來源域名。
</ParamField>

<ParamField body="name" type="string" optional>
  組件的顯示名稱。默認值：`"My Widget"`。
</ParamField>

<ParamField body="appearance" type="object" optional>
  外觀自定義設置：`primaryColor`、`position`（`bottom-right` | `bottom-left`）、`borderRadius`、`fontFamily`，以及自定義 CSS 覆蓋項。
</ParamField>

<ParamField body="behavior" type="object" optional>
  行為設置：`welcomeMessage`、`placeholder`、`maxPromptLength`、`enableFileUpload`、`enableVoice`、`strictAbuse`（啓用限流啓發式策略）。
</ParamField>

<ParamField body="security" type="object" optional>
  安全設置：`requireTurnstile`（機器人防護）、`allowedOrigins`（覆蓋允許的來源域名白名單）。
</ParamField>

## 響應

<ResponseField name="id" type="string">
  組件配置的 UUID。在嵌入腳本中將其用作 `configId`。
</ResponseField>

<ResponseField name="name" type="string">
  組件的顯示名稱。
</ResponseField>

<ResponseField name="status" type="string">
  `"active"` 或 `"disabled"`。
</ResponseField>

<ResponseField name="embed_snippet" type="string">
  可直接使用的 HTML `<script>` 標籤，用於嵌入到你的網站中。
</ResponseField>

## 身份驗證

需要儀表盤會話。

## 示例

```bash curl theme={null}
curl -X POST https://www.hitheo.ai/api/v1/iframes \
  -H "Authorization: Bearer $THEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key_id": "key_abc123",
    "name": "Support Widget",
    "appearance": { "primaryColor": "#715eac" },
    "behavior": { "welcomeMessage": "Hi! How can I help?", "strictAbuse": true }
  }'
```


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