## Update Account Group

### API Endpoint

PUT
/v1/account-groups/{accountGroupId}

### Update Account Group

#### cURL

```bash
curl --request PUT \
  --url https://{tenant}.mindbridge.ai/api/v1/account-groups/{accountGroupId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '\n{
  "macCode": "<string>",
  "accountTags": [\
    "<string>"\
  ]
}\n'  
```

#### Python

```python
import requests

url = "https://{tenant}.mindbridge.ai/api/v1/account-groups/{accountGroupId}"

payload = {
    "macCode": "<string>",
    "accountTags": ["<string>"]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

#### JavaScript (Fetch)

```javascript
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({macCode: '<string>', accountTags: ['<string>']})
};

fetch('https://{tenant}.mindbridge.ai/api/v1/account-groups/{accountGroupId}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

#### PHP

```php
$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://{tenant}.mindbridge.ai/api/v1/account-groups/{accountGroupId}",\
  CURLOPT_RETURNTRANSFER => true,\
  CURLOPT_ENCODING => "",\
  CURLOPT_MAXREDIRS => 10,\
  CURLOPT_TIMEOUT => 30,\
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
  CURLOPT_CUSTOMREQUEST => "PUT",\
  CURLOPT_POSTFIELDS => json_encode([\
    'macCode' => '<string>',\
    'accountTags' => [\
        '<string>'\
    ]\
  ]),\
  CURLOPT_HTTPHEADER => [\
    "Authorization: Bearer <token>",\
    "Content-Type: application/json"\
  ],\
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

### Response

200 - application/json

```json
{
  "id": "<string>",
  "accountGroupingId": "<string>",
  "code": "<string>",
  "description": {},
  "lowestLevel": true,
  "hierarchy": [\
    "<string>"\
  ],
  "parentCode": "<string>",
  "macCode": "<string>",
  "accountTags": [\
    "<string>"\
  ],
  "publishedDate": "2023-11-07T05:31:56Z",
  "orderIndex": 123,
  "errors": [\
    {\
      "arguments": [\
        "<string>"\
      ]\
    }\
  ]
}
```

### Authorizations

Authorization: Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.

### Path Parameters

- **accountGroupId**: string (required)

### Body

**Application/JSON**

- **macCode**: string - The MAC code mapped to this account group.
- **accountTags**: string[] - A list of account tags assigned to this account group.
