> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opigno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Accept/decline/cancel user invitation

Once the user invitation created, the invitee can accept or decline it.
Also, the initiator of the invitation can cancel it, if it is still in the pending state.
The list of operations is available under the `cta` parameter in `UserInvitation` object (see an example [here](/OpignoEnterpriseAPI/UserConnection/CreateUserInvitation)).

## Accept invitation

Only pending invitation can be accepted by the user associated with invitee context.
If invitation accepted, the mutual connection is created and two users are added to each other's network.

To accept an invitation, `acceptUserInvitation` mutation should be used.
It has one required incoming argument - `invitationId`.

<CodeGroup>
  ```filename GraphQL theme={null}
    mutation acceptUserInvitation {
      acceptUserInvitation(invitationId: 1) {
        response {
          id
          isAccepted
        }
        errors
      }
    }
  ```

  ```File Query result [expandable] theme={null}
  {
    "data": {
      "acceptUserInvitation": {
        "response": {
          "id": "1",
          "isAccepted": true,
        }
        "errors": []
      }
    }
  }
  ```
</CodeGroup>

If the mutation executed successfully, a `UserInvitation` object will be returned in the response.

## Decline invitation

Pending invitation can be declined by the user associated with the invitee context.
If invitation declined, the connection between two users will not be created, and the new invitation can be sent to the same invitee.

To decline an invitation, use `declineUserInvitation` mutation. As in the previous example, this mutation has one required incoming argument - `invitationId`.

<CodeGroup>
  ```filename GraphQL theme={null}
    mutation declineUserInvitation {
      declineUserInvitation(invitationId: 2) {
        response
        errors
      }
    }
  ```

  ```File Query result [expandable] theme={null}
    {
      "data": {
        "declineUserInvitation": {
          "response": true,
          "errors": []
        }
      }
    }
  ```
</CodeGroup>

If mutation executed without any errors, boolean value will be returned in the response indicating the execution status.
If `true` returned, mutation has been executed without any issues, and the invitation has been declined.

## Cancel invitation

Pending invitation can be cancelled by the user associated with the initiator context.

To cancel the invitation, use `cancelUserInvitation` mutation. This mutation also has one required incoming argument - `invitationId`.

<CodeGroup>
  ```filename GraphQL theme={null}
    mutation cancelUserInvitation {
      cancelUserInvitation(invitationId: 3) {
        response
        errors
      }
    }
  ```

  ```File Query result [expandable] theme={null}
  {
    "data": {
      "cancelUserInvitation": {
        "response": true,
        "errors": []
      }
    }
  }
  ```
</CodeGroup>
