curl --request POST \
--url https://api.robase.dev/v1/otp/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "+2348012345678",
"code_length": 6,
"ttl_seconds": 600,
"language": "fr",
"channel": "whatsapp"
}
'import requests
url = "https://api.robase.dev/v1/otp/send"
payload = {
"phone_number": "+2348012345678",
"code_length": 6,
"ttl_seconds": 600,
"language": "fr",
"channel": "whatsapp"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone_number: '+2348012345678',
code_length: 6,
ttl_seconds: 600,
language: 'fr',
channel: 'whatsapp'
})
};
fetch('https://api.robase.dev/v1/otp/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.robase.dev/v1/otp/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone_number' => '+2348012345678',
'code_length' => 6,
'ttl_seconds' => 600,
'language' => 'fr',
'channel' => 'whatsapp'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.robase.dev/v1/otp/send"
payload := strings.NewReader("{\n \"phone_number\": \"+2348012345678\",\n \"code_length\": 6,\n \"ttl_seconds\": 600,\n \"language\": \"fr\",\n \"channel\": \"whatsapp\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.robase.dev/v1/otp/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number\": \"+2348012345678\",\n \"code_length\": 6,\n \"ttl_seconds\": 600,\n \"language\": \"fr\",\n \"channel\": \"whatsapp\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.robase.dev/v1/otp/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number\": \"+2348012345678\",\n \"code_length\": 6,\n \"ttl_seconds\": 600,\n \"language\": \"fr\",\n \"channel\": \"whatsapp\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone_number": "+2348012345678",
"country_code": "NG",
"credit_cost": 1,
"status": "pending",
"code_length": 6,
"expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"channel": "sms"
}Send an OTP
POST /v1/otp/send — generate a code, charge credits, queue SMS and/or WhatsApp OTP delivery.
curl --request POST \
--url https://api.robase.dev/v1/otp/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "+2348012345678",
"code_length": 6,
"ttl_seconds": 600,
"language": "fr",
"channel": "whatsapp"
}
'import requests
url = "https://api.robase.dev/v1/otp/send"
payload = {
"phone_number": "+2348012345678",
"code_length": 6,
"ttl_seconds": 600,
"language": "fr",
"channel": "whatsapp"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone_number: '+2348012345678',
code_length: 6,
ttl_seconds: 600,
language: 'fr',
channel: 'whatsapp'
})
};
fetch('https://api.robase.dev/v1/otp/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.robase.dev/v1/otp/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone_number' => '+2348012345678',
'code_length' => 6,
'ttl_seconds' => 600,
'language' => 'fr',
'channel' => 'whatsapp'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.robase.dev/v1/otp/send"
payload := strings.NewReader("{\n \"phone_number\": \"+2348012345678\",\n \"code_length\": 6,\n \"ttl_seconds\": 600,\n \"language\": \"fr\",\n \"channel\": \"whatsapp\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.robase.dev/v1/otp/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number\": \"+2348012345678\",\n \"code_length\": 6,\n \"ttl_seconds\": 600,\n \"language\": \"fr\",\n \"channel\": \"whatsapp\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.robase.dev/v1/otp/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number\": \"+2348012345678\",\n \"code_length\": 6,\n \"ttl_seconds\": 600,\n \"language\": \"fr\",\n \"channel\": \"whatsapp\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone_number": "+2348012345678",
"country_code": "NG",
"credit_cost": 1,
"status": "pending",
"code_length": 6,
"expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"channel": "sms"
}otp_delivery_mode is sms | whatsapp | both | either (default sms). Optional request channel is sms | whatsapp.
There is no silent WhatsApp→SMS fallback. A failed WhatsApp leg is refunded and reported failed. Mode both sends both legs and refuses an explicit channel. Mode either omits to SMS.Authorizations
Your Robase API key. Starts with robe_. Include as Authorization: Bearer robe_...
Headers
Opaque client-generated key. Replaying the same key within 24 hours
returns the original response (with Idempotent-Replayed: true)
instead of performing the action again. Recommended for every send so
a network-level retry cannot double-charge. The same key with a
different endpoint or body returns 422 idempotency_key_reused; a
repeat while the first request is still running returns
409 request_in_progress. 5xx and 429 responses are not kept, so
a retry with the same key runs again.
255Body
Phone number in E.164 format
"+2348012345678"
Number of digits in the generated code. Omit to use the default —
sending 0 is not the same as omitting the field. Anything outside
4–8 is refused with validation_error.
4 <= x <= 8How long the code stays verifiable, in seconds. Omit to use the default.
1 <= x <= 3600Language for the OTP message body. Omit to use the workspace's default language (Settings → General → Language & region). Supply it per request when your own end users are not all in the same language.
Accept-Language deliberately does not affect the message body — it describes the integrator reading our error responses, not the person receiving the SMS.
en, fr "fr"
Delivery channel for this send. Honoured only when the workspace
otp_delivery_mode allows it:
smsmode: onlysms(or omit);whatsapp→channel_not_allowedwhatsappmode: onlywhatsapp(or omit);sms→channel_not_allowedbothmode: omit only; any explicit value →channel_not_allowedeithermode:smsorwhatsapp; omit means SMS
WhatsApp is OTP-only (Meta Authentication + copy-code). A failed WhatsApp leg is never silently re-sent as SMS.
sms, whatsapp "whatsapp"
Arbitrary key-value data stored with the OTP and returned by GET /v1/otp/{id}
Response
OTP created, charged, and queued for delivery
OTP ID to use with the verify and get endpoints
Destination the code was sent to, in E.164 format
"+2348012345678"
ISO 3166-1 alpha-2 country code derived from the number
"NG"
Credits consumed by this send
1
Always pending — delivery happens asynchronously
pending Number of digits in the generated code
6
After this instant the code can no longer be verified
Channel(s) this OTP was queued on. both means SMS and WhatsApp
legs were charged together.
sms, whatsapp, both