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

# Enable or disable a federated identity link for a user.

> Creates or removes a Keycloak federated identity link between the user and the tenant IDP. Fully idempotent.



## OpenAPI

````yaml products/didx-me/api-reference/v1/consumer-onboarding.json patch /users/{username}/idp-link
openapi: 3.0.0
info:
  version: 1.0.0
  title: Consumer Onboarding API
  description: |2-

          
    OpenAPI documentation for Consumer Onboarding API

          
          
     - [JSON - OpenAPI Specification](/consumer-onboarding/api/openapi.json)
servers:
  - url: https://test.didxtech.com/consumer-onboarding/api
security:
  - bearerAuth: []
paths:
  /users/{username}/idp-link:
    patch:
      tags:
        - users
      summary: Enable or disable a federated identity link for a user.
      description: >-
        Creates or removes a Keycloak federated identity link between the user
        and the tenant IDP. Fully idempotent.
      parameters:
        - schema:
            type: string
          required: true
          name: username
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IdpLinkRequest'
      responses:
        '200':
          description: IDP link updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdpLinkApiResponse'
        '401':
          description: Unauthorized. Invalid or missing token.
        '404':
          description: User not found or no external identifier stored (when enabling).
      security:
        - bearerAuth: []
components:
  schemas:
    IdpLinkRequest:
      type: object
      properties:
        enabled:
          type: boolean
      required:
        - enabled
      description: Enable or disable a federated identity link for a user.
      example:
        enabled: true
    IdpLinkApiResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/IdpLinkResponse'
        links:
          $ref: '#/components/schemas/ApiLinks'
        meta:
          $ref: '#/components/schemas/ApiMeta'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ApiError'
      required:
        - data
    IdpLinkResponse:
      type: object
      properties:
        username:
          type: string
        idpAlias:
          type: string
        linked:
          type: boolean
      required:
        - username
        - idpAlias
        - linked
      example:
        username: johndoe
        idpAlias: acme-idp
        linked: true
    ApiLinks:
      type: object
      properties:
        self:
          type: string
          format: uri
        first:
          type: string
          format: uri
        last:
          type: string
          format: uri
        prev:
          type: string
          format: uri
        next:
          type: string
          format: uri
        related:
          type: string
          format: uri
    ApiMeta:
      type: object
      additionalProperties:
        nullable: true
    ApiError:
      type: object
      properties:
        id:
          type: string
        status:
          type: string
        code:
          type: string
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              type: string
            parameter:
              type: string
        meta:
          type: object
          additionalProperties:
            nullable: true
      required:
        - detail
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````