# JoinPart Agents

{% hint style="info" %}
Each data union has **at least one joinPart agent**. The agent has the power to **add and remove members from the data union.**

Removing will label the member as inactive. Inactive members are still able to access their earnings but won't be able to earn unless they join or get added to the data union again. Adding/joining the data union will label the member as active.

A joinPart agent **is not membe**r of the data union.
{% endhint %}

### Add And Remove Members

**Add** a list of addresses to your data union:

{% hint style="info" %}
Only a joinPart agent can add members. See how you can enable **members to join automatically** [**here**](https://docs.dataunions.org/main-concepts/join-server).
{% endhint %}

```typescript
const tx = await dataUnion.addMembers([ADDRESS_1, ADDRESS_2, ADDRESS_3]);
```

**Remove** a list of addresses from your data union:

```typescript
// only a joinPart Agent can call this function successfully
const tx = await dataUnion.removeMembers([ADDRESS_1, ADDRESS_2, ADDRESS_3]);
```

### Add And Remove JoinPart Agents

{% hint style="info" %}
Only the [**admin**](https://docs.dataunions.org/main-concepts/roles-and-responsibilities/admin) can **add** and **remove joinPart Agents**
{% endhint %}

**At deployment** of the data union the **creator (**[**admin**](https://docs.dataunions.org/main-concepts/roles-and-responsibilities/admin)**)** and **the public address of the** [**join server**](https://docs.dataunions.org/main-concepts/join-server) (0xf3e5a65851c3779f468c9ecb32e6f25d9d68601a) will be **made joinPart agents by default**.

You can **change the default** in the deployment options **when deploying the data union**:

```typescript
const dataUnion = await DU.deployDataUnion(
    {joinPartAgents: [ADMIN_ADDRESS, CUSTOM_JOIN_SERVER_ADDRESS]}
)
```

{% hint style="info" %}
Add and remove joinPart agents with a **direct** [**contract transaction**](https://docs.dataunions.org/main-concepts/contract-functions) **as the admin.**
{% endhint %}

**To add** one or multiple joinPart agents, call the following function and add their address.

<mark style="color:red;">`addJoinPartAgent(0x12345)`</mark> or <mark style="color:red;">`addJoinPartAgents([0x12345,0xabcdef])`</mark>

**To remove** an agent, call the following function and add their address.

<mark style="color:red;">`removeJoinPartAgent(0x12345)`</mark>

#### How to call contract functions:

{% content-ref url="../contract-functions" %}
[contract-functions](https://docs.dataunions.org/main-concepts/contract-functions)
{% endcontent-ref %}

#### How to better manage your member joins with a join server:

{% content-ref url="../join-server" %}
[join-server](https://docs.dataunions.org/main-concepts/join-server)
{% endcontent-ref %}


---

# 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://docs.dataunions.org/main-concepts/roles-and-responsibilities/joinpart-agents.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.
