Email OTP API

Code samples

Copy-paste examples for the /send endpoint.

PHP
<?php
$ch = curl_init('https://softwearapp.com/otp-api/api/v1/send');
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'Content-Type: application/json',
    'X-Api-Key: ' . getenv('OTP_PK'),
    'X-Api-Secret: ' . getenv('OTP_SK'),
  ],
  CURLOPT_POSTFIELDS => json_encode(['email' => $email]),
]);
$res = json_decode(curl_exec($ch), true);
$requestId = $res['request_id'] ?? null;