REST · Webhooks · UK numbers

The SMS API for UK numbers

Send a text message with one POST request. Receive replies as signed webhooks. Real UK numbers, flat credit pricing, and a sandbox you can build against for free.

curl https://api.useline.io/v1/messages \
  -H "Authorization: Bearer line_sk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "+447700900001",
    "to": "+447700900002",
    "body": "Your appointment is confirmed for 3pm tomorrow."
  }'

201 Created

{
  "id": "msg_abc123",
  "from": "+447700900001",
  "to": "+447700900002",
  "status": "queued",
  "segments": 1,
  "credits_used": 4,
  "created_at": "2026-09-04T10:30:00Z"
}

From £4/mo · SMS from 3p · Test keys are free

What is an SMS API?

An SMS API is an HTTP interface that lets software send and receive text messages without a handset. Your application makes an authenticated request containing a sender number, a recipient number and a message body; the provider turns that request into an SMS and hands it to the mobile networks. Replies come back the other way, as webhooks POSTed to a URL you control. The API is the interface; the SMS gateway behind it is the infrastructure that reaches the handset.

In practice an SMS messaging API is judged on four things: how quickly you can send the first message, whether it tells you what happened to it, whether inbound messages are a first-class feature or an add-on, and how the pricing reads. The rest of this page covers all four.

1

Create an API key

Sign up, pick a UK number, and create a key in the dashboard. Test keys work immediately, so you can build before you spend anything.

2

POST your first message

Three fields — from, to and body. You get back a message ID, the segment count and the credits the send will cost.

3

Subscribe to webhooks

Register an endpoint for the events you care about. Line signs each delivery, so verify the signature and reject anything older than five minutes.

What people build on the Line SMS API. Mostly things their customers notice.

The API is the same one the Line app uses, so anything you can do in the inbox you can also do from code.

Transactional alerts

Order confirmations, payment receipts, delivery updates and appointment reminders, fired from your own backend at the moment they happen.

Business SMS

Verification codes

Generate a code, send it through the API, and confirm it landed with a delivery webhook.

OTP and 2FA over SMS

Two-way support

Inbound webhooks push replies straight into your app, or into a shared inbox your team can answer from. One UK number sends and receives.

Shared team inbox

Internal tooling

On-call pages, deploy alerts and CRM triggers. A single curl in a cron job is often the whole integration — or wire it up without code.

Zapier and Make

Everything the API does

Send, receive, retry safely and know what happened — without wiring together three services to get there.

One POST, one message
Sending an SMS is a single POST to /v1/messages with from, to and body. No session set-up, no SDK required — any HTTP client will do.
Bearer key authentication
Authenticate with a line_sk_live_ key in the Authorization header. Keys are scoped to one organisation and can be revoked without a redeploy.
Delivery webhooks
Subscribe to message.sent, message.delivered and message.failed. Every event is signed with HMAC-SHA256 so you can verify it came from Line.
Inbound messages
message.received fires the moment someone texts your number, with the sender, the body and the conversation it belongs to. Two-way on the same number.
Idempotency keys
Send an Idempotency-Key header on any POST. Replay it within 24 hours and you get the original response back — a retry never sends the message twice.
Test mode
A line_sk_test_ key routes to the sandbox. Realistic responses, simulated status transitions, test webhooks — no real SMS and no credits spent.

SMS character limits and segments

One SMS holds 160 characters in the GSM-7 alphabet. Go past that and the message is split into segments of 153 characters, because 7 characters of each segment carry the header that reassembles them on the handset. A single character outside GSM-7 — an emoji, a curly quote, an accented letter outside the set — switches the whole message to UCS-2, which holds 70 characters in one segment and 67 per segment after that.

Every segment is billed. The API returns the segment count and the credits used on the send response, so you never have to guess — and the delivery report tells you whether it arrived. See full pricing for the per-plan rates. Type into the box below to see what a message will cost before you send it.

90 characters left in segment 1

Encoding
GSM-7
Characters
70
Segments
1
Credits
4

Credits are shown at the Starter rate of 4 credits per segment. 1 credit = 1p. Pro and Business send from 3.5 and 3 credits.

Built to be predictable

The unglamorous parts of an SMS API service, done properly.

