> ## 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.

# Assign Licenses via  API

Last updated on Nov 05, 2024

This feature is only available in Incredibuild's [Enterprise Plan](/windows/10.31.0/pricing-plans).

You can assign licenses to Agents using this API. This requires an [API Key](/windows/10.31.0/api-keys) and an Enterprise license.

## Request Endpoint

```
POST https://<coordinatorIP>:8000/api/license/setAgentLicense?coordinatorId=<coordinator ID>&version=<API version>
```

Where **version** is the version of the Incredibuild API.

For example:

```
POST https://10.132.15.166:8000/api/license/setAgentLicense?coordinatorId=12345&version=1.3.0
```

## Request Format:

**Header:** The header must include a key called **client-api-key** and the value of your [API Key](/windows/10.31.0/api-keys) as a string.

**Body:** The request body is an array of agents where each item can contain some of the following fields. The fields must be in the order specified below. Each request can contain up to 100 agents.

The body is different depending on which version of the API you are using:

## Request Body for version 1.5.0

| Field              | Values                                                      | Data Type | Notes                       |
| ------------------ | ----------------------------------------------------------- | --------- | --------------------------- |
| agentName          | must match the name in the Coordinator Manager's Agent List | string    |                             |
| helperLicense      | \{"none", "fixed", "floating"}                              | string    |                             |
| initiatorLicense   | \{"none", "fixed", "floating"}                              | string    |                             |
| ciInitiatorLicense | \{"none", "fixed", "floating"}                              | string    |                             |
| requestedCores     | Integer                                                     | Integer   | Max cores to use as helper. |
| enableAgent        | \{true, false}                                              | Boolean   | Enable as helper            |
| buildCache         | \{true, false}                                              | Boolean   | Allocate Build Cache        |
| enableBuildCache   | \{true, false}                                              | Boolean   |                             |
| useLocalCache      | \{true, false}                                              | Boolean   |                             |
| remoteCacheServer  | host name or IP: port                                       | string    |                             |

**Example Body for Version 1.5.0**

[Copy](javascript:void\(0\);)

```
{
  "agents": [
    {
      "agentName": "Agent1",
      "initiatorLicense": "Fixed",
      "helperLicense": "Fixed",
      "enableBuildCache": true,
      "useLocalCache": true,
      "remoteCacheServer": "1.2.3.4:5000",
      "enableAgent": true
    },
    {
      "agentName": "Agent2",
      "ciInitiatorLicense":"Fixed",
      "helperLicense": "Floating",
      "requestedCores": 4,
      "enableBuildCache": true,
      "useLocalCache": true,
      "remoteCacheServer": "myhostcomputer:5000", 
      "enableAgent": false
    },
    {
      "agentName": "Agent3",
      "ciInitiatorLicense":"Floating",
      "helperLicense": "Fixed",
      "requestedCores": 8,        
      "enableAgent": true
    },
    {
      "agentName": "Agent4",
      "ciInitiatorLicense":"None",
      "helperLicense": "None",
      "enableBuildCache": true,
      "useLocalCache": true,
      "remoteCacheServer": "1.2.3.4:5000",
      "enableAgent": false
    }
  ]
}
```

## Request Body for version 1.3.0

| Field              | Values                                                      | Data Type | Notes                       |
| ------------------ | ----------------------------------------------------------- | --------- | --------------------------- |
| agentName          | must match the name in the Coordinator Manager's Agent List | string    |                             |
| helperLicense      | \{"none", "fixed", "floating"}                              | string    |                             |
| initiatorLicense   | \{"none", "fixed", "floating"}                              | string    |                             |
| ciInitiatorLicense | \{"none", "fixed", "floating"}                              | string    |                             |
| requestedCores     | Integer                                                     | Integer   | Max cores to use as helper. |
| enableAgent        | \{true, false}                                              | Boolean   | Enable as helper            |
| buildCache         | \{true, false}                                              | Boolean   | Allocate Build Cache        |

**Example Body for Version 1.3.0**

[Copy](javascript:void\(0\);)

```
{
  "agents": [
    {
      "agentName": "Agent1",
      "initiatorLicense": "Fixed",
      "helperLicense": "Fixed",
      "buildCache": true,   
      "enableAgent": true
    },
    {
      "agentName": "Agent2",
      "ciInitiatorLicense":"Fixed",
      "helperLicense": "Floating",
      "requestedCores": 4,
      "buildCache": false,   
      "enableAgent": false
    },
    {
      "agentName": "Agent3",
      "ciInitiatorLicense":"Floating",
      "helperLicense": "Fixed",
      "requestedCores": 8,  
      "enableAgent": true
    },
    {
      "agentName": "Agent4",
      "ciInitiatorLicense":"None",
      "helperLicense": "None",
      "buildCache": false,   
      "enableAgent": false
    }
  ]
}
```
