diff --git a/openapi.yaml b/openapi.yaml
index 718d851..f69e364 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -487,6 +487,79 @@ paths:
"404":
$ref: '#/components/responses/NotFound'
+ /users/{id}/resend_invitation:
+ post:
+ tags: [Users]
+ summary: Resend a colleague's invitation
+ description: |
+ Sends a new invitation email to someone who was invited to an Organisation but hasn't yet set
+ their password (Manage Colleagues shows them as "Invited, not yet accepted"). The new link stops
+ the earlier one working. Makerble never emails a password: the invitation has a link where the
+ person sets their own, and this response never contains the link or its token.
+
+ Only an Organisation Admin of an Organisation the person is a colleague in can do this, as on
+ the Manage Colleagues page. Pass `organisation_id` to choose the Organisation the invitation is
+ for; without it, the first such Organisation is used. An address can be sent at most 3 new links
+ an hour.
+ operationId: resendInvitation
+ security: [{tokenAuth: []}]
+ parameters:
+ - $ref: '#/components/parameters/ResourceId'
+ requestBody:
+ required: false
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ organisation_id:
+ type: integer
+ description: The Organisation (Charity) to invite them into. Optional.
+ example:
+ organisation_id: 512
+ responses:
+ "200":
+ description: A new invitation is being sent
+ content:
+ application/json:
+ schema:
+ type: object
+ required: [id, email, organisation_id, invitation_status, message]
+ properties:
+ id:
+ type: integer
+ email:
+ type: string
+ organisation_id:
+ type: integer
+ invitation_status:
+ type: string
+ enum: [sent]
+ message:
+ type: string
+ example:
+ id: 4012
+ email: thandi@example.org
+ organisation_id: 512
+ invitation_status: sent
+ message: A new invitation is on its way. The earlier link no longer works.
+ "401":
+ $ref: '#/components/responses/Unauthorized'
+ "403":
+ $ref: '#/components/responses/ForbiddenError'
+ "404":
+ $ref: '#/components/responses/NotFound'
+ "422":
+ $ref: '#/components/responses/UnprocessableEntity'
+ "429":
+ description: The address has been sent 3 new links in the last hour
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ example:
+ error: This colleague has been sent 3 new links in the last hour. Try again later.
+
/users/permissions:
get:
tags: [Users]
diff --git a/server.js b/server.js
index ca37035..1d57e26 100644
--- a/server.js
+++ b/server.js
@@ -1507,6 +1507,17 @@ function buildDocsPage() {
{ code: "200", cls: "response-2xx", desc: "User record" },
{ code: "404", cls: "response-4xx", desc: "Not found" }
])}
+ ${endpointCard("POST", "/users/{id}/resend_invitation", "Resend a colleague's invitation", true, [
+ { name: "id", in: "path", type: "integer", required: true, desc: "User ID of someone invited but not yet accepted" },
+ { name: "organisation_id", in: "body", type: "integer", required: false, desc: "The Organisation to invite them into. Without it, the first Organisation they're a colleague in that you're an Organisation Admin of" }
+ ], [
+ { code: "200", cls: "response-2xx", desc: "{id, email, organisation_id, invitation_status: \"sent\", message}. Never the link or its token" },
+ { code: "401", cls: "response-4xx", desc: "Not authenticated" },
+ { code: "403", cls: "response-4xx", desc: "You aren't an Organisation Admin of that Organisation" },
+ { code: "404", cls: "response-4xx", desc: "Not found, or someone outside your Organisations" },
+ { code: "422", cls: "response-4xx", desc: "They have already set their password" },
+ { code: "429", cls: "response-4xx", desc: "They have been sent 3 new links in the last hour" }
+ ], "Sends a new invitation to someone shown as Invited, not yet accepted on Manage Colleagues, as its Resend invitation button does. Makerble never emails a password: the invitation has a link where they set their own. The new link stops the earlier one working.")}
${endpointCard("POST", "/users", "Create a new User", false, [], [
{ code: "200", cls: "response-2xx", desc: "User created — returns id and email" },
{ code: "422", cls: "response-4xx", desc: "Validation failed (check password requirements)" }