# Grouping user profiles by 20

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

To send our users by groups of 20, we'll:

-   Iterate through our created pendingUsers array until we reach the 20th index
-   Use the iterated over values to create a new array
-   Send that new array in a POST request to our "Batch create users" endpoint
-   Allow our iteration to continue the process until the pendingUsers array is empty

**Group and send users sample**

```javascript
const finishRegistration = async () => {
    if (pendingUsers.length === 0) return;
    for (let i = 0; i < pendingUsers.length; i += 20) {
        const chunk = pendingUsers.slice(i, i + 20);
        await fetch("https://api.zoom.us/v2/contact_center/users/batch", {
            method: "POST",
            headers: {
                "Content-Type": "application/json",
                Authorization: "Bearer YOUR_SECRET_TOKEN",
            },
            body: JSON.stringify({ users: chunk }),
        });
    }
    setPendingUsers([]);
};
```

<ChildNavigator sidebarName="contact-center" targetKey="managing-users" />
