# Update analysis group

> PUT https://api.nabrah.ai/api/ext/analysis/{analysis_group_id}

Group: Analysis groups. Page: https://www.nabrah.ai/en/docs/api-reference/analysis-groups/update-analysis-group

Updates the analysis group identified by `analysis_group_id`, replacing its name and data collections with the values provided, and returns the full updated group. Supply the complete intended set of `data_collections` — this defines the group's collections going forward. Existing agent links to the group are preserved.

## Where analysis_group_id comes from

- **Discovering the ID**: List groups with GET /api/ext/analysis, or use the `id` returned by POST /api/ext/analysis.

## Body fields

- **Same shape as create**: The body mirrors Create Analysis Group: a `name` and a `data_collections` array of `{ name, type, description, constraints }`. Fields: `name`, `data_collections`.

## Authorization

- `X-API-Key` (string, header, required): your workspace API key.

## Path parameters

- `analysis_group_id` (string, required): UUID of the analysis group to update. Get this from GET /api/ext/analysis or from the create response (POST /api/ext/analysis).

## Body (application/json)

### Example: Update collections

Rename the group and redefine its data collections.

```json
{
  "name": "Support Call Analysis (v2)",
  "data_collections": [
    {
      "name": "resolved",
      "type": "boolean",
      "description": "Whether the caller's issue was resolved during the call.",
      "constraints": {}
    },
    {
      "name": "follow_up_needed",
      "type": "boolean",
      "description": "Whether a follow-up call or ticket is required.",
      "constraints": {}
    }
  ]
}
```

## Response

### 200 Successful Response

Content type: `application/json`

```json
{
  "name": "string",
  "id": "00000000-0000-4000-8000-000000000000",
  "project_id": "00000000-0000-4000-8000-000000000000",
  "created_at": "2026-01-15T12:00:00.000Z",
  "updated_at": "2026-01-15T12:00:00.000Z",
  "data_collections": [
    {
      "name": "string",
      "type": "string",
      "id": "00000000-0000-4000-8000-000000000000",
      "analysis_group_id": "00000000-0000-4000-8000-000000000000",
      "description": "string",
      "constraints": {}
    }
  ]
}
```

### 422 Validation Error

Content type: `application/json`

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
```

## Request examples

### cURL

```bash
curl --request PUT \
  --url 'https://api.nabrah.ai/api/ext/analysis/<analysis_group_id>' \
  --header 'X-API-Key: <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Support Call Analysis (v2)",
  "data_collections": [
    {
      "name": "resolved",
      "type": "boolean",
      "description": "Whether the caller'\''s issue was resolved during the call.",
      "constraints": {}
    },
    {
      "name": "follow_up_needed",
      "type": "boolean",
      "description": "Whether a follow-up call or ticket is required.",
      "constraints": {}
    }
  ]
}'
```

### Python

```python
import requests

url = "https://api.nabrah.ai/api/ext/analysis/<analysis_group_id>"
headers = {
    "X-API-Key": "<your-api-key>",
}
payload = {
    "name": "Support Call Analysis (v2)",
    "data_collections": [
        {
            "name": "resolved",
            "type": "boolean",
            "description": "Whether the caller's issue was resolved during the call.",
            "constraints": {}
        },
        {
            "name": "follow_up_needed",
            "type": "boolean",
            "description": "Whether a follow-up call or ticket is required.",
            "constraints": {}
        }
    ]
}

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

### JavaScript

```javascript
const response = await fetch("https://api.nabrah.ai/api/ext/analysis/<analysis_group_id>", {
  method: "PUT",
  headers: {
    "X-API-Key": "<your-api-key>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "Support Call Analysis (v2)",
    "data_collections": [
      {
        "name": "resolved",
        "type": "boolean",
        "description": "Whether the caller's issue was resolved during the call.",
        "constraints": {}
      },
      {
        "name": "follow_up_needed",
        "type": "boolean",
        "description": "Whether a follow-up call or ticket is required.",
        "constraints": {}
      }
    ]
  }),
});

const data = await response.json();
console.log(data);
```

### Go

```go
package main

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

func main() {
	payload := strings.NewReader(`{
  "name": "Support Call Analysis (v2)",
  "data_collections": [
    {
      "name": "resolved",
      "type": "boolean",
      "description": "Whether the caller's issue was resolved during the call.",
      "constraints": {}
    },
    {
      "name": "follow_up_needed",
      "type": "boolean",
      "description": "Whether a follow-up call or ticket is required.",
      "constraints": {}
    }
  ]
}`)

	req, _ := http.NewRequest("PUT", "https://api.nabrah.ai/api/ext/analysis/<analysis_group_id>", payload)
	req.Header.Set("X-API-Key", "<your-api-key>")
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	out, _ := io.ReadAll(res.Body)
	fmt.Println(string(out))
}
```
