Phone login
Your agent normally sees a texter as an anonymous sender_id. If people also log in to your website or app, phone login tells your agent which of your accounts is texting, without ever handling their phone number.
It works like "Sign in with…" (OAuth), with your app as the identity provider and a text message as the redirect. The user is already logged in on your side; texting a code proves they hold the phone:
- A user logs in to your site. Your server asks us for a one-time code for that account.
- Your site shows it: "Text 4KF7QX to +1 415 555 0100" (or a one-tap link on mobile).
- They text the code. That phone is now logged in to the account, and we text back a confirmation.
- From then on every text from that phone reaches your agent with
account_id. - To log out, your app calls
DELETE …/logins/:sender_id, or the user textsLOGOUT.
If you set up your line with Let your agent set it up, the prompt asks your agent to build all of this for you (and a sign-up and login, if your app has none), unless you opted out. Setup then hands the agent a line key for these endpoints.
Codes only work for the line that issued them, only once, and only for 10 minutes by default. We store a hash, never the code.
1. Get a login code (from your server)
Call this from your backend after the user logs in. It uses your API key, so never call it from the browser.
curl -s -X POST "https://silverarrows.dev/v1/lines/$LINE_ID/login_codes" \
-H "Authorization: Bearer $SA_KEY" -H "Content-Type: application/json" \
-d '{"account_id":"user_8412"}'
{
"id": "lgc_6y2Qm0kTn4Lr8xVbC1aZ",
"code": "4KF7QX",
"account_id": "user_8412",
"status": "pending",
"number_e164": "+14155550100",
"text_snippet": "Text 4KF7QX to +14155550100",
"sms_link": "sms:+14155550100?body=4KF7QX",
"created_at": "2026-10-24T17:00:00.000Z",
"expires_at": "2026-10-24T17:10:00.000Z",
"logged_in_at": null,
"sender_id": null,
"conversation_id": null
}
| Field | Meaning |
|---|---|
account_id |
Required. Your id for the logged-in user, up to 200 characters. Use an opaque id, not an email address. |
expires_in |
Optional. Seconds the code stays valid: 60 to 3600. Default 600 (10 minutes). |
Show text_snippet to the user, and on phones make it a link to sms_link so the code is filled in. The code is only in this response: if you lose it, ask for a new one.
The line must have passed its connection test (409 line_not_live otherwise), because a texted code needs a live line to reach.
2. Wait for the text
Poll the code's status while your page is open (every 2 to 3 seconds is plenty):
GET /v1/lines/:id/login_codes/:code_id
status is pending, logged_in or expired. Once it's logged_in, the response also has logged_in_at, sender_id and conversation_id, so you can show "Your phone is connected" and store the sender_id if you like.
People can type the code however they like: 4kf7qx, 4KF-7QX, 4KF 7QX and LOGIN 4KF7QX all work. On the shared trial number the code also opens the conversation with your line, the same way your keyword does, so they don't need to text the keyword first.
The texter gets the opt-in confirmation (on their first text to the line) and then: "You're logged in! This phone is now signed in to your Line name account. Text LOGOUT any time to sign out." The code itself never reaches your agent, isn't in history, and isn't billed as a reply.
3. Read account_id in your agent
Every later text from that phone carries account_id in the webhook and relay payload, right after sender_id:
{
"line_id": "line_…",
"conversation_id": "conv_…",
"sender_id": "snd_3f9a1c0b7e2d4a6b8c1d2e3f",
"account_id": "user_8412",
"message": { "id": "msg_…", "body": "what's on my calendar today?", "media_urls": [], "received_at": "…" },
"history": []
}
No account_id means the phone isn't logged in: answer as you would for any anonymous texter, or reply with a link to your login page.
account_id also appears on each thread in GET /v1/lines/:id/conversations (null when logged out).
List logins and log out
curl -s "https://silverarrows.dev/v1/lines/$LINE_ID/logins?account_id=user_8412" \
-H "Authorization: Bearer $SA_KEY"
{ "data": [{ "account_id": "user_8412", "sender_id": "snd_…", "conversation_id": "conv_…", "logged_in_at": "…" }] }
Leave out account_id to list every logged-in phone on the line, newest first. To log one phone out (for example when the user clicks "Disconnect my phone" in your app, or logs out everywhere):
DELETE /v1/lines/:id/logins/:sender_id
Texters can log out themselves too: texting LOGOUT (or log out, sign out) from a logged-in phone logs it out and confirms by text. From a phone that isn't logged in, LOGOUT is an ordinary text and reaches your agent.
A logged-out phone can keep texting your line; it just arrives without account_id until it logs in again.
Rules
- One account per phone, per line. If the same phone texts a code for a different account, the new login replaces the old one. One account can log in several phones.
- Per line. A login on one line says nothing about your other lines. Get the code from the line the user will text.
- Codes are secrets. Whoever texts a code gets logged in to its account, so only show it to that logged-in user, over HTTPS, and keep codes short-lived.
- STOP still wins. An opted-out phone can't log in, and a logged-in phone that texts STOP gets nothing until START. The login itself stays.
- Check our signature.
account_idunlocks a user's data, so your endpoint must verifyX-Arrow-Signature(see Webhook). Otherwise anyone who finds its URL can post a made-upaccount_id. Agent setup with user accounts refuses an endpoint that answers a wrongly signed request. - Take account_id from your session. Your server should mint codes for the user in its own session, never for an id the browser sends.
- 90 days idle logs out. A phone that doesn't text the line for 90 days is logged out, because phone numbers get reassigned. Its next text arrives without
account_id. - Anti-guessing. A phone that texts more than 10 code-shaped messages in an hour stops being matched for the rest of that hour, and you can mint 300 codes an hour (per account and per key).
- Retention. Used and expired codes are deleted a day after they expire. Logins last until the phone logs out, goes 90 days without texting, or you delete the line; they survive a move to a number of its own.
Platform keys use the same endpoints under /v1/platform/lines/:id/….