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

# Merge

> Merge one app user (the source) into another app user in the same app (the target).
 The source's connector and external source records, and its lookup bindings, move to
 the target in one transaction. Grants, owners, and the target's identity user binding
 stay as they are. The source is removed by the next uplift. A merge cannot be undone.



## OpenAPI

````yaml https://spec.speakeasy.com/conductor-one/conductorone/my-source-with-code-samples post /api/v1/apps/{app_id}/app_users/{target_app_user_id}/merge
openapi: 3.1.0
info:
  description: The C1 API is a HTTP API for managing C1 resources.
  title: C1 API
  version: 0.1.0-alpha
servers:
  - description: The C1 API server for the current tenant.
    url: https://{tenantDomain}.conductor.one
    variables:
      tenantDomain:
        default: example
        description: The domain of the tenant to use for this request.
security:
  - bearerAuth: []
    oauth: []
paths:
  /api/v1/apps/{app_id}/app_users/{target_app_user_id}/merge:
    post:
      tags:
        - AppUsers
      summary: Merge
      description: >-
        Merge one app user (the source) into another app user in the same app
        (the target).
         The source's connector and external source records, and its lookup bindings, move to
         the target in one transaction. Grants, owners, and the target's identity user binding
         stay as they are. The source is removed by the next uplift. A merge cannot be undone.
      operationId: c1.api.app.v1.AppUserService.Merge
      parameters:
        - in: path
          name: app_id
          required: true
          schema:
            description: The ID of the app both app users belong to.
            type: string
        - in: path
          name: target_app_user_id
          required: true
          schema:
            description: >-
              The ID of the app user that remains after the merge and receives
              the source's records.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/c1.api.app.v1.AppUserServiceMergeRequestInput
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/c1.api.app.v1.AppUserServiceMergeResponse'
          description: >-
            The AppUserServiceMergeResponse returns the target app user after
            the merge.
      x-codeSamples:
        - lang: go
          label: Merge
          source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/conductorone/conductorone-sdk-go/pkg/models/shared\"\n\tconductoronesdkgo \"github.com/conductorone/conductorone-sdk-go\"\n\t\"github.com/conductorone/conductorone-sdk-go/pkg/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := conductoronesdkgo.New(\n        conductoronesdkgo.WithSecurity(shared.Security{\n            BearerAuth: \"<YOUR_BEARER_TOKEN_HERE>\",\n            Oauth: \"<YOUR_OAUTH_HERE>\",\n        }),\n    )\n\n    res, err := s.AppUser.Merge(ctx, operations.C1APIAppV1AppUserServiceMergeRequest{\n        AppID: \"<id>\",\n        TargetAppUserID: \"<id>\",\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.AppUserServiceMergeResponse != nil {\n        // handle response\n    }\n}"
