# Send OTP

Sends an OTP code to the holder via SMS or email. Use `certIdOtp` and `deviceCode` returned by `enroll`. See [sendOtp](https://docs.namirial.app/products/leandisposable/enterprise-documentation/developer-documentation/api-references/lean-send-otp/lean-sendotp-method).

Endpoint: POST /api/certificate/sendOtp
Version: 26.1.0.3
Security: basicAuth, sslCertificate

## Security:

  - `basicAuth` (unknown)
    http basic

  - `sslCertificate` (unknown)
    mutualTLS

## Request fields (application/json):

  - `certIdOtp` (integer, required)
    OTP certificate identifier returned by `enroll` (`certIdOtp`).
    Example: 1234567

  - `deviceCode` (string, required)
    Device code returned by `enroll` (`deviceCode`).
    Example: RHIDP0000000000000

  - `smsOptions` (object)
    SMS delivery options. Provide either `textSMS` or the `templateId`+`language` pair.

  - `smsOptions.templateId` (string)
    Identifier of a pre-configured SMS template. Required if `textSMS` is omitted.

  - `smsOptions.language` (string)
    ISO 3166-1 alpha-2 country code identifying the language of the template (e.g. `IT`, `EN`).

  - `smsOptions.textSMS` (string)
    Custom SMS text. Use `$OTP$` as placeholder for the OTP code. If omitted, the OTP is appended at the end.
    Example: Your OTP code is: $OTP$

  - `emailOptions` (object)
    Email delivery options.

  - `emailOptions.templateId` (string)
    Identifier of a pre-configured email template.

## Request examples:

  - `SMS with custom text` (unknown)

  - `SMS with template` (unknown)

  - `Email OTP` (unknown)

## Response 200:

  - `200` (unknown)
    OTP sent successfully. Response body is empty.

## Response 500:

  - `500` (unknown)
    Application error. The backend returns HTTP 500 for all application errors, including validation failures and authentication errors.

## Response 500 fields (application/json):

  - `code` (integer, required)
    Application error code.
    Example: 242

  - `message` (string, required)
    Human-readable error description. For validation errors (code 242), includes field-level details in the format `Input parameter invalid: [{field=..., message=...}]`.
    Example: Input parameter invalid: [{field=disposableHolder, message=must not be null}]

## Response 500 examples:

  - `Validation error — missing or invalid field (code 242)` (unknown)

  - `Authentication or authorization error (code 11002)` (unknown)

  - `Authorization error — user not authorized for this method or LRA (code 11002)` (unknown)

  - `certIdOtp not found (code 62)` (unknown)

  - `deviceCode not valid (code 249)` (unknown)

  - `OTP not sent — smsOptions empty (code 99)` (unknown)

