> ## 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.

# Encrypt

> Encrypt data using ECDH key exchange.

## Used in

* [Serve records on a fetch request](https://developer.eka.care/docs/hie-cm/workflows/serve-data-on-fetch.md)


## OpenAPI

````yaml api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/ecdh/encrypt
openapi: 3.1.0
info:
  description: >-
    ABHA identity, care context linking, consent, HPR/HFR, UHI and
    scan-and-share APIs, with the webhook events Eka sends.
  title: ABDM Connect
  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/ecdh/encrypt:
    post:
      tags:
        - Care Contexts
      summary: Encrypt
      description: Encrypt data using ECDH key exchange.
      operationId: encrypt
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModelsEncryptPayload'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelsEncryptResponse'
          description: OK
        4XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericError'
          description: ''
        5XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericError'
          description: ''
      security:
        - authApiKey: []
components:
  schemas:
    ModelsEncryptPayload:
      properties:
        plain_text_data:
          description: Plaintext data to encrypt
          type: string
        receiver_nonce:
          description: Nonce associated with the receiver's key pair
          type: string
        receiver_public_key:
          description: Base64-encoded public key of the receiver
          type: string
        sender_nonce:
          description: Nonce associated with the sender's key pair
          type: string
        sender_private_key:
          description: Base64-encoded private key of the sender
          type: string
        sender_public_key:
          description: Base64-encoded public key of the sender
          type: string
      type: object
    ModelsEncryptResponse:
      properties:
        encrypted_data:
          description: Base64-encoded encrypted data
          type: string
        key_to_share:
          description: Public key material to share with the receiver
          type: string
      type: object
    GenericError:
      properties:
        code:
          type: integer
        error:
          type: string
        source_error:
          $ref: '#/components/schemas/SourceErr'
      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

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.