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

# Generate OTP

> Sends an OTP (One-Time Password) to the user via the specified notification modes.
Supports multiple delivery channels including SMS and WhatsApp for secure user verification.




## OpenAPI

````yaml /openapi/ppi/ppi.yaml post /ppi/otp/generate
openapi: 3.0.3
info:
  title: PPI Wallet API
  description: >-
    API for managing PPI (Prepaid Payment Instrument) wallets and sub-wallets,
    including credit and debit operations.
  version: 1.0.0
  contact:
    name: PPI Service Team
    email: support@cashfree.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
  - url: https://api.cashfree.com
    description: Production server.
  - url: https://sandbox.cashfree.com
    description: Sandbox server.
security:
  - XClientID: []
    XClientSecret: []
tags:
  - name: Wallet Management
    description: Operations related to PPI wallet management.
  - name: User Management
    description: Operations related to user management within the PPI system.
  - name: Beneficiary Management
    description: Operations related to beneficiary management for users.
  - name: KYC Management
    description: Operations related to KYC (Know Your Customer) management.
  - name: Transfers
    description: Operations related to transfer.
paths:
  /ppi/otp/generate:
    post:
      tags:
        - User KYC
      summary: Generate OTP
      description: >
        Sends an OTP (One-Time Password) to the user via the specified
        notification modes.

        Supports multiple delivery channels including SMS and WhatsApp for
        secure user verification.
      operationId: generateOtp
      parameters:
        - $ref: '#/components/parameters/global_x_api_version'
      requestBody:
        $ref: '#/components/requestBodies/SendOtpRequest'
      responses:
        '200':
          $ref: '#/components/responses/SendOtpResponse'
        '400':
          description: Bad request - Invalid input parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
              examples:
                otp_verification_id_missing:
                  summary: OTP verification ID missing
                  value:
                    code: otp_verification_id_missing
                    type: validation_error
                    message: otp_verification_id parameter is missing
                user_id_missing:
                  summary: User ID missing
                  value:
                    code: user_id_missing
                    type: validation_error
                    message: user_id parameter is missing
                notification_modes_missing:
                  summary: Notification modes missing
                  value:
                    code: notification_modes_missing
                    type: validation_error
                    message: notification_modes parameter is missing
                invalid_notification_mode:
                  summary: Invalid notification mode
                  value:
                    code: notification_mode_invalid
                    type: validation_error
                    message: >-
                      Invalid notification mode. Supported modes are SMS and
                      WHATSAPP
                missingClientId:
                  summary: Missing client ID
                  value:
                    message: x-client-id is missing in the request
                    code: x-client-id_missing
                    type: validation_error
                missingClientSecret:
                  summary: Missing client secret
                  value:
                    message: x-client-secret is missing in the request
                    code: x-client-secret_missing
                    type: validation_error
        '401':
          $ref: '#/components/responses/Response401'
        '403':
          description: Forbidden - Access denied.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
              examples:
                ipNotWhitelisted:
                  summary: IP not whitelisted
                  value:
                    code: ip_not_whitelisted
                    type: authentication_error
                    message: Authentication error (IP not whitelisted)
        '404':
          description: Not found - User not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
              examples:
                userNotFound:
                  summary: User not found
                  value:
                    code: user_id_not_found
                    type: invalid_request_error
                    message: The specified user_id does not exist
        '409':
          description: Conflict - Duplicate OTP request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
              examples:
                duplicateOtpRequest:
                  summary: OTP verification ID already exists
                  value:
                    code: otp_verification_id_already_exists
                    type: validation_error
                    message: >-
                      OTP request with the same otp_verification_id already
                      exists
        '429':
          description: Too Many Requests - Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StructuredErrorResponse'
              examples:
                rateLimitExceeded:
                  summary: Rate limit exceeded
                  value:
                    code: rate_limit_exceeded
                    type: rate_limit_error
                    message: Rate limit exceeded. Please try again after some time
        '500':
          $ref: '#/components/responses/Response500'
