The SMS API for UK numbers
Send a text message with one POST request. Receive replies as signed webhooks. Real UK numbers, credit pricing, and a sandbox you can use after account approval.
curl https://useline.io/api/v1/messages \
-H "Authorization: Bearer line_sk_live_xxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: booking-482-reminder-v1" \
-d '{
"from": "+447700900001",
"to": "+447700900456",
"body": "Your appointment is confirmed for 3pm tomorrow."
}'201 Created
{
"id": "00000000-0000-0000-0000-000000000000",
"conversation_id": "00000000-0000-0000-0000-000000000001",
"from": "+447700900001",
"to": "+447700900456",
"status": "queued",
"segments": 1,
"estimated_credits": "8",
"livemode": true,
"status_url": "https://useline.io/api/v1/messages/00000000-0000-0000-0000-000000000000"
}From £4/mo · SMS from 7p · 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.
Request API access
Sign up, pick a UK number, and submit your use case and consent process. After approval, create a scoped test or live key in the dashboard.
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.
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 SMSVerification codes
Generate and validate codes in your application. Line sends the SMS and reports delivery; your application owns expiry, attempts, and anti-fraud controls.
OTP and 2FA over SMSTwo-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 inboxInternal 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 MakeEverything 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 /api/v1/messages with from, to and body. No session set-up or SDK is required.
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, and goes out the moment it happens.
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
- 8
Credits are shown at the Starter rate of 8 credits per segment. 1 credit = 1p. Pro sends at 7 credits and Business at 8.
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, then request API access for it.
Pricing you can read in one line
1 credit is 1p. An SMS segment is 8 credits on Starter, 7 on Pro and 8 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.
Clear approval and controls
Request access in the dashboard. Line reviews the use case, destinations, senders, and consent process before it enables keys.
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?
After Line approves your account, create an API key. Then POST to /api/v1/messages with Authorization, Idempotency-Key, and a JSON body containing from, to and body. Phone numbers use E.164 format. The API responds 201 Created with a message ID, segment count, and estimated credits.
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 8p 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 message.received and Line POSTs each inbound message to your endpoint with the body, message ID, conversation ID, and permitted sender 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?
The default account limit is 100 requests per minute with a burst allowance of 20. Every response includes X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers. A 429 response includes Retry-After and the rate_limit_exceeded error code.
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, credit pricing from 7p per segment with no rate card to read, 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 to run.
Send your first SMS today
Request access for your organisation. After approval, use a test key without sending real SMS or spending credits.
- REST API — POST /api/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 7p per segment
- No minimum spend, no contract
From £4/mo. Prices exclude VAT. Full pricing
Also useful: UK SMS gateway · OTP SMS · Delivery reports · No-code integrations