API Token
An API Token is the credential for ExpTech APIs that require authentication. It starts with et_. You create a token on the dashboard. It does not expire until you revoke it. Most of the public HTTP data APIs do not need a token. The Authentication section on each endpoint’s page says whether that endpoint needs one.
Create a token
Section titled “Create a token”- Sign in at https://manager.exptech.com.tw/login (enter your email, then open the sign-in link in the message).
- Open the API Tokens page on the dashboard.
- Choose the permissions this token needs. You can add a note (15 characters at most).
- After you create it, the page shows the full token. The token is shown only once. Save it somewhere safe immediately. Later, the list shows the note and the permissions, not the token itself.
Token format and lifetime
Section titled “Token format and lifetime”- Format:
et_followed by 43 base64url characters (A–Z,a–z,0–9,-,_). Example:et_3q2-7wAAexampleexampleexampleexampleexample. - Lifetime: no expiry, and no refresh token. It stays valid until it is revoked.
- The server stores only a hash of the token. A lost token cannot be recovered. Create a new one.
How to send the token
Section titled “How to send the token”Each transport reads the token from a different place. A token in the wrong place is treated as missing.
| Use | Where to send it | Notes |
|---|---|---|
| HTTP API (endpoints marked as requiring a token) | header X-Api-Token: <token> |
This header is the only place that is read. A token in the query string or in Authorization gets a 401 |
| SSE real-time stream | header Authorization: Bearer <token>, or query token=<token> |
When both are present, the header wins. Bearer is case-sensitive, and one space follows it |
| OAuth2 user info | header Authorization: Bearer <token> |
GET /api/... HTTP/1.1X-Api-Token: et_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxSSE streams
Section titled “SSE streams”Clients that can set headers (a server, an app, or curl) should use the header:
curl -N -H "Authorization: Bearer et_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ "https://api.lb.exptech.dev/api/v1/trem/sse/report"The browser EventSource cannot set headers, so the token has to go in the query string:
const token = "et_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";const es = new EventSource( `https://api.lb.exptech.dev/api/v1/trem/sse/report?token=${encodeURIComponent(token)}`,);Some stream topics are public. You can connect without a token. If you do send a token, usage is counted on that account. An invalid or revoked token rejects the whole connection (HTTP 401, body invalid token), including public topics. A topic that requires a permission needs a token with that permission, and the account must already be subscribed to that resource. See real-time streams for each topic’s rules.
Revoke a token
Section titled “Revoke a token”Delete it on the API Tokens page of the dashboard. There is no API that revokes a token by presenting the token itself.
- HTTP: the token is fully invalid within about 1 minute.
- SSE: about 5 seconds after revocation, every stream connection authenticated with a token on that account receives
event: closeanddata: token revoked, then closes. This includes connections that used a different token. Reconnect with another token that is still valid.
Security recommendations
Section titled “Security recommendations”- Do not put a token in frontend code, an app package, or a public Git repository.
- Use one token per purpose, and write the note so it says where that token is used. If it leaks, revoke that one token.
- Grant only the permissions you need.
*(all permissions) is convenient for testing, and a leak of that token has the widest impact.
