Every call needs Authorization: Bearer lh_… unless marked No key needed ; the example uses $API for https://api.localhost.co.zw and $LH_API_KEY for your key. A * marks a required field.
GET /phone-auth/apps
The account's Phone Auth apps: the id to pass as `app`, the name in the text, the sender, the code's length.
Responses
200 list[AppOut ]
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/phone-auth/apps" \
-H "Authorization: Bearer $LH_API_KEY"
POST /phone-auth/send
Text a code to a Zimbabwe mobile number. One per number per minute; it lasts the app's minutes (5 by default), can be tried 5 times and works once. 402 when the account's SMS credits have run out.
Request body SendIn
Name Type Notes
phone *
string
app
string
default ""
reference
string
default ""
Responses
202 SendOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/phone-auth/send" \
-H "Authorization: Bearer $LH_API_KEY" \
-H "Idempotency-Key: <a fresh unique string>" \
-H "Content-Type: application/json" \
-d '{
"phone": "<phone>"
}'
#
Verify
phone_auth:write
POST /phone-auth/verify
Is this the code we sent? Give the id from /send, or the phone number (the latest code to it from this app).
Request body VerifyIn
Name Type Notes
code *
string
id
string
default ""
phone
string
default ""
app
string
default ""
Responses
200 VerifyOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/phone-auth/verify" \
-H "Authorization: Bearer $LH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": "<code>"
}'
Shapes
The objects these endpoints send and receive.
AppOut
Name Type Notes
id *
string
name *
string
sender *
string
digits *
integer
expires_in *
integer
SendIn
Name Type Notes
phone *
string
app
string
default ""
reference
string
default ""
SendOut
Name Type Notes
id *
string
to *
string
sender *
string
expires_in *
integer
VerifyIn
Name Type Notes
code *
string
id
string
default ""
phone
string
default ""
app
string
default ""
VerifyOut
Name Type Notes
valid *
boolean
reason
string
default ""