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

# Validate OTP

> Verify One-Time Passwords (OTPs) with comprehensive validation checks for secure authentication workflows and two-factor authentication systems.



## OpenAPI

````yaml POST /otp/code/validate
openapi: 3.1.0
info:
  title: CrunchzApp API Docs
  version: 1.0.0
  description: >-
    Comprehensive WhatsApp API for seamless messaging integration, automation,
    and customer communication in your applications.
servers:
  - url: https://api.crunchz.app/api
security:
  - http: []
paths:
  /otp/code/validate:
    post:
      tags:
        - OTP Code
        - OtpCode
      summary: OTP Code - Validate Code
      description: >-
        Verify One-Time Passwords (OTPs) with comprehensive validation checks
        for secure authentication workflows and two-factor authentication
        systems.
      operationId: otpCode.validateCode
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ValidateOtpCodeRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                  - $ref: '#/components/schemas/ValidateOtpCodeResource'
        '400':
          $ref: '#/components/responses/BadRequestException'
        '401':
          $ref: '#/components/responses/UnauthorizedException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '500':
          $ref: '#/components/responses/InternalServerErrorException'
components:
  schemas:
    ValidateOtpCodeRequest:
      type: object
      properties:
        contact_id:
          type: string
          description: Contact ID.
          pattern: ^[0-9]+@[cs]\.us$
          minLength: 10
          maxLength: 50
          example: xxx@c.us
        code:
          type: string
          description: OTP Code.
          pattern: ^[0-9]{4,8}$
          minLength: 4
          maxLength: 8
          example: '123456'
      required:
        - contact_id
        - code
      title: ValidateOtpCodeRequest
    ValidateOtpCodeResource:
      type: object
      properties:
        success:
          type: boolean
          description: The success status of response.
        message:
          type: string
          description: The message of response.
        data:
          type: object
          properties:
            id:
              type: string
              description: The ID of the message.
            code:
              type: string
              description: The otp code sent to phone.
            contact_id:
              type: string
              description: The contact id.
            is_validated:
              type: boolean
              description: The validation status.
            timestamp:
              type: string
              description: The timestamp when it triggered.
          required:
            - id
            - code
            - contact_id
            - is_validated
            - timestamp
      required:
        - success
        - message
        - data
      title: ValidateOtpCodeResource
  responses:
    BadRequestException:
      description: Bad request error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    UnauthorizedException:
      description: Unauthorized error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
    InternalServerErrorException:
      description: Internal server error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
  securitySchemes:
    http:
      type: http
      scheme: bearer
      bearerFormat: JWT

````