API 與 MCP

會員可以從自己的訂單系統(REST API)或 AI 助理(MCP)呼叫與網頁工具相同的排版引擎。兩者都以 JSON 回傳版面:每張畫布的長度,以及每一件的位置、尺寸與旋轉。要把版面變成可列印的 PNG,請使用網頁工具。

API 金鑰

API 與 MCP 存取目前是搶先體驗。請聯絡我們索取金鑰,並以 Authorization: Bearer <key> 傳送。每把金鑰有每日請求上限(預設 1,000 次)。

REST API

curl https://dtfnest.app/api/v1/nest \
  -H "Authorization: Bearer $DTFNEST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "profile_id": "xtool-apparel",
    "pieces": [
      { "id": "logo-front", "width_mm": 250, "height_mm": 280, "quantity": 3, "order_id": "1001" },
      { "id": "neck-label", "width_mm": 60, "height_mm": 40, "quantity": 12 }
    ]
  }'

限制:每次請求最多 500 個設計、共 2,000 件。錯誤會回傳 JSON,並以訊息指出要修正哪個欄位。請送出能辨識你應用程式的 User-Agent 標頭;User-Agent 為空,或是 Python urllib 預設值的請求,會被我們的防火牆擋下。

MCP 伺服器

端點 https://dtfnest.app/mcp(Streamable HTTP)。工具:list_printer_profiles 與 nest_layout。支援 MCP 協定 2026-07-28 與較早的 2025 年版本。客戶端設定範例:

{
  "mcpServers": {
    "dtfnest": {
      "type": "http",
      "url": "https://dtfnest.app/mcp",
      "headers": { "Authorization": "Bearer YOUR_DTFNEST_API_KEY" }
    }
  }
}

接著對你的助理說,例如:「幫 xTool 印表機排今天的 14 筆訂單,並告訴我用了多少膠膜。」