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

# Create a new group

> Create a new group in the user's account.

Requires authenticated user (usually admin, but enforced via permissions logic if needed).
For now, any authenticated user can create groups in their account (or restrict to admin).



## OpenAPI

````yaml post /api/v1/groups
openapi: 3.1.0
info:
  title: SnackBase
  description: Open-source Backend-as-a-Service (BaaS)
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/groups:
    post:
      tags:
        - groups
        - Groups
      summary: Create a new group
      description: >-
        Create a new group in the user's account.


        Requires authenticated user (usually admin, but enforced via permissions
        logic if needed).

        For now, any authenticated user can create groups in their account (or
        restrict to admin).
      operationId: create_group_api_v1_groups_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GroupCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroupDetailResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    GroupCreate:
      properties:
        name:
          type: string
          maxLength: 100
          minLength: 1
          title: Name
          description: Group name
        description:
          anyOf:
            - type: string
              maxLength: 500
            - type: 'null'
          title: Description
          description: Group description
        account_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Id
          description: Account ID (UUID, optional for superadmins)
      type: object
      required:
        - name
      title: GroupCreate
      description: Schema for creating a group.
    GroupDetailResponse:
      properties:
        name:
          type: string
          maxLength: 100
          minLength: 1
          title: Name
          description: Group name
        description:
          anyOf:
            - type: string
              maxLength: 500
            - type: 'null'
          title: Description
          description: Group description
        id:
          type: string
          title: Id
          description: Group ID
        account_id:
          type: string
          title: Account Id
          description: Account ID (UUID)
        account_code:
          type: string
          title: Account Code
          description: Human-readable account code in XX#### format (e.g., AB1234)
        member_count:
          type: integer
          title: Member Count
          description: Number of users in the group
          default: 0
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        users:
          items:
            $ref: >-
              #/components/schemas/snackbase__infrastructure__api__schemas__users_schemas__UserResponse
          type: array
          title: Users
          description: List of users in the group
      type: object
      required:
        - name
        - id
        - account_id
        - account_code
        - created_at
        - updated_at
      title: GroupDetailResponse
      description: Schema for detailed group response including users.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    snackbase__infrastructure__api__schemas__users_schemas__UserResponse:
      properties:
        id:
          type: string
          title: Id
          description: User ID
        email:
          type: string
          title: Email
          description: User's email address
        account_id:
          type: string
          title: Account Id
          description: Account ID (UUID)
        account_code:
          type: string
          title: Account Code
          description: Human-readable account code in XX#### format (e.g., AB1234)
        account_name:
          type: string
          title: Account Name
          description: Account display name
        role_id:
          type: integer
          title: Role Id
          description: Role ID
        role_name:
          type: string
          title: Role Name
          description: Role name
        is_active:
          type: boolean
          title: Is Active
          description: Whether the user can log in
        auth_provider:
          type: string
          title: Auth Provider
          description: Authentication provider type ('password', 'oauth', 'saml')
        auth_provider_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Auth Provider Name
          description: Specific provider name (e.g., 'google', 'github')
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: External provider's user ID
        external_email:
          anyOf:
            - type: string
            - type: 'null'
          title: External Email
          description: Email from external provider
        profile_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Profile Data
          description: Additional profile data from external provider
        email_verified:
          type: boolean
          title: Email Verified
          description: Whether the user's email is verified
        email_verified_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Email Verified At
          description: When the email was verified
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the user was created
        last_login:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Login
          description: Last successful login
      type: object
      required:
        - id
        - email
        - account_id
        - account_code
        - account_name
        - role_id
        - role_name
        - is_active
        - auth_provider
        - email_verified
        - created_at
      title: UserResponse
      description: |-
        Response schema for a single user.

        Includes user details along with related account and role information.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````