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

# Discover Link On Init

> This API is used by HIP to initiate the linking of unlinked health records (care contexts). HIP must send an OTP and provide details such as OTP expiry and other related information.

<Note>
  Call this API in response to the [Link Initiation webhook](/api-reference/user-app/abdm-connect/webhooks/discover-link-init), after you have generated and sent the OTP to the patient. Use the `request_id` and `txn_id` from the webhook payload when constructing your response.
</Note>


## OpenAPI

````yaml post /abdm/v1/care-contexts/discover/link/on-init
openapi: 3.1.0
info:
  description: ABHA Registration and login APIs
  title: Registration
  version: 1.0.0
servers:
  - description: Production
    url: https://api.eka.care
  - description: Stage/Sandbox
    url: https://api.dev.eka.care
security: []
paths:
  /abdm/v1/care-contexts/discover/link/on-init:
    post:
      summary: Discover Link On Init
      description: >-
        This API is used by HIP to initiate the linking of unlinked health
        records (care contexts). HIP must send an OTP and provide details such
        as OTP expiry and other related information.
      parameters:
        - description: Eka User ID (OID)
          in: header
          name: X-Pt-Id
          schema:
            type: string
        - description: Partner User ID
          in: header
          name: X-Partner-Pt-Id
          schema:
            type: string
        - description: Partner HIP ID
          in: header
          name: X-Hip-Id
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModelsLinkOnInitHmisConnect'
      responses:
        '204':
          description: No Content
        4XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericError'
          description: ''
        5XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericError'
          description: ''
      security:
        - authApiKey: []
components:
  schemas:
    ModelsLinkOnInitHmisConnect:
      properties:
        error:
          $ref: '#/components/schemas/ModelsError'
          description: Error details, if any occurred during the process.
        otp_expiry:
          description: Expiry time of the OTP sent for linking care contexts.
          type: string
        ref_num:
          description: patient reference number.
          type: string
        request_id:
          description: Request ID that is received in the webhook call.
          type: string
        txn_id:
          description: Transaction ID received in the webhook call.
          type: string
      required:
        - txn_id
        - request_id
      type: object
    GenericError:
      properties:
        code:
          type: integer
        error:
          type: string
        source_error:
          $ref: '#/components/schemas/SourceErr'
      type: object
    ModelsError:
      properties:
        code:
          description: Error code indicating the type of error
          type: integer
        message:
          description: Detailed error message
          type: string
      type: object
    SourceErr:
      properties:
        code:
          type: string
        message:
          type: string
      type: object
  securitySchemes:
    authApiKey:
      description: The API requires a Bearer token (JWT) for authentication.
      scheme: bearer
      type: http

````