> For the complete documentation index, see [llms.txt](https://qbits-organization.gitbook.io/buildwise-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://qbits-organization.gitbook.io/buildwise-doc/organisation/organization-members-management/invitations.md).

# Invitations

Note: All endpoints on this page are public and do not require authentication.

Base URL: `/api/v1/`

*Note: All endpoints on this page are public and do not require authentication.*

***

### Get Invitation Information

Retrieves detailed information about an organisation invitation using the invitation token.

**GET** `/api/v1/invitation/info?token={invitationToken}`

#### Query Parameters

* **token**: The invitation token (required)

#### Success Response

```json
{
  "success": true,
  "httpStatus": "OK",
  "message": "Invitation information retrieved successfully",
  "action_time": "2025-05-28T12:29:55.373667",
  "data": {
    "organisationName": "Pied Piper",
    "organisationDescription": "Revolutionary data compression technology making the world a better place",
    "inviterName": "richardhendricks",
    "role": "MEMBER",
    "invitedEmail": "dineshchugtai@gmail.com",
    "invitedAt": "2025-05-28T12:29:10.876004",
    "expiresAt": "2025-06-04T12:29:10.876004",
    "status": "PENDING",
    "canAccept": true,
    "canDecline": true,
    "expired": false
  }
}
```

#### Error Responses

* **400**: Missing access token, invalid token format, or Invitation expired
* **404**: Invalid token
* **500**: Failed to retrieve invitation information

***

### Accept Invitation

Accepts an organisation invitation and adds the user to the organisation.

**POST** `/api/v1/invitation/accept?token={invitationToken}`

#### Query Parameters

* **token**: The invitation token (required)

#### Success Response

```json
{
  "success": true,
  "httpStatus": "OK",
  "message": "Invitation accepted successfully! Welcome to Pied Piper.",
  "data": null,
  "timestamp": "2025-05-28T10:30:00Z"
}
```

#### Error Responses

* **400**: Missing token, invitation expired, already a member
* **401**: Authentication required
* **403**: Email mismatch
* **404**: Invalid token
* **500**: Failed to accept the invitation due to internal server error

***

### Decline Invitation

Declines an organisation's invitation.

**POST** `/api/v1/invitation/decline?token={invitationToken}`

#### Query Parameters

* **token**: The invitation token (required)

#### Success Response

```json
{
  "success": true,
  "message": "Invitation to Pied Piper declined successfully.",
  "data": null,
  "timestamp": "2025-05-28T10:30:00Z"
}
```

#### Error Responses

* **400**: Invitation expired, missing token
* **401**: Authentication required to decline the invitation
* **403**: Email mismatch
* **404**: Invalid token
* **500**: Failed to decline the invitation due to internal server error

## Revoke Invitation

Revokes an organisation invitation, preventing the invited user from accepting it.

**`DELETE`**` ``/api/v1/invitation/revoke?invitationId={invitationId}&organisationId={organisationId}`

### Query Parameters

* invitationId: The UUID of the invitation to revoke (required)
* organisationId: The UUID of the organisation (required)

Success Response

```json
{
  "success": true,
  "httpStatus": "OK",
  "message": "Invitation revoked successfully.",
  "data": null,
  "timestamp": "2025-05-28T10:30:00Z"
}
```

#### Fail Response

```json
{
  "success": false,
  "httpStatus": "NOT_FOUND",
  "message": "Invitation not exist in this organisation",
  "action_time": "2025-05-28T10:30:00Z",
  "data": "Invitation not exist in this organisation"
}
```

### Error Responses

* **400**: Missing or invalid invitationId or organisationId, or invitation is not in PENDING status
* **401**: Authentication required to revoke the invitation
* **403**: User lacks permission to revoke invitations for this organisation
* **404**: Invitation or organisation not found
* **500**: Failed to revoke the invitation due to internal server error