components:
  parameters:
    global_x_api_version:
      description: API version to be used. Format is in YYYY-MM-DD.
      name: x-api-version
      in: header
      required: true
      schema:
        type: string
        default: '2025-11-01'
        example: '2025-11-01'
      example: '2025-11-01'
  requestBodies:
    SendOtpRequest:
      description: Request parameters to generate an OTP for the user.
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SendOtpRequest'
  responses:
    SendOtpResponse:
      description: Success response for generating an OTP.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SendOtpResponse'
          examples:
            SUCCESS:
              summary: Successful OTP generation
              value:
                otp_verification_id: Test123
                cf_otp_verification_id: '8901234567890123456'
                status: OTP_GENERATED
                user_id: USER827364
                notification_modes:
                  - SMS
                  - WHATSAPP
    Response401:
      description: Unauthorised - Invalid or missing authentication.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StructuredErrorResponse'
          examples:
            invalidCredentials:
              summary: Invalid client credentials
              value:
                code: authentication_failed
                type: authentication_error
                message: Invalid client ID and client secret combination
    Response500:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StructuredErrorResponse'
          examples:
            internalError:
              summary: Internal server error
              value:
                code: internal_server_error
                type: internal_error
                message: An internal error occurred while processing the request
  schemas:
    StructuredErrorResponse:
      type: object
      properties:
        type:
          type: string
          description: A broad category of the error.
          example: internal_error
        code:
          type: string
          description: A machine-readable error code specific to the issue.
          example: internal_server_error
        message:
          type: string
          description: >-
            A message providing more details about the error, dynamic based on
            the specific issue.
          example: Internal server error
    SendOtpRequest:
      type: object
      required:
        - otp_verification_id
        - user_id
        - notification_modes
      properties:
        otp_verification_id:
          type: string
          description: >-
            Unique identifier that you create to identify the OTP verification
            request in your system. Maximum 50 characters. Only alphanumeric
            characters, periods (.), hyphens (-), and underscores (_) are
            allowed.
          example: Test123
          minLength: 1
          maxLength: 50
        user_id:
          type: string
          description: >-
            Unique identifier for the user, as provided by you during PPI user
            creation.
          example: USER827364
          minLength: 1
          maxLength: 50
        notification_modes:
          type: array
          description: >-
            Array of notification modes for OTP delivery. Supported modes are
            SMS and WHATSAPP.
          items:
            type: string
            enum:
              - SMS
              - WHATSAPP
          example:
            - SMS
            - WHATSAPP
          minItems: 1
    SendOtpResponse:
      type: object
      properties:
        otp_verification_id:
          type: string
          description: >-
            Unique identifier for the OTP verification request, as provided by
            you during the request.
          example: Test123
        cf_otp_verification_id:
          type: string
          description: >-
            Unique identifier for the OTP verification request, generated by
            Cashfree.
          example: '8901234567890123456'
        status:
          type: string
          description: Status of the OTP generation process.
          example: OTP_GENERATED
          enum:
            - OTP_GENERATED
            - FAILED
        user_id:
          type: string
          description: >-
            Unique identifier for the user, as provided by you during PPI user
            creation.
          example: USER827364
        notification_modes:
          type: array
          description: Array of notification modes used for OTP delivery.
          items:
            type: string
            enum:
              - SMS
              - WHATSAPP
          example:
            - SMS
            - WHATSAPP
  securitySchemes:
    XClientID:
      type: apiKey
      in: header
      name: x-client-id
      description: >-
        Your unique client identifier issued by Cashfree. You can find this in
        your [Merchant
        Dashboard](https://merchant.cashfree.com/merchants/landing?env=prod).
    XClientSecret:
      type: apiKey
      in: header
      name: x-client-secret
      description: >-
        The secret key associated with your client ID. Use this to authenticate
        your API requests. You can find this in your [Merchant
        Dashboard](https://merchant.cashfree.com/merchants/landing?env=prod).

````