Rate limits you can see
Every response carries X-RateLimit-Limit, -Remaining and -Reset. Paid keys run at 100 requests per minute with a burst of 20; higher limits are available on request.
One error shape
Every failure returns the same object — a stable code, a human message and the offending field. No parsing prose to work out what went wrong.
Cursor pagination
List endpoints take cursor and limit, never an offset. Paging stays correct while new messages arrive underneath you.

Line vs the global SMS APIs

Twilio, Vonage and MessageBird are built for global teams. Line is built for UK sending.

UK numbers from the first request

Global platforms make you provision a UK number through a separate flow, and often fall back to a shared sender ID. With Line you choose a real UK mobile, national or local number at sign-up and send from it straight away.

Pricing you can read in one line

1 credit is 1p. An SMS segment is 4 credits on Starter, 3.5 on Pro and 3 on Business. There is no per-request fee, no monthly minimum and no volume commitment to negotiate.

An inbox behind the API

Messages sent through the API appear in the same shared inbox your team already uses. Support can pick up a thread a script started — something a pure gateway cannot do.

Self-serve, not a sales call

No enterprise onboarding, no solutions engineer, no minimum term. Create a key and send. Cancel whenever you like.

SMS API FAQ

The questions developers ask before they write the integration.

What is an SMS API?

An SMS API is an HTTP interface that lets software send and receive text messages without a phone or a handset. Your application makes an authenticated POST request containing the sender number, the recipient number and the message body; the provider converts that request into an SMS and hands it to the mobile networks. Inbound messages travel the other way as webhooks — the provider POSTs each reply to a URL you own.

How do I send an SMS with an API?

Create an API key, then POST to /v1/messages with an Authorization: Bearer header and a JSON body containing from, to and body. Phone numbers use E.164 format, for example +447700900002. The API responds 201 Created with a message ID, the segment count and the credits the send costs. That is the whole integration — no SDK is required.

What is the SMS character limit?

A single SMS holds 160 characters in the GSM-7 alphabet. Longer messages are split into segments of 153 characters each, because the remaining 7 characters carry the header that reassembles them. If the message contains any character outside GSM-7 — an emoji, a curly quote or most non-Latin scripts — the whole message switches to UCS-2 encoding, which holds 70 characters in one segment and 67 per segment after that. Each segment is billed separately.

Is there a free SMS API?

Free SMS APIs generally mean a shared sender ID, a hard message cap and no delivery guarantee, which makes them unsuitable for anything a customer depends on. Line has no free tier, but it does have a free sandbox: a test key returns realistic responses and fires test webhooks without sending real messages or spending credits. Live sending starts at 3p per segment on a £4/month plan.

Can the API receive SMS as well as send them?

Yes. Every Line number is two-way. Register a webhook for the message.received event and Line POSTs each inbound message to your endpoint in real time, including the sender number, the body, the conversation ID and the contact ID. You do not need a separate inbound number.

How do I stop a retry sending the same SMS twice?

Send an Idempotency-Key header with the POST. If Line sees the same key again within 24 hours it returns the original response instead of sending a second message. This makes it safe to retry after a timeout or a dropped connection.

What are the rate limits?

Paid API keys are limited to 100 requests per minute with a burst allowance of 20. Trial keys run at 20 per minute with a burst of 5. Every response includes X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers, and a 429 response carries the rate_limit_exceeded error code. Higher limits are available on request.

How does the Line SMS API compare to Twilio?

Twilio is a global platform priced and documented for large engineering teams. Line is built for UK sending: a dedicated UK number from sign-up, flat credit pricing at 3p to 4p per segment, no monthly minimum, and a shared team inbox behind the same API. If you send outside the UK at scale, Twilio's coverage is broader. If your recipients are in the UK, Line is simpler and cheaper.

Send your first SMS today

Create a test key and build the integration for free. Add a UK number when you are ready to send for real.

  • REST API — POST /v1/messages
  • Real UK mobile, national or local number
  • Delivery and inbound webhooks, HMAC signed
  • Idempotency keys on every POST
  • Free sandbox with test keys
  • SMS from 3p per segment
  • No minimum spend, no contract
Get Your API Key

From £4/mo. Prices exclude VAT. Full pricing

Also useful: UK SMS gateway · OTP SMS · Delivery reports · No-code integrations