Skip to content
Tellwing

SMS OTP

Verification codes by SMS with one request to the API: your system generates the code and Tellwing delivers it.

The channel is built, but no SMS goes out yet. It will come with the paid plans, from Starter, and each message will be paid from prepaid balance.

How it works

An OTP code confirms that whoever signs in has the person's phone. With Tellwing the split is clear: your system generates and checks the code, and Tellwing delivers it by SMS.

  1. 1

    You generate the code

    Your system creates the one-time code, stores it with its expiry and decides how many attempts to allow. Tellwing doesn't generate or check codes.

  2. 2

    You send it through the API

    One request to POST /v1/sms with the number, the text and the otp type.

  3. 3

    Tellwing delivers it

    The message goes to the carrier and the response brings the send's id, the segments charged and the encoding.

  4. 4

    The person types it

    Your system compares what they type with what it stored. If it expired or they got it wrong too many times, you generate a new one.

The request

With an API key: tw_live_… live, or tw_test_… to test without sending anything.

http
curl https://api.tellwing.com/v1/sms \
-H "Authorization: Bearer tw_live_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: login-3001234567-482913" \
-d '{
"to": "+573001234567",
"body": "Your Tienda Andina code is 482913. It expires in 10 minutes.",
"type": "otp"
}'

The response comes back with status 202:

http
{
"id": "3b1f2a9c-7d41-4e0a-9c55-0d2f8e6b7a10",
"status": "sent",
"message_id": "2b8c1f0e-0a6d-4f4e-8f52-6c1d2e3f4a5b",
"segments": 1,
"encoding": "GSM-7",
"characters": 60
}

Always send Idempotency-Key: if your system retries the request, Tellwing replays the same response and doesn't send two codes. With the send's id, GET /v1/sms tells you whether the message was sent, delivered or failed. The full reference is in the API documentation.

Limits and rules

  • Colombia only, for now. A number from another country returns a 400 error and nothing is sent.
  • Per-number limit. With the otp type, the limit of messages per hour to the same number is stricter than for a notice, to stop anyone requesting codes nonstop.
  • Up to 10 segments. A code fits in one; the text accepts up to 1,600 characters.
  • Not advertising. A code needs no SMS permission from the contact, and neither the advertising hours of Colombia's Law 2300 nor the CRC's excluded-numbers registry apply. The Terms prohibit using this send for promotions.
  • Privacy. Tellwing doesn't store the number or the text of the message.
  • Key permission. The key needs the sms:send permission.

Best practices

How many digits to use, how long the code should last, how many attempts to allow and what to say in the message are in the guide to SMS verification codes.

For the text, keep it to the essentials: your brand, the code and the expiry. For example: “Your Tienda Andina code is 482913. It expires in 10 minutes.” Without emojis or accents it fits in one segment of up to 160 characters.

What each code costs

A code is charged like any SMS: $0.08 per segment to Colombia. It almost always fits in one:

What each code costs
MessageEncodingSegmentsCost
«Your Tienda Andina code is 482913. It expires in 10 minutes.»GSM-71$0.08
«Your Tienda Andina code is 482913 🔒»UCS-21$0.08
«482913 is your Tienda Andina code. Don't share it with anyone: no one from Tienda Andina will ever ask for it. It expires in 10 minutes. 🔒»UCS-23$0.24

The price per country and how you pay are on SMS pricing.

Frequently asked questions

Does Tellwing generate and check the code?

No. Your system generates the code, stores it and checks it; Tellwing only delivers the SMS.

How much does it cost to send an OTP code by SMS?

$0.08 per segment to Colombia. A short code takes one segment: up to 160 characters without accents or emojis, or 70 with any.

Which countries can I send codes to?

For now, only Colombia. A number from another country returns an error and nothing is sent.

When can I start sending codes?

Soon: the channel is built, but no SMS goes out yet.

Does Law 2300 apply to verification codes?

No. A verification code is not advertising, so neither the advertising hours of Law 2300 nor the CRC's excluded-numbers registry apply.