# Add Or Update

This endpoint will add a new team member to the selected bot. If the member already exists, it will update the permission matrix using the supplied one.

Inviting a team member does not, by default, create a Xenioo account with the invited email. The user is still expected to signup to Xenioo as it happens with the standard workflow.

### Request

The following request will add a new operator to the bot specified in the authorization token. If the operator already exist it will be updated with the supplied permissions list.

```bash
curl --location --request POST 'https://<NODE>.xenioo.com/bot/team' \
--header 'Authorization: Bearer <BOT_AUTH_TOKEN>' \
--header 'Content-Type: application/json'
--data-raw '{
    "Email":"operator@somemail.com",
    "Group":"Main Support Team",
    "Permissions":{
          [... permissions ...]
    }
}'
```

### Team Invite

The request payload can contain also the password you would like to assign to your operator. If the password field is specified, Xenioo will automatically create an account for the new operator and will not send the standard invitation email.&#x20;

```bash
curl --location --request POST 'https://<NODE>.xenioo.com/bot/team' \
--header 'Authorization: Bearer <BOT_AUTH_TOKEN>' \
--header 'Content-Type: application/json'
--data-raw '{
    "Email":"operator@somemail.com",
    "Group":"Main Support Team",
    "Password":"Password123lol",
    "Permissions":{
          [... permissions ...]
    }
}'
```

Once created, the user password will not be updated by subsequent calls to this or to others chatbots: the user will need to use the Xenioo application to change security information.

{% hint style="warning" %}
If you specify a password, a user will be created automatically if the invited email does not exist.
{% endhint %}

If you wish to not specify the password and still skip the team invitation email, you can use the SkipInvite paramter as follows:

```
curl --location --request POST 'https://<NODE>.xenioo.com/bot/team' \
--header 'Authorization: Bearer <BOT_AUTH_TOKEN>' \
--header 'Content-Type: application/json'
--data-raw '{
    "Email":"operator@somemail.com",
    "Group":"Main Support Team",
    "SkipInvite": true,
    "Permissions":{
          [... permissions ...]
    }
}'
```

The following table lists all of the possible permissions that can be set into the permissions field. Please refer to the [Teams section](https://docs10.xenioo.com/basic-concepts/chatbot-details/chatbot-teams) for an advanced recap off all details.

|                           |
| ------------------------- |
| AssignConversation        |
| ControlConversation       |
| EditAI                    |
| EditBroadcasts            |
| EditChatbot               |
| ExportReports             |
| ForgetConversation        |
| PublishChatbot            |
| RunBroadcasts             |
| ViewAI                    |
| ViewBroadcasts            |
| ViewChatbotDesigner       |
| ViewConversation          |
| ViewGroupConversation     |
| ViewReportingDashboard    |
| EditDatabase              |
| ViewDatabase              |
| ViewContactDetails        |
| UnlockReference           |
| BackupChatbot             |
| CanShareAConversation     |
| EditAudience              |
| ViewConversationVariables |

All permissions that are not specified in the call will be set to false by default. The following call will create or update the team member activating only the ViewConversation and ViewConversationVariables flags.

```
curl --location --request POST 'https://<NODE>.xenioo.com/bot/team' \
--header 'Authorization: Bearer <BOT_AUTH_TOKEN>' \
--header 'Content-Type: application/json'
--data-raw '{
    "Email":"operator@somemail.com",
    "Group":"Main Support Team",
    "Permissions":{
          "ViewConversation":true,
          "ViewConversationVariables":true
    }
}'
```

### Response

If successful, the response will simply have a standard 200 OK code.

### Response Codes

This endpoint will reply with the following standard HTTP codes.

| Code | Meaning                                                                                        |
| ---- | ---------------------------------------------------------------------------------------------- |
| 200  | Ok. The request has been successfully fulfilled.                                               |
| 400  | Bad Request. The supplied authorization token is invalid or the team member cannot be created. |
| 404  | Not Found. The specified chatbot has not been found.                                           |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs10.xenioo.com/xenioo-api/globa-platform-api/bots/teams/add-or-update.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
