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

# Assigning Agents to a Build Group

The Groups/\{Group name}/AddAgents API allows you to assign one or more Agents to an existing Build Group.

You cannot perform the Agent Assignment action if:

* The Agent is currently participating in a build execution.

* The Agent is offline.

 **Request Syntax**

```text theme={null}
POST https:// {Coordinator IP Address/Hostname}:{Web Access Port}/Groups/{Group name}/AddAgents
[
    {
        "Name":"{Agent name}",

        "IP":"{Agent IP address}
    }
] 
```

Where:

* Web Access Port is the port number defined in the [**Coordinator Settings** dialog box](/windows/assigning-agents-to-build-groups) (default**31100**).

* Group name is case sensitive.

In the following example, a request is sent to assign three Agents to the **QA** Build Group: 

```text theme={null}
POST https://win10-1:31100/Groups/QA/AddAgents
[
    {
        "Name":"WIN10-1",

        "IP":"192.100.00.001"
    },

    {
        "Name":"WIN10-2",

        "IP":"192.100.00.002"
    },

    {    
        "Name":"WIN10-3",

        "IP":"192.100.00.003"
    }
]
```

**Response Syntax**

When an Agent is successfully assigned to the specified Build Group, the result is: "\{Agent name}": "OK".

For example:

```text theme={null}
[
    {
        "WIN10-1": "OK"
    },

    {
        "WIN10-2": "OK"
    },

    {
        "WIN10-3": "OK"
    }
]
```

**Errors**

The request fails if:

* The Agent is currently participating in a build execution.

* The Agent does not exist.

* The Agent is offline.

* The Build Group does not exist.

In the following example, one Agent is currently offline, while another Agent does not exist:

```text theme={null}
[
    {
        "WIN10-2": "Agent is offline"
    },

    {
        "WIN10-4": "Agent does not exist"
    }
]
```
