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

# Groups

> Groups are rows on a page. They hold one or more blocks and can have optional titles.

## Endpoints

| Method   | Path                                         | Description                   |
| -------- | -------------------------------------------- | ----------------------------- |
| `GET`    | `/api/v2/groups?pageId={page_id}`            | List groups on a page         |
| `POST`   | `/api/v2/groups`                             | Create groups                 |
| `PATCH`  | `/api/v2/groups/{group_id}`                  | Update a group                |
| `DELETE` | `/api/v2/groups/{group_id}?pageId={page_id}` | Delete a group and its blocks |

***

## List groups

`GET /api/v2/groups?pageId={page_id}`

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://api.flowla.com/api/v2/groups?pageId=<page_id>" \
    -H "x-flowla-api-key: YOUR_API_KEY"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.flowla.com/api/v2/groups",
      headers={"x-flowla-api-key": "YOUR_API_KEY"},
      params={"pageId": "<page_id>"},
  )
  ```

  ```js JavaScript theme={null}
  const res = await fetch(
    "https://api.flowla.com/api/v2/groups?pageId=<page_id>",
    { headers: { "x-flowla-api-key": "YOUR_API_KEY" } }
  );
  ```
</CodeGroup>

***

## Create groups

`POST /api/v2/groups`

Create one or more groups on a page in a single request.

<ParamField body="pageId" type="string" required>
  The page to add groups to.
</ParamField>

<ParamField body="groups" type="array" required>
  Array of group objects.

  <Expandable title="Group object fields">
    <ParamField body="title" type="string">
      Display title shown above the group.
    </ParamField>
  </Expandable>
</ParamField>

```json Example theme={null}
{
  "pageId": "<page_id>",
  "groups": [
    { "title": "Quick links" },
    { "title": "Resources" }
  ]
}
```

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.flowla.com/api/v2/groups \
    -H "x-flowla-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "pageId": "<page_id>",
      "groups": [{ "title": "Quick links" }]
    }'
  ```

  ```python Python theme={null}
  requests.post(
      "https://api.flowla.com/api/v2/groups",
      headers={"x-flowla-api-key": "YOUR_API_KEY"},
      json={
          "pageId": "<page_id>",
          "groups": [{"title": "Quick links"}],
      },
  )
  ```

  ```js JavaScript theme={null}
  await fetch("https://api.flowla.com/api/v2/groups", {
    method: "POST",
    headers: {
      "x-flowla-api-key": "YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      pageId: "<page_id>",
      groups: [{ title: "Quick links" }],
    }),
  });
  ```
</CodeGroup>

***

## Update a group

`PATCH /api/v2/groups/{group_id}`

<ParamField body="pageId" type="string" required>
  The page the group belongs to.
</ParamField>

<ParamField body="title" type="string">
  New display title.
</ParamField>

```json Example theme={null}
{ "pageId": "<page_id>", "title": "Updated Group Title" }
```

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH https://api.flowla.com/api/v2/groups/<group_id> \
    -H "x-flowla-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"pageId": "<page_id>", "title": "Updated Group Title"}'
  ```

  ```python Python theme={null}
  requests.patch(
      "https://api.flowla.com/api/v2/groups/<group_id>",
      headers={"x-flowla-api-key": "YOUR_API_KEY"},
      json={"pageId": "<page_id>", "title": "Updated Group Title"},
  )
  ```
</CodeGroup>

***

## Delete a group

`DELETE /api/v2/groups/{group_id}?pageId={page_id}`

<Warning>
  Deletes the group and all its blocks permanently. Any action-plan tasks inside the group are also deleted.
</Warning>

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.flowla.com/api/v2/groups/<group_id>?pageId=<page_id>" \
    -H "x-flowla-api-key: YOUR_API_KEY"
  ```

  ```python Python theme={null}
  requests.delete(
      "https://api.flowla.com/api/v2/groups/<group_id>",
      headers={"x-flowla-api-key": "YOUR_API_KEY"},
      params={"pageId": "<page_id>"},
  )
  ```
</CodeGroup>
