---
title: "Group Details Crud"
method: POST
path: "/api/LeapsurgeBI/group_details_crud"
tags: ["LeapsurgeBI"]
---

# Group Details Crud

`POST /api/LeapsurgeBI/group_details_crud`

## Request

- Base URL: `https://api.leapsurgebi.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.leapsurgebi.com/api/LeapsurgeBI/group_details_crud`
- Auth: OAuth 2
  - Password
  - Token URL: `/auth/token`
- TypeScript: <https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/docs/api/LeapsurgeBI/group_details_crud/post.ts> (a function with typed inputs; its response is checked against the schema)

**Function**: `group_details_crud`
**Type**: API Endpoint (POST)

**Purpose**:
Performs create, read, update, and delete operations for Leapsurge BI user groups. The
operation is selected through the `action` header, while the request body supplies group master
data, firm access, report access, menu access, and RLS access details as needed.

**Headers**:
- `LSCode` (str, required): Base64-encoded LS code to identify the customer context.
- `action` (str, required): CRUD action to perform. Supported values are:
  `create`, `read`, `update`, and `delete`.

**Request Body**:
- `group_code` (str, optional): Required for `update` and `delete`; optional filter for `read`.
- `group_name` (str, optional): Group name. Required for `create`; optional for `update`.
- `is_active` (bool, optional): Active status for the group.
- `application_code` (str, optional): Required for `create` and `update`; optional filter for `read`.
- `report_list` (list, optional): Report codes to assign to the group.
- `menu_list` (list, optional): Menu access records, each with `menuCode` and `access`.
- `firm_access` (list, optional): Firm access records for `LS_User_Firm_Access`, each with
  `firm_code` and `active`.
- `rls_details` (list, optional): Group RLS access records with `report_code`, `rls_email`,
  `rls_role`, `active`, and optional hierarchy fields.
- `modified_user` (str, optional): User name to store in audit columns. Defaults to the
  authenticated user's name/email.

**Behavior**:
- `create`: Creates an `LS_User_Group_Master` record, generates a new group code, updates the
  serial number, and inserts related firm/report/menu/RLS access records.
- `read`: Returns one group when `group_code` is supplied, otherwise returns groups for the
  decoded LSCode and optional `application_code`.
- `update`: Updates group master fields and replaces supplied firm/report/menu/RLS access sets.
- `delete`: Deletes the group and related firm/report/menu/RLS access records for the decoded LSCode.

**Response**:
Returns a JSON response with `status`, `message`, and when applicable `group_code` or `data`.

**Exceptions**:
- Returns HTTP 400 for invalid customer key, invalid action, missing required input, duplicate
  group name, or group not found.
- Returns HTTP 500 with the exception message if an unexpected error occurs.

## Headers

- `LSCode` string, required
- `action` string, required

## Request body

- GroupCrudSchema
  - `group_code` string, nullable
  - `group_name` string, nullable
  - `is_active` boolean, nullable
  - `modified_user` string, nullable
  - `application_code` string, nullable
  - `report_list` string[], nullable
  - `menu_list` MenuItem[], nullable
    - `menuCode` string, required
    - `access` integer, required
  - `firm_access` FirmAccessItem[], nullable
    - `firm_code` string, nullable
    - `active` integer
  - `rls_details` object[], nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi.md) - [All operations](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/llms.txt) - [OpenAPI document](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/revisions/13653cb8ee76?raw)
