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

# Add user to group

> Adds a user to a specific group with optional role assignment



## OpenAPI

````yaml /pro/api/openapi.yml post /v2/GroupAddUser
openapi: 3.0.3
info:
  title: Databunker Pro API
  description: >
    Databunker Pro is a privacy-compliant user data vault and tokenization
    engine that provides secure storage and management of user data with
    built-in privacy controls, consent management, and audit capabilities.


    ## Key Features

    - **User Tokenization**: Create, update, and manage user profiles with
    privacy controls

    - **Consent Management**: Handle legal basis and user agreements for
    GDPR/DPDP compliance

    - **Token Management**: Secure tokenization of sensitive data like credit
    cards

    - **Audit Trail**: Complete audit logging of all data access and
    modifications

    - **Multi-tenant**: Support for multiple tenants with isolated data

    - **Role-based Access**: Fine-grained access control with policies and roles

    - **Bulk Operations**: Efficient bulk data operations with unlock mechanisms


    ## Authentication

    All API calls require authentication via the `X-Bunker-Token` header. For
    multi-tenant setups, use the `X-Bunker-Tenant` header to specify the tenant
    context.


    ### Multi-Tenant Usage

    Multi-tenancy is supported when DataBunker Pro is configured to work with
    PostgreSQL database. **Note:** DataBunker Pro supports both PostgreSQL and
    MySQL (Percona) as backend databases, but multi-tenancy requires PostgreSQL
    and is not available with MySQL.


    When using DataBunker Pro in a multi-tenant environment:


    - **Single Tenant**: Omit the `X-Bunker-Tenant` header (default behavior)

    - **Multi-Tenant**: Include `X-Bunker-Tenant: your-tenant-name` header


    **Example:**

    ```bash

    # Single tenant

    curl -X POST http://localhost:3000/v2/UserCreate \
      -H "X-Bunker-Token: your-token" \
      -d '{"profile":{"login":"user1"}}'

    # Multi-tenant

    curl -X POST http://localhost:3000/v2/UserCreate \
      -H "X-Bunker-Token: your-token" \
      -H "X-Bunker-Tenant: acme-corp" \
      -d '{"profile":{"login":"user1"}}'
    ```


    ## Base URL

    The API is available at `/v2/` endpoint with all requests using POST method.
  version: 2.0.0
  contact:
    name: Databunker Support
    url: https://databunker.com
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: http://localhost:3000
    description: Local development server
security:
  - XBunkerToken: []
tags:
  - name: User Tokenization
    description: Operations for creating, reading, updating, and deleting users
  - name: App Data Management
    description: Operations for managing application-specific user data
  - name: Legal Basis Management
    description: Operations for managing legal basis for data processing
  - name: Agreement Management
    description: Operations for managing user agreements and consent
  - name: Processing Activity Management
    description: Operations for managing data processing activities
  - name: Format Preserving Tokenization
    description: Operations for tokenizing sensitive data
  - name: Group Management
    description: Operations for managing user groups
  - name: Role Management
    description: Operations for managing user roles
  - name: Policy Management
    description: Operations for managing access control policies
  - name: Authentication
    description: Operations for creating access tokens
  - name: Bulk Operations
    description: Operations for bulk data processing
  - name: Audit Management
    description: Operations for accessing audit logs
  - name: Tenant Management
    description: Operations for managing multi-tenant setups
  - name: Shared Records
    description: Operations for creating and accessing shared user records
  - name: Session Management
    description: Operations for managing user sessions
  - name: System Operations
    description: Operations for system administration and monitoring
paths:
  /v2/GroupAddUser:
    post:
      tags:
        - Group Management
      summary: Add user to group
      description: Adds a user to a specific group with optional role assignment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - mode
                - identity
              properties:
                mode:
                  type: string
                  enum:
                    - login
                    - token
                    - email
                    - phone
                    - custom
                  description: Mode of user identification
                identity:
                  type: string
                  description: User identifier corresponding to the mode
                groupid:
                  type: integer
                  description: ID of the group
                groupname:
                  type: string
                  description: Name of the group
                roleid:
                  type: integer
                  description: ID of the role to assign
                rolename:
                  type: string
                  description: Name of the role to assign
                request_metadata:
                  type: object
                  description: Additional metadata for the request
      responses:
        '200':
          description: User added to group successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: ok
components:
  securitySchemes:
    XBunkerToken:
      type: apiKey
      in: header
      name: X-Bunker-Token
      description: API token for authentication

````