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

# 建立節點

> 在 Pathway 中新增一個節點

## 請求

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

### 路徑參數

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

### 標頭

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

### 請求主體

<ParamField body="id" type="string" required>
  唯一的節點 ID
</ParamField>

<ParamField body="position" type="object" required>
  節點在畫布上的位置：`{ "x": number, "y": number }`
</ParamField>

<ParamField body="data" type="object" required>
  節點組態。必須包含 `type` 及該類型專屬的欄位。

  <Expandable title="fields">
    <ParamField body="data.type" type="string" required>`start`、`prompt`、`end` 或 `goto`</ParamField>
    <ParamField body="data.title" type="string" required>顯示標題</ParamField>
    <ParamField body="data.prompt" type="string">提示文字（`start`、`prompt`、`end` 為必填）</ParamField>
    <ParamField body="data.tools" type="string[]">綁定至此節點的工具 ID 陣列</ParamField>
    <ParamField body="data.referenceNodeId" type="string">目標節點 ID（`goto` 為必填）</ParamField>
  </Expandable>
</ParamField>

## 回應

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

若已存在相同 ID 的節點，則回傳 `409`。

### 範例

```bash theme={null}
curl -X POST https://api.pathors.com/v1/projects/{projectId}/pathway/nodes \
  -H "Authorization: Bearer dk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "node-booking",
    "position": { "x": 200, "y": 300 },
    "data": {
      "type": "prompt",
      "title": "Booking",
      "prompt": "Help the user complete their booking.",
      "tools": ["tool-uuid-1"]
    }
  }'
```
