|
1 | 1 | In your environment variables, set `N8N_TEMPLATES_HOST` to the base URL of your API.
|
2 | 2 |
|
| 3 | +### Endpoints |
| 4 | + |
3 | 5 | Your API must provide the same endpoints and data structure as n8n's.
|
4 | 6 |
|
5 | 7 | The endpoints are:
|
6 | 8 |
|
7 | 9 | | Method | Path |
|
8 | 10 | | ------ | ---- |
|
9 | 11 | | GET | /templates/workflows/`<id>` |
|
10 |
| -| GET | /templates/workflows | |
| 12 | +| GET | /templates/search | |
11 | 13 | | GET | /templates/collections/`<id>` |
|
12 | 14 | | GET | /templates/collections |
|
13 | 15 | | GET | /templates/categories |
|
14 | 16 | | GET | /health |
|
15 | 17 |
|
16 |
| -To learn about the data structure, try out n8n's API endpoints: |
| 18 | +### Query parameters |
| 19 | + |
| 20 | +The `/templates/search` endpoint accepts the following query parameters: |
| 21 | + |
| 22 | +| Parameter | Type | Description | |
| 23 | +|------------|----------------------------------------------|--------------------------------------------------| |
| 24 | +| `page` | integer | The page of results to return | |
| 25 | +| `rows` | integer | The maximum number of results to return per page | |
| 26 | +| `category` | comma-separated list of strings (categories) | The categories to search within | |
| 27 | +| `search` | string | The search query | |
| 28 | + |
| 29 | +The `/templates/collections` endpoint accepts the following query parameters: |
| 30 | + |
| 31 | +| Parameter | Type | Description | |
| 32 | +|------------|----------------------------------------------|---------------------------------| |
| 33 | +| `category` | comma-separated list of strings (categories) | The categories to search within | |
| 34 | +| `search` | string | The search query | |
| 35 | + |
| 36 | +### Data schema |
| 37 | + |
| 38 | +You can explore the data structure of the items in the response object returned by endpoints here: |
| 39 | + |
| 40 | +??? note "Show `workflow` item data schema" |
| 41 | + ```json title="Workflow item data schema" |
| 42 | + { |
| 43 | + "$schema": "http://json-schema.org/draft-07/schema#", |
| 44 | + "title": "Generated schema for Root", |
| 45 | + "type": "object", |
| 46 | + "properties": { |
| 47 | + "id": { |
| 48 | + "type": "number" |
| 49 | + }, |
| 50 | + "name": { |
| 51 | + "type": "string" |
| 52 | + }, |
| 53 | + "totalViews": { |
| 54 | + "type": "number" |
| 55 | + }, |
| 56 | + "price": {}, |
| 57 | + "purchaseUrl": {}, |
| 58 | + "recentViews": { |
| 59 | + "type": "number" |
| 60 | + }, |
| 61 | + "createdAt": { |
| 62 | + "type": "string" |
| 63 | + }, |
| 64 | + "user": { |
| 65 | + "type": "object", |
| 66 | + "properties": { |
| 67 | + "username": { |
| 68 | + "type": "string" |
| 69 | + }, |
| 70 | + "verified": { |
| 71 | + "type": "boolean" |
| 72 | + } |
| 73 | + }, |
| 74 | + "required": [ |
| 75 | + "username", |
| 76 | + "verified" |
| 77 | + ] |
| 78 | + }, |
| 79 | + "nodes": { |
| 80 | + "type": "array", |
| 81 | + "items": { |
| 82 | + "type": "object", |
| 83 | + "properties": { |
| 84 | + "id": { |
| 85 | + "type": "number" |
| 86 | + }, |
| 87 | + "icon": { |
| 88 | + "type": "string" |
| 89 | + }, |
| 90 | + "name": { |
| 91 | + "type": "string" |
| 92 | + }, |
| 93 | + "codex": { |
| 94 | + "type": "object", |
| 95 | + "properties": { |
| 96 | + "data": { |
| 97 | + "type": "object", |
| 98 | + "properties": { |
| 99 | + "details": { |
| 100 | + "type": "string" |
| 101 | + }, |
| 102 | + "resources": { |
| 103 | + "type": "object", |
| 104 | + "properties": { |
| 105 | + "generic": { |
| 106 | + "type": "array", |
| 107 | + "items": { |
| 108 | + "type": "object", |
| 109 | + "properties": { |
| 110 | + "url": { |
| 111 | + "type": "string" |
| 112 | + }, |
| 113 | + "icon": { |
| 114 | + "type": "string" |
| 115 | + }, |
| 116 | + "label": { |
| 117 | + "type": "string" |
| 118 | + } |
| 119 | + }, |
| 120 | + "required": [ |
| 121 | + "url", |
| 122 | + "label" |
| 123 | + ] |
| 124 | + } |
| 125 | + }, |
| 126 | + "primaryDocumentation": { |
| 127 | + "type": "array", |
| 128 | + "items": { |
| 129 | + "type": "object", |
| 130 | + "properties": { |
| 131 | + "url": { |
| 132 | + "type": "string" |
| 133 | + } |
| 134 | + }, |
| 135 | + "required": [ |
| 136 | + "url" |
| 137 | + ] |
| 138 | + } |
| 139 | + } |
| 140 | + }, |
| 141 | + "required": [ |
| 142 | + "primaryDocumentation" |
| 143 | + ] |
| 144 | + }, |
| 145 | + "categories": { |
| 146 | + "type": "array", |
| 147 | + "items": { |
| 148 | + "type": "string" |
| 149 | + } |
| 150 | + }, |
| 151 | + "nodeVersion": { |
| 152 | + "type": "string" |
| 153 | + }, |
| 154 | + "codexVersion": { |
| 155 | + "type": "string" |
| 156 | + } |
| 157 | + }, |
| 158 | + "required": [ |
| 159 | + "categories" |
| 160 | + ] |
| 161 | + } |
| 162 | + } |
| 163 | + }, |
| 164 | + "group": { |
| 165 | + "type": "string" |
| 166 | + }, |
| 167 | + "defaults": { |
| 168 | + "type": "object", |
| 169 | + "properties": { |
| 170 | + "name": { |
| 171 | + "type": "string" |
| 172 | + }, |
| 173 | + "color": { |
| 174 | + "type": "string" |
| 175 | + } |
| 176 | + }, |
| 177 | + "required": [ |
| 178 | + "name" |
| 179 | + ] |
| 180 | + }, |
| 181 | + "iconData": { |
| 182 | + "type": "object", |
| 183 | + "properties": { |
| 184 | + "icon": { |
| 185 | + "type": "string" |
| 186 | + }, |
| 187 | + "type": { |
| 188 | + "type": "string" |
| 189 | + }, |
| 190 | + "fileBuffer": { |
| 191 | + "type": "string" |
| 192 | + } |
| 193 | + }, |
| 194 | + "required": [ |
| 195 | + "type" |
| 196 | + ] |
| 197 | + }, |
| 198 | + "displayName": { |
| 199 | + "type": "string" |
| 200 | + }, |
| 201 | + "typeVersion": { |
| 202 | + "type": "number" |
| 203 | + }, |
| 204 | + "nodeCategories": { |
| 205 | + "type": "array", |
| 206 | + "items": { |
| 207 | + "type": "object", |
| 208 | + "properties": { |
| 209 | + "id": { |
| 210 | + "type": "number" |
| 211 | + }, |
| 212 | + "name": { |
| 213 | + "type": "string" |
| 214 | + } |
| 215 | + }, |
| 216 | + "required": [ |
| 217 | + "id", |
| 218 | + "name" |
| 219 | + ] |
| 220 | + } |
| 221 | + } |
| 222 | + }, |
| 223 | + "required": [ |
| 224 | + "id", |
| 225 | + "icon", |
| 226 | + "name", |
| 227 | + "codex", |
| 228 | + "group", |
| 229 | + "defaults", |
| 230 | + "iconData", |
| 231 | + "displayName", |
| 232 | + "typeVersion" |
| 233 | + ] |
| 234 | + } |
| 235 | + } |
| 236 | + }, |
| 237 | + "required": [ |
| 238 | + "id", |
| 239 | + "name", |
| 240 | + "totalViews", |
| 241 | + "price", |
| 242 | + "purchaseUrl", |
| 243 | + "recentViews", |
| 244 | + "createdAt", |
| 245 | + "user", |
| 246 | + "nodes" |
| 247 | + ] |
| 248 | + } |
| 249 | + ``` |
| 250 | + |
| 251 | +??? note "Show `category` item data schema" |
| 252 | + ```json title="Category item data schema" |
| 253 | + { |
| 254 | + "$schema": "http://json-schema.org/draft-07/schema#", |
| 255 | + "type": "object", |
| 256 | + "properties": { |
| 257 | + "id": { |
| 258 | + "type": "number" |
| 259 | + }, |
| 260 | + "name": { |
| 261 | + "type": "string" |
| 262 | + } |
| 263 | + }, |
| 264 | + "required": [ |
| 265 | + "id", |
| 266 | + "name" |
| 267 | + ] |
| 268 | + } |
| 269 | + ``` |
| 270 | + |
| 271 | +??? note "Show `collection` item data schema" |
| 272 | + ```json title="Collection item data schema" |
| 273 | + { |
| 274 | + "$schema": "http://json-schema.org/draft-07/schema#", |
| 275 | + "type": "object", |
| 276 | + "properties": { |
| 277 | + "id": { |
| 278 | + "type": "number" |
| 279 | + }, |
| 280 | + "rank": { |
| 281 | + "type": "number" |
| 282 | + }, |
| 283 | + "name": { |
| 284 | + "type": "string" |
| 285 | + }, |
| 286 | + "totalViews": {}, |
| 287 | + "createdAt": { |
| 288 | + "type": "string" |
| 289 | + }, |
| 290 | + "workflows": { |
| 291 | + "type": "array", |
| 292 | + "items": { |
| 293 | + "type": "object", |
| 294 | + "properties": { |
| 295 | + "id": { |
| 296 | + "type": "number" |
| 297 | + } |
| 298 | + }, |
| 299 | + "required": [ |
| 300 | + "id" |
| 301 | + ] |
| 302 | + } |
| 303 | + }, |
| 304 | + "nodes": { |
| 305 | + "type": "array", |
| 306 | + "items": {} |
| 307 | + } |
| 308 | + }, |
| 309 | + "required": [ |
| 310 | + "id", |
| 311 | + "rank", |
| 312 | + "name", |
| 313 | + "totalViews", |
| 314 | + "createdAt", |
| 315 | + "workflows", |
| 316 | + "nodes" |
| 317 | + ] |
| 318 | + } |
| 319 | + ``` |
| 320 | + |
| 321 | +You can also interactively explore n8n's API endpoints: |
| 322 | + |
| 323 | +[https://api.n8n.io/templates/categories](https://api.n8n.io/templates/categories) |
| 324 | +[https://api.n8n.io/templates/collections](https://api.n8n.io/templates/collections) |
| 325 | +[https://api.n8n.io/templates/search](https://api.n8n.io/templates/search) |
| 326 | +[https://api.n8n.io/health](https://api.n8n.io/health) |
17 | 327 |
|
18 |
| -[https://api.n8n.io/templates/categories](https://api.n8n.io/templates/categories){:target=_blank .external-link} |
19 |
| -[https://api.n8n.io/templates/collections](https://api.n8n.io/templates/collections){:target=_blank .external-link} |
20 |
| -[https://api.n8n.io/templates/workflows](https://api.n8n.io/templates/workflows){:target=_blank .external-link} |
21 |
| -[https://api.n8n.io/health](https://api.n8n.io/health){:target=_blank .external-link} |
22 | 328 |
|
23 |
| -You can also [contact us ](mailto:[email protected]) for more support. |
| 329 | +You can [contact us ](mailto:[email protected]) for more support. |
0 commit comments