LOCALHOST
All pages
API reference

SMS

One-time codes, plain messages and tracked campaigns, paid in credits.

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.

#

List Campaigns

sms:read

GET /sms/campaigns

Responses

  • 200 list[CampaignOut]
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X GET "$API/sms/campaigns" \
  -H "Authorization: Bearer $LH_API_KEY"
#

Create Campaign

sms:write Idempotency-Key

POST /sms/campaigns

Send a campaign. Every https link in the message becomes a tracked short link, one per recipient.

Request body CampaignIn

NameTypeNotes
to * list[string] | string
sender * string
message * string
name string default ""

Responses

  • 201 CampaignOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X POST "$API/sms/campaigns" \
  -H "Authorization: Bearer $LH_API_KEY" \
  -H "Idempotency-Key: <a fresh unique string>" \
  -H "Content-Type: application/json" \
  -d '{
    "to": [
      "<to>"
    ],
    "sender": "<sender>",
    "message": "<message>"
  }'
#

Send

sms:write Idempotency-Key

POST /sms/messages

Send one message to one or many numbers (up to 200).

Request body SendIn

NameTypeNotes
phone * string
app string default ""
reference string default ""

Responses

  • 202 SendOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X POST "$API/sms/messages" \
  -H "Authorization: Bearer $LH_API_KEY" \
  -H "Idempotency-Key: <a fresh unique string>" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "<phone>"
  }'
#

Senders

sms:read

GET /sms/senders

The names this account can send from right now: its approved own names, then the shared one.

Responses

  • 200 list[string]
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X GET "$API/sms/senders" \
  -H "Authorization: Bearer $LH_API_KEY"
#

Get Campaign

sms:read

GET /sms/campaigns/{campaign_id}

Parameters

NameTypeNotes
campaign_id * in path integer

Responses

  • 200 CampaignOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X GET "$API/sms/campaigns/<campaign_id>" \
  -H "Authorization: Bearer $LH_API_KEY"
#

Otp Send

sms:write Idempotency-Key

POST /sms/otp/send

Text a 6-digit code to a Zimbabwe mobile number. One per number per minute; valid 5 minutes, 5 tries, used once.

Request body OtpSendIn

NameTypeNotes
phone * string
reference string default ""

Responses

  • 202 OtpSendOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X POST "$API/sms/otp/send" \
  -H "Authorization: Bearer $LH_API_KEY" \
  -H "Idempotency-Key: <a fresh unique string>" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "<phone>"
  }'
#

Otp Verify

sms:write

POST /sms/otp/verify

Is this the code we sent? Give the id from /otp/send, or the phone number (the latest code to it).

Request body OtpVerifyIn

NameTypeNotes
code * string
id string default ""
phone string default ""

Responses

  • 200 OtpVerifyOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X POST "$API/sms/otp/verify" \
  -H "Authorization: Bearer $LH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "<code>"
  }'

Shapes

The objects these endpoints send and receive.

CampaignIn

NameTypeNotes
to * list[string] | string
sender * string
message * string
name string default ""

CampaignOut

NameTypeNotes
id * integer
name * string
sender * string
created_at * datetime
total * integer
delivered * integer
sending * integer
failed * integer
credits * integer
clicked_people * integer
links * list[LinkOut]

LinkOut

NameTypeNotes
url * string
clicks * integer
people * integer

OtpSendIn

NameTypeNotes
phone * string
reference string default ""

OtpSendOut

NameTypeNotes
id * string
to * string
expires_in * integer

OtpVerifyIn

NameTypeNotes
code * string
id string default ""
phone string default ""

OtpVerifyOut

NameTypeNotes
valid * boolean
reason string default ""

SendIn

NameTypeNotes
phone * string
app string default ""
reference string default ""

SendOut

NameTypeNotes
id * string
to * string
sender * string
expires_in * integer