テンプレート
ワークフローテンプレート
新しいワークフローを作成する際、空のワークフローから始めるか、既存のテンプレートを使用するかを選択できます。
テンプレートは以下を提供します:
- スムーズなスタートを支援:n8n には、すでに必要な処理を行うテンプレートが用意されている可能性があります。
- 構築可能なワークフローの例
- 独自のワークフロー作成におけるベストプラクティス
テンプレートへのアクセス
Templates を選択して、テンプレートライブラリを表示します。
n8n のテンプレートライブラリを使用している場合、n8n ウェブサイトのワークフロー一覧に移動します。組織が提供するカスタムライブラリを使用している場合は、アプリ内からテンプレートを検索・閲覧できます。
ワークフローを n8n ライブラリに追加する
n8n では現在、クリエイタープログラムおよびテンプレートのマーケットプレイスを開発中です。これは進行中のプロジェクトであり、詳細は今後変更される可能性があります。
セルフホスト版 n8n:独自のライブラリを使用する
環境変数で N8N_TEMPLATES_HOST を、カスタム API のベース URL に設定してください。
エンドポイント
カスタム API は、n8n のものと同じエンドポイントとデータ構造を提供する必要があります。
エンドポイントは以下の通りです:
| Method | Path | 目的 |
|---|---|---|
| GET | /templates/workflows/ | プレビュー/閲覧用のテンプレートメタデータを取得 |
| GET | /workflows/templates/ | キャンバスにインポートするワークフローデータを取得 |
| GET | /templates/search | ワークフローテンプレートを検索 |
| GET | /templates/collections/ | 特定のテンプレートコレクションを取得 |
| GET | /templates/collections | すべてのテンプレートコレクションを一覧表示 |
| GET | /templates/categories | すべてのテンプレートカテゴリを一覧表示 |
| GET | /health | ヘルスチェックエンドポイント |
重要:2種類の異なるレスポンス形式が必要
2つのワークフロー関連エンドポイントには 異なるレスポンス形式 が求められます:
/templates/workflows/:テンプレートそのものを返し、workflowキー内にワークフローを含みます。/workflows/templates/:テンプレートに含まれるワークフローのみを返します。
詳細は下記のスキーマをご確認ください。
クエリパラメータ
/templates/search エンドポイントは以下のクエリパラメータを受け付けます:
| パラメータ | 型 | 説明 |
|---|---|---|
page | integer | 取得する結果のページ番号 |
rows | integer | 1ページあたりの最大結果数 |
category | カンマ区切りの文字列(カテゴリ) | 検索対象のカテゴリ |
search | string | 検索クエリ |
/templates/collections エンドポイントは以下のクエリパラメータを受け付けます:
| パラメータ | 型 | 説明 |
|---|---|---|
category | カンマ区切りの文字列(カテゴリ) | 検索対象のカテゴリ |
search | string | 検索クエリ |
スキーマ
2つのワークフロー関連エンドポイントの主な違い:
// GET /templates/workflows/ は(ラップされた形式で)返す:
{
"id": "...",
"name": "...",
...
"workflow": {
"nodes": [...],
"connections": {...},
...
}
}
// GET /workflows/templates/ は(フラット形式:ネストされていない構造で)返す:
{
"nodes": [...],
"connections": {...},
...
}
レスポンスオブジェクトの詳細スキーマ
workflow オブジェクトのスキーマ
/templates/workflows/ エンドポイントで使用(workflow キー内にネスト)。
このスキーマは、検索/閲覧 UI でテンプレートを表示するためのメタデータを記述します。実際のインポート可能なワークフロー定義を含むネストされた workflow プロパティが含まれます。
Workflow item data schema
{
"type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string" },
"totalViews": { "type": "integer" },
"price": { "type": ["number", "null"] },
"purchaseUrl": { "type": ["string", "null"] },
"recentViews": { "type": "integer" },
"createdAt": { "type": "string", "format": "date-time" },
"user": {
"type": "object",
"properties": {
"username": { "type": "string" },
"verified": { "type": "boolean" }
},
"required": ["username", "verified"]
},
"nodes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "string" },
"icon": { "type": "string" },
"name": { "type": "string" },
"codex": {
"type": "object",
"properties": {
"resources": {
"type": "object",
"properties": {
"primaryDocumentation": {
"type": "object",
"properties": {
"url": { "type": "string" }
},
"required": ["url"]
}
}
},
"categories": {
"type": "array",
"items": { "type": "string" }
},
"nodeVersion": { "type": "integer" },
"codexVersion": { "type": "integer" }
},
"required": ["categories"]
},
"group": { "type": "array", "items": { "type": "string" } },
"defaults": {
"type": "object",
"properties": {
"name": { "type": "string" },
"color": { "type": "string" }
},
"required": ["name"]
},
"iconData": {
"type": "object",
"properties": {
"type": { "type": "string" },
"fileBuffer": { "type": "string" }
},
"required": ["type"]
},
"displayName": { "type": "string" },
"typeVersion": { "type": "integer" },
"nodeCategories": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string" }
},
"required": ["id", "name"]
}
}
},
"required": [
"id", "icon", "name", "codex", "group",
"defaults", "iconData", "displayName", "typeVersion"
]
}
},
"description": { "type": "string" },
"image": {
"type": "object",
"properties": {
"url": { "type": "string" }
}
},
"categories": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string" }
}
}
},
"workflowInfo": {
"type": "object",
"properties": {
"nodeTypes": { "type": "array", "items": { "type": "string" } }
}
},
"workflow": {
"type": "object",
"properties": {
"nodes": { "type": "array" },
"connections": { "type": "object" },
"settings": { "type": "object" },
"pinData": { "type": ["object", "null"] }
},
"required": ["nodes", "connections"]
}
},
"required": [
"id", "name", "totalViews", "createdAt",
"user", "nodes", "workflow"
]
}
category オブジェクトのスキーマ
Category item data schema
{
"type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string" }
},
"required": ["id", "name"]
}
collection オブジェクトのスキーマ
Collection item data schema
{
"type": "object",
"properties": {
"id": { "type": "string" },
"rank": { "type": "integer" },
"name": { "type": "string" },
"totalViews": { "type": "integer" },
"createdAt": { "type": "string", "format": "date-time" },
"workflows": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "string" }
},
"required": ["id"]
}
},
"nodes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string" }
}
}
}
},
"required": [
"id", "rank", "name", "totalViews",
"createdAt", "workflows", "nodes"
]
}
n8n の API エンドポイントをインタラクティブに確認することもできます:
- https://api.n8n.io/templates/categories
- https://api.n8n.io/templates/collections
- https://api.n8n.io/templates/search
- https://api.n8n.io/health
サポートが必要な場合は、お問い合わせください。