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

# Request OTP

> Request an OTP token



## OpenAPI

````yaml POST /otp/request_token
openapi: 3.0.1
info:
  title: OpenAPI Simpu API
  description: Simpu API Documentation
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.simpu.co
security:
  - apiKeyAuth: []
paths:
  /otp/request_token:
    post:
      description: Request an OTP token
      requestBody:
        description: OTP request object
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OTPTokenRequest'
        required: true
      responses:
        '200':
          description: OTP response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OTP'
        '400':
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    OTPTokenRequest:
      type: object
      properties:
        recipient:
          description: Recipient of the OTP token
          type: string
          example: '2348023456789'
        length:
          description: Length of the OTP token
          type: number
          example: 6
          default: 4
          minimum: 4
          maximum: 8
        expires_in:
          description: Time in minutes before the OTP token expires
          type: number
          example: 30
          default: 15
          minimum: 1
          maximum: 60
        token:
          description: >-
            The OTP token to send to the recipient, if not specified, a new
            token will be generated
          type: string
          example: '123456'
        channel:
          description: Channel to send the OTP token
          type: string
          enum:
            - sms
            - whatsapp
          example: sms
      required:
        - recipient
    OTP:
      required:
        - id
        - recipient
        - status
        - status_desc
        - created_datetime
      type: object
      properties:
        id:
          description: ID of the OTP token
          type: string
          example: 674535b2b39158b9aae90188fcec23eb
        recipient:
          description: Recipient of the OTP token
          type: string
          example: '2348023456789'
        status:
          description: Status of the OTP token
          type: number
          example: 1
        status_desc:
          description: Description of the status of the OTP token
          type: string
          example: SENT
        created_datetime:
          description: Date and time the OTP token was created
          type: string
          example: '2024-06-28T23:56:38.128604+00:00'
        updated_datetime:
          description: Date and time the OTP token was last updated, if any
          type: string
          example: '2024-06-28T23:56:38.128604+00:00'
    Error:
      required:
        - status
        - message
      type: object
      properties:
        status:
          type: integer
          format: int32
          example: 200
        message:
          type: string
          example: Invalid request
        errors:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
                example: name
              message:
                type: string
                example: 'Error in field: ''name'' Field required.'
              type:
                type: string
                example: missing
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: An API key to authenticate requests

````