components:
  schemas:
    c1.api.app.v1.AppUserServiceMergeRequestInput:
      description: >-
        The AppUserServiceMergeRequest names the app and the two app users to
        merge.
      properties:
        sourceAppUserId:
          description: >-
            The ID of the app user whose records move to the target. Must differ
            from the target.
          type: string
      title: App User Service Merge Request
      type: object
      x-speakeasy-name-override: AppUserServiceMergeRequest
    c1.api.app.v1.AppUserServiceMergeResponse:
      description: >-
        The AppUserServiceMergeResponse returns the target app user after the
        merge.
      properties:
        appUserView:
          oneOf:
            - $ref: '#/components/schemas/c1.api.app.v1.AppUserView'
            - type: 'null'
        mergeId:
          description: The ID of the merge record written for this merge.
          type: string
        recordsMoved:
          description: >-
            The number of connector and external source records moved from the
            source to the target.
          format: int32
          type: integer
      title: App User Service Merge Response
      type: object
      x-speakeasy-name-override: AppUserServiceMergeResponse
    c1.api.app.v1.AppUserView:
      description: >-
        The AppUserView contains an app user as well as paths for apps, identity
        users, and last usage in expanded arrays.
      properties:
        appPath:
          description: >-
            JSONPATH expression indicating where the app is expanded in expanded
            arrays indicated in the request.
          type: string
        appUser:
          oneOf:
            - $ref: '#/components/schemas/c1.api.app.v1.AppUser'
            - type: 'null'
        identityUserPath:
          description: >-
            JSONPATH expression indicating where the identity user is expanded
            in expanded arrays indicated in the request.
          type: string
        lastUsagePath:
          description: >-
            JSONPATH expression indicating where the last usage information is
            expanded in expanded arrays indicated in the request.
          type: string
      title: App User View
      type: object
      x-speakeasy-name-override: AppUserView
    c1.api.app.v1.AppUser:
      description: Application User that represents an account in the application.
      properties:
        agentStatus:
          description: >-
            AI-agent lifecycle status when this app user carries the agent
            trait.
             UNSPECIFIED marks a non-agent account. Read-only; translated from the
             model's agent_trait at the API boundary.
          enum:
            - APP_USER_AGENT_STATUS_UNSPECIFIED
            - APP_USER_AGENT_STATUS_READY
            - APP_USER_AGENT_STATUS_DISABLED
            - APP_USER_AGENT_STATUS_DELETED
          readOnly: true
          type: string
          x-speakeasy-unknown-values: allow
        appId:
          description: The ID of the application.
          readOnly: true
          type: string
        appUserType:
          description: The appplication user type. Type can be user, system or service.
          enum:
            - APP_USER_TYPE_UNSPECIFIED
            - APP_USER_TYPE_USER
            - APP_USER_TYPE_SERVICE_ACCOUNT
            - APP_USER_TYPE_SYSTEM_ACCOUNT
          type: string
          x-speakeasy-unknown-values: allow
        createdAt:
          format: date-time
          readOnly: true
          type:
            - string
            - 'null'
        deletedAt:
          format: date-time
          readOnly: true
          type:
            - string
            - 'null'
        displayName:
          description: The display name of the application user.
          readOnly: true
          type: string
        email:
          description: The email field of the application user.
          readOnly: true
          type: string
        emails:
          description: The emails field of the application user.
          items:
            type: string
          readOnly: true
          type:
            - array
            - 'null'
        employeeIds:
          description: The employee IDs field of the application user.
          items:
            type: string
          readOnly: true
          type:
            - array
            - 'null'
        id:
          description: A unique idenditfier of the application user.
          readOnly: true
          type: string
        identityUserId:
          description: The conductor one user ID of the account owner.
          readOnly: true
          type: string
        isExternal:
          description: The isExternal field.
          readOnly: true
          type: boolean
        nhiDetail:
          description: Axis-2 detail refining nhi_type (e.g. "aws.role.lambda"). Read-only.
          readOnly: true
          type: string
        nhiType:
          description: >-
            NHI classification when this app user carries the non-human-identity
            trait.
             Read-only; translated from the model's nhi_trait at the API boundary.
          enum:
            - APP_USER_NHI_TYPE_UNSPECIFIED
            - APP_USER_NHI_TYPE_APP_REGISTRATION
            - APP_USER_NHI_TYPE_ASSUMABLE_ROLE
            - APP_USER_NHI_TYPE_MANAGED_IDENTITY
          readOnly: true
          type: string
          x-speakeasy-unknown-values: allow
        profile:
          additionalProperties: true
          readOnly: true
          type:
            - object
            - 'null'
        status:
          oneOf:
            - $ref: '#/components/schemas/c1.api.app.v1.AppUserStatus'
            - type: 'null'
        updatedAt:
          format: date-time
          readOnly: true
          type:
            - string
            - 'null'
        username:
          description: The username field of the application user.
          readOnly: true
          type: string
        usernames:
          description: The usernames field of the application user.
          items:
            type: string
          readOnly: true
          type:
            - array
            - 'null'
      title: App User
      type: object
      x-speakeasy-name-override: AppUser
    c1.api.app.v1.AppUserStatus:
      description: The satus of the applicaiton user.
      properties:
        details:
          description: The details of applicaiton user status.
          readOnly: true
          type: string
        status:
          description: The application user status field.
          enum:
            - STATUS_UNSPECIFIED
            - STATUS_ENABLED
            - STATUS_DISABLED
            - STATUS_DELETED
          readOnly: true
          type: string
          x-speakeasy-unknown-values: allow
      title: App User Status
      type: object
      x-speakeasy-name-override: AppUserStatus
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http
    oauth:
      description: >-
        This API uses OAuth2 with the Client Credential flow.

        Client Credentials must be sent in the BODY, not the headers.

        For an example of how to implement this, refer to the
        [c1TokenSource.Token()](https://github.com/ConductorOne/conductorone-sdk-go/blob/3375fe7c0126d17e7ec4e711693dee7b791023aa/token_source.go#L101-L187)
        function.
      flows:
        clientCredentials:
          scopes: {}
          tokenUrl: /auth/v1/token
      type: oauth2

````