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

# Create Domain Group

> Create a domain group that merges analytics for multiple entities representing the same brand.

Entity references in `primaryEntity` and `entities` may be either:
- an `entityId` returned by `GET /v1/entities` (a tracking ID for an entity in this workspace), or
- an entity UUID returned as `entityUuid` by `GET /v1/competitors` (any entity in the system).

At least 2 entities are required, and `primaryEntity` must be included in the `entities` array. Each entity may belong to at most one group at a time. Additional non-primary entities count toward your workspace entity limit.



## OpenAPI

````yaml post /domain-groups
openapi: 3.1.0
info:
  title: Geogen API
  description: >-
    API for accessing LLM visibility data, managing entities, and tracking AI
    mentions.
  version: 1.0.0
servers:
  - url: https://api.geogen.io/v1
    description: Production server
security:
  - bearerAuth: []
paths:
  /domain-groups:
    post:
      tags:
        - Domain Groups
      summary: Create Domain Group
      description: >-
        Create a domain group that merges analytics for multiple entities
        representing the same brand.


        Entity references in `primaryEntity` and `entities` may be either:

        - an `entityId` returned by `GET /v1/entities` (a tracking ID for an
        entity in this workspace), or

        - an entity UUID returned as `entityUuid` by `GET /v1/competitors` (any
        entity in the system).


        At least 2 entities are required, and `primaryEntity` must be included
        in the `entities` array. Each entity may belong to at most one group at
        a time. Additional non-primary entities count toward your workspace
        entity limit.
      operationId: createDomainGroup
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - primaryEntity
                - entities
              properties:
                name:
                  type: string
                  description: >-
                    Display name for the group. Defaults to the primary entity's
                    name when omitted.
                primaryEntity:
                  type: string
                  description: >-
                    The primary entity reference (entityId or entity UUID). Its
                    name/favicon represent the group in the UI.
                entities:
                  type: array
                  minItems: 2
                  items:
                    type: string
                  description: >-
                    Array of 2+ entity references (entityIds or entity UUIDs).
                    Must include the primary entity.
                entityId:
                  type: string
                  description: >-
                    Optional. When provided, scopes the group to this entity
                    tracking. Only analytics generated under this tracking will
                    be merged.
            examples:
              merge_brand_domains:
                summary: Merge two workspace entities
                value:
                  name: Acme
                  primaryEntity: j5712abc34def56ghij7890klmn
                  entities:
                    - j5712abc34def56ghij7890klmn
                    - j97def56ghij7890klmn5712abc
              merge_with_competitor_uuid:
                summary: Merge with a competitor entity UUID
                description: >-
                  Mix workspace tracking IDs and entity UUIDs from
                  /v1/competitors.
                value:
                  primaryEntity: j5712abc34def56ghij7890klmn
                  entities:
                    - j5712abc34def56ghij7890klmn
                    - 550e8400-e29b-41d4-a716-446655440000
      responses:
        '201':
          description: Domain group created successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/DomainGroup'
                  message:
                    type: string
        '400':
          description: >-
            Bad request — validation failed, fewer than 2 entities, primary not
            included, entity overlap with another group, or workspace entity
            limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Referenced `entityId` not found in this workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            Rate limit exceeded — either the global write limit or the
            per-workspace domain-group change limit (5 changes per week).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  retryAfter:
                    type: number
components:
  schemas:
    DomainGroup:
      type: object
      description: >-
        A group of entities that represent the same brand. Analytics for grouped
        entities are merged across all pages and responses.
      properties:
        id:
          type: string
          description: Domain group ID.
        name:
          type: string
          description: Display name for the group.
        primaryEntityUuid:
          type: string
          description: UUID of the entity whose name and favicon represent the group.
        entityTrackingId:
          type: string
          nullable: true
          description: >-
            Optional entity-tracking scope. When set, the group only applies to
            analytics generated under this specific tracking.
        entities:
          type: array
          description: >-
            Entities included in the group. The entity with `isPrimary=true`
            represents the group.
          items:
            $ref: '#/components/schemas/DomainGroupEntity'
        createdAt:
          type: number
          description: Creation timestamp (ms).
        updatedAt:
          type: number
          description: Last update timestamp (ms).
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
    DomainGroupEntity:
      type: object
      description: A single entity inside a domain group, enriched with display data.
      properties:
        entityId:
          type: string
          nullable: true
          description: >-
            Tracking ID for the entity in this workspace (null when the entity
            is not tracked here, e.g. a competitor).
        entityUuid:
          type: string
          description: Stable, system-wide entity UUID.
        name:
          type: string
          nullable: true
          description: Entity display name.
        target:
          type: string
          nullable: true
          description: Entity domain or term.
        faviconUrl:
          type: string
          nullable: true
          description: Favicon URL for the entity, if known.
        isPrimary:
          type: boolean
          description: >-
            Whether this entity is the group's primary entity (its name/favicon
            represent the group).
        inWorkspace:
          type: boolean
          description: Whether this entity is tracked in the current workspace.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'API key authentication. Format: Bearer wsk_your_api_key'

````