Invitation
These APIs handle user invitations and sign-ups for the platform. It includes functionality for creating and sending email invitations using Nodemailer, hashing passwords with node-forge, and also processes invitation acceptance, verifying details, and inserting new users and their wallets into the database.

1. Create Invitation
POST /create-invitation
Description
Creates an invitation for a new member to join a workspace. The invitation is sent via email and allows the member to join the workspace
Request Body
{
"email": "string",
"password": "string",
"area": "string",
"status": "string",
"encrypted_wallet": "string",
"wallet_address": "string",
"company_id": "string",
"operator_id": "string",
"index": "number"
}
Response
Status | Description |
---|---|
200 OK | Invitation sent successfully |
400 Bad Request | Missing required fields or invalid data. |
403 Forbidden | Member limit exceeded; cannot create more invitations. |
500 Internal Server Error | Failed to create the invitation due to internal errors. |
Response Object
{
"message": "Invitation sent successfully"
}
2. Accept Invitation
POST /accept-invitation
Description
Handles the acceptance of an invitation. The invitation is verified, and if valid, the user, wallet, and workspace membership are created.
Parameter Required
- invitationId:
string
- The ID of the invitation to accept.
Example Request
{
"invitationId": "invitationId123"
}
Response
Status | Description |
---|---|
200 OK | Invitation accepted successfully, and the user is added to the workspace. |
400 Bad Request | The invitation is invalid or has expired. |
500 Internal Server Error | Failed to accept the invitation due to internal errors. |
Example Response
{
"message": "Invitation accepted successfully"
}