diff --git a/docs/api/api-reference-1.md b/docs/api/api-reference-1.md new file mode 100644 index 000000000..6a914b443 --- /dev/null +++ b/docs/api/api-reference-1.md @@ -0,0 +1,6 @@ +--- +hide: + - toc +--- + +!!swagger n8n-public-api-v1.yml!! \ No newline at end of file diff --git a/docs/api/api-reference-2.md b/docs/api/api-reference-2.md new file mode 100644 index 000000000..79e78f5ca --- /dev/null +++ b/docs/api/api-reference-2.md @@ -0,0 +1,5 @@ +--- +template: api.html +hide: + - toc +--- diff --git a/docs/api/index.md b/docs/api/index.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/api/n8n-public-api-v1.yml b/docs/api/n8n-public-api-v1.yml new file mode 100644 index 000000000..dc2d728f5 --- /dev/null +++ b/docs/api/n8n-public-api-v1.yml @@ -0,0 +1,305 @@ +--- +openapi: 3.0.0 +info: + title: Public n8n API + description: n8n Public API + termsOfService: https://n8n.io/legal/terms + contact: + email: hello@n8n.io + license: + name: Apache 2.0 with Commons Clause + url: https://github.com/n8n-io/n8n/blob/master/packages/cli/LICENSE.md + version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +servers: + # Added by API Auto Mocking Plugin + - description: SwaggerHub API Auto Mocking + url: https://virtserver.swaggerhub.com/RicardoE105/n8n/1.0.0 + - url: /api/v1 +tags: +- name: users + description: Operations about user + externalDocs: + description: Find out more about our store + url: http://swagger.io +paths: + /users: + get: + x-eov-operation-id: getUsers + x-eov-operation-handler: v1/handlers/Users + tags: + - users + summary: Retrieve all users + description: Retrieve all users from your instance. Only available for the instance owner + parameters: + - name: limit + in: query + description: The maximum number of items to return + required: false + schema: + type: number + example: 100 + default: 100 + - name: cursor + in: query + description: Paginate through users by setting the cursor parameter to a nextCursor attribute returned by a previous request's response. Default value fetches the first "page" of the collection. See pagination for more detail + required: false + style: form + explode: true + schema: + type: string + example: MTIzZTQ1NjctZTg5Yi0xMmQzLWE0NTYtNDI2NjE0MTc0MDA + - name: includeRole + in: query + required: false + style: form + explode: true + description: Whether to include the role information the user object + schema: + type: boolean + example: false + default: false + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/UserDetailsResponse' + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + post: + x-eov-operation-id: createUsers + x-eov-operation-handler: v1/handlers/Users + tags: + - users + summary: Invite a user + description: Invites a user to your instance. Only available for the instance owner. + operationId: createUser + requestBody: + description: Created user object + content: + application/json: + schema: + $ref: '#/components/schemas/UserInformation' + required: true + responses: + "200": + description: A User object + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/UserInformation' + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /users/{identifier}: + get: + x-eov-operation-id: getUser + x-eov-operation-handler: v1/handlers/Users + tags: + - users + summary: Get user by ID/Email + description: Retrieve a user from your instance. Only available for the instance owner. + operationId: getUser + parameters: + - name: identifier + in: path + description: The ID or email of the user + required: true + schema: + type: string + format: identifier + - name: includeRole + in: query + required: false + schema: + type: boolean + example: true + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/UserInformation' + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + delete: + x-eov-operation-id: deleteUser + x-eov-operation-handler: v1/handlers/Users + tags: + - users + summary: Delete user by ID/Email + description: Deletes a user from your instance. Only available for the instance owner. + operationId: deleteUser + parameters: + - name: identifier + in: path + description: The name that needs to be deleted + required: true + schema: + type: string + format: identifier + - name: transferId + in: query + description: ID of the user to transfer workflows and credentials to. + required: false + schema: + type: string + - name: includeRole + in: query + required: false + schema: + type: boolean + example: true + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/UserInformation' + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + "404": + description: User not found +components: + schemas: + Error: + required: + - code + - description + - message + type: object + properties: + code: + type: string + message: + type: string + description: + type: string + UserInformation: + required: + - email + type: object + properties: + id: + type: string + readOnly: true + example: 123e4567-e89b-12d3-a456-426614174000 + email: + type: string + format: email + example: jhon.doe@company.com + firstName: + maxLength: 32 + type: string + description: User's first name + readOnly: true + example: jhon + lastName: + maxLength: 32 + type: string + description: User's last name + readOnly: true + example: doe + isPending: + type: boolean + description: Whether the user finished setting up the invitation or not + readOnly: true + createdAt: + type: string + description: Time the user was created + format: date-time + readOnly: true + updatedAt: + type: string + description: Last time the user was updaded + format: date-time + readOnly: true + globalRole: + $ref: '#/components/schemas/RoleInformation' + UserDetailsResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/UserInformation' + nextCursor: + type: string + description: Paginate through users by setting the cursor parameter to a nextCursor attribute returned by a previous request. Default value fetches the first "page" of the collection. + nullable: true + example: MTIzZTQ1NjctZTg5Yi0xMmQzLWE0NTYtNDI2NjE0MTc0MDA + RoleInformation: + type: object + properties: + id: + type: number + readOnly: true + example: 1 + name: + type: string + example: owner + readOnly: true + scope: + type: string + readOnly: true + example: global + createdAt: + type: string + description: Time the role was created + format: date-time + readOnly: true + updatedAt: + type: string + description: Last time the role was updaded + format: date-time + readOnly: true + responses: + NotFound: + description: The specified resource was not found + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + Unauthorized: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + Forbidden: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + securitySchemes: + ApiKeyAuth: + type: apiKey + in: header + name: X-N8N-API-KEY + +security: + - ApiKeyAuth: [] \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 41db0e576..b8f814602 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -53,7 +53,10 @@ markdown_extensions: permalink: "#" plugins: - search + # https://github.com/oprypin/mkdocs-literate-nav - literate-nav + # https://github.com/bharel/mkdocs-render-swagger-plugin + - render_swagger nav: - Using n8n: - Welcome: index.md @@ -181,4 +184,8 @@ nav: - Execution data: hosting/scaling/execution-data.md - Execution modes and processes: hosting/scaling/execution-modes-processes.md - Configuring queue mode: hosting/scaling/queue-mode.md + - API: + - The n8n public API: api/index.md + - Endpoint reference using plugin: api/api-reference-1.md + - Endpoint reference using Swagger UI directly: api/api-reference-2.md - Contributing: contributing.md diff --git a/overrides/api.html b/overrides/api.html new file mode 100644 index 000000000..461328010 --- /dev/null +++ b/overrides/api.html @@ -0,0 +1,23 @@ +{% extends "main.html" %} + +{% block extrahead %} + +{% endblock %} +{% block content %} +
+ + + +{% endblock %} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 332ff1ce3..c563029e3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ mkdocs-literate-nav==0.4.1 +mkdocs-render-swagger-plugin==0.0.3