## Update Account Grouping

### Endpoint

`PUT /v1/account-groupings/{accountGroupingId}`

### Request

#### cURL

```bash
curl --request PUT \
  --url https://{tenant}.mindbridge.ai/api/v1/account-groupings/{accountGroupingId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "version": 123,
  "name": {},
  "archived": true
}
'
```

#### Python

```python
import requests

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

payload = {
    "version": 123,
    "name": {},
    "archived": True
}
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({version: 123, name: {}, archived: true})
};

fetch('https://{tenant}.mindbridge.ai/api/v1/account-groupings/{accountGroupingId}', 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-groupings/{accountGroupingId}",
  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([
    'version' => 123,
    'name' => [

],
    'archived' => true
  ]),
  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;
}
```

#### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

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

payload := strings.NewReader("{\n  \"version\": 123,\n  \"name\": {},\n  \"archived\": true\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

### Response

#### 200 OK

```json
{
  "id": "<string>",
  "version": 123,
  "creationDate": "2023-11-07T05:31:56Z",
  "lastModifiedDate": "2023-11-07T05:31:56Z",
  "createdUserInfo": {
    "userId": "<string>",
    "userName": "<string>"
  },
  "lastModifiedUserInfo": {
    "userId": "<string>",
    "userName": "<string>"
  },
  "name": {},
  "codeDisplayName": {},
  "delimiter": "<string>",
  "mac": true,
  "system": true,
  "archived": true,
  "publishedDate": "2023-11-07T05:31:56Z"
}
```

### Authorizations

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

### Path Parameters

- **accountGroupingId**: string, required

### Body

- **version**: integer<int64>, required, The data integrity version, to ensure data consistency.
- **name**: object, required, The name of the account grouping.
- **archived**: boolean, required, When `true`, the account grouping is archived.
- **publishStatus**: enum<string>, The current status of the account grouping. Available options: `DRAFT`, `UNPUBLISHED_CHANGES`, `PUBLISHED`.
