OkLine documentation¶
OkLine is the maintained, unofficial Python SDK for automating your own personal LINE Messenger account: log in by scanning a QR code in your terminal, send and receive messages and media as yourself, and decrypt E2EE Letter Sealing — with no developer account, no bot channel, and no webhook.
Under the hood it is a complete, high-level Python client and CLI for the API
used by the official LINE Chrome extension (CHROMEOS 3.7.2). It
reproduces the real protocol faithfully — gateway, headers, payloads, the
mandatory X-Hmac signature (computed by LINE's own ltsm.wasm), QR + e-mail
login, E2EE Letter Sealing, the SSE event stream and OBS media — wrapped in a
friendly Python API, a typed method per endpoint, a polished interactive menu,
and a ~30-command CLI. Every request and response is recorded so you can
inspect or paste it.
✅ Verified against LINE Chrome extension 3.7.2 — September 2026 (v2.9.2)
Unofficial — and candid about the risk. OkLine is not affiliated with LINE Corporation. Automating a personal account technically violates LINE's Terms of Service; LINE Corp forced code removal from a similar project (carpedm20-LINE) in 2014, and account suspension is a real possibility. Use it only with your own account, keep your request rate disciplined, and treat tokens and E2EE keys like passwords. The FAQ covers the ban-risk question head-on.
Features¶
- All 77 Thrift endpoints, each as a typed method — or call any of them generically with
api.call(...). - Mandatory
X-Hmacrequest signing, handled automatically (via a tiny Node bridge running LINE's realltsm.wasm). - QR login (scan with the LINE app, confirm a PIN) and e-mail (RSA) login, both with token auto-refresh.
- Media send — images, video, audio and files (
send_image/send_video/send_audio/send_file) over OBS. - E2EE Letter Sealing for 1:1 and groups — encrypt and decrypt (V1 + V2 wire formats), with keys that persist across sessions so you never re-scan a QR.
- Bot framework —
@bot.on_message,@bot.command,@bot.on(OpType); messages are auto-decrypted for you. - Full recording —
api.last,api.history,api.dump(), and export to text / JSON / HAR (secrets redacted by default). - Interactive menu (just run
okline) plus a complete CLI of ~30 commands. - 22 runnable examples in the cookbook to copy-paste from.
Start here¶
Install (needs Python 3.9+ and Node.js 18+ on your PATH):
Log in once — scan the QR with the LINE app and confirm the PIN. This saves a
session (including your E2EE keychain) to ./tokens.json, which every other
command reuses automatically:
Now use it from Python:
from okline import OkLine
api = OkLine.from_tokens_file("tokens.json") # restores tokens + E2EE keys
print(api.get_profile()["displayName"])
api.send_text("u0123456789abcdef0123456789abcdef", "hello from python")
New to OkLine? Start with Getting started.
Table of contents¶
| Page | What's inside |
|---|---|
| Getting started | Install, okline login, the interactive menu, your first Python call |
| Authentication | QR login, e-mail (RSA) login, token reuse & refresh, logout |
| Sending messages | Text, replies, stickers, location, contacts, flex, reactions |
| Media | Send images, video, audio and files via OBS |
| E2EE / Letter Sealing | Encrypt & decrypt 1:1 and group messages, cross-session keys |
| Receiving events | The SSE stream, operations, a simple echo bot |
| Building bots & helpers | Bot framework, typed models, session, rate limiting |
| Recording | Capture, paste, redact and export every request/response |
| CLI | The okline interactive menu and ~30 subcommands |
| Cookbook | 22 ready-to-run examples |
| Architecture | The protocol, X-Hmac, the module map |
| Troubleshooting | Common errors and fixes (FAQ) |
| Contributing | Dev setup, tests, adding endpoints |
| Endpoint reference | Every endpoint with its argument fields |