> ## Documentation Index
> Fetch the complete documentation index at: https://ekacare-quickstart-cleanup.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Care context linking

> Use this API to link a care context to the patient's ABHA address. A care context represents a visit, test, or any logical grouping of health records.

After calling this API, listen for the [`abha.link_care_context`](/api-reference/user-app/abdm-connect/webhooks/link-care-context) webhook to confirm whether the linking was successful. Once linked, other HIUs can request data for this care context through ABDM's consent flow.

You can optionally pass the FHIR data as a base64-encoded string in the `data` field. If provided, Eka stores it and handles data sharing automatically — you won't need to handle the `abha.hip_data_fetch` webhook. If not provided, you will receive the [`abha.hip_data_fetch`](/api-reference/user-app/abdm-connect/webhooks/hip-data-fetch) webhook when an HIU requests the data.




## OpenAPI

````yaml POST /abdm/v1/care-contexts/link
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/link:
    post:
      summary: Care context linking
      description: This API is used by HIP to link care contexts.
      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/LinkCareContextLinkingRequest'
      responses:
        '202':
          description: Accepted
        4XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericError'
          description: ''
        5XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericError'
          description: ''
      security:
        - authApiKey: []
components:
  schemas:
    LinkCareContextLinkingRequest:
      properties:
        abha_address:
          type: string
        care_contexts:
          items:
            $ref: '#/components/schemas/LinkCareContextMeta'
          type:
            - array
            - 'null'
        oid:
          type: string
        partner_user_id:
          type: string
      type: object
    GenericError:
      properties:
        code:
          type: integer
        error:
          type: string
        source_error:
          $ref: '#/components/schemas/SourceErr'
      type: object
    LinkCareContextMeta:
      properties:
        care_context_id:
          type: string
        data:
          description: >-
            Base64 encoded ABDM compliant FHIR bundle (optional, required if not
            opting for webhook based implementation)
          type: string
        display:
          type: string
        hi_type:
          enum:
            - OPConsultation
            - Prescription
            - DischargeSummary
            - DiagnosticReport
            - ImmunizationRecord
            - HealthDocumentRecord
            - WellnessRecord
          type: string
        hi_types:
          description: >-
            List of HI types if care context fhir bundle is present in data
            field
          items:
            type: string
          type:
            - array
            - 'null'
      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

````