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

# 建立邊

> 新增一條連接兩個節點的邊

## 請求

```bash theme={null}
POST https://api.pathors.com/v1/projects/{projectId}/pathway/edges
```

### 路徑參數

<ParamField path="projectId" type="string" required>專案 ID</ParamField>

### 標頭

<ParamField header="Authorization" type="string" required>
  使用您的 Developer Key 進行 Bearer 令牌認證
</ParamField>

### 請求主體

<ParamField body="id" type="string">
  選填的邊 ID。若未提供則自動產生。
</ParamField>

<ParamField body="source" type="string" required>
  來源節點 ID
</ParamField>

<ParamField body="target" type="string" required>
  目標節點 ID
</ParamField>

<ParamField body="condition" type="string" required>
  轉換條件（對話何時應從來源移動至目標）
</ParamField>

## 回應

回傳建立的邊，狀態碼為 `201`。

若來源或目標節點不存在，則回傳 `400`。

### 範例

```bash theme={null}
curl -X POST https://api.pathors.com/v1/projects/{projectId}/pathway/edges \
  -H "Authorization: Bearer dk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "node-1",
    "target": "node-2",
    "condition": "User confirms the booking"
  }'
```

```json theme={null}
{
  "data": {
    "id": "edge-node-1-node-2-1709827200000",
    "source": "node-1",
    "target": "node-2",
    "data": { "condition": "User confirms the booking" }
  }
}
```
