OTP

Send OTP

Send a one-time code.

A different 6-digit code on each listed channel; a channel that can not send is refused on its own, and nothing is charged for it. Sending again to the same number and purpose ends the open code.

Header Parameters

Idempotency-Key?string
Lengthlength <= 255
X-Request-Id?string

Your id for this request; it becomes the request_id of any error. Without it the server makes one.

Request Body

application/json
  1. body
identifier*string

The phone number, E.164 or national in country.

channels*array<>
Items1 <= items <= 2
purpose?string
Match^[a-z0-9_]{1,32}$
Default"default"
ttl_seconds?integer
Range60 <= value <= 480
Default300
sender_id?string

An approved sender ID for SMS; the workspace's first one when left out.

app_name?string
Match^[A-Za-z0-9 ]{1,20}$
language?string
Default"en"
Value in"en""sw"
country?string

ISO 3166 alpha-2 a national number is read in; the workspace's when left out.

curl -X POST 'https://v3.ghala.io/v1/otp' \  -H 'Content-Type: application/json' \  -d '{  "identifier": "string",  "channels": [    "whatsapp"  ]}'
{  "otp_id": "54bb07c0-6b6d-4331-9eba-71e1c890eb14",  "expires_at": "2019-08-24T14:15:22Z",  "channels": [    {      "channel": "whatsapp",      "status": "queued",      "code": "string",      "reason": "string"    }  ]}