Obtaining a token
CallPOST /api_order/login to exchange your credentials for a session token. The login request itself also requires a sign — see Computing the signature below for how to generate it.
Request parameters
Your MIOeSIM account phone number. This is your login username.
Your MIOeSIM account password.
HMAC-MD5 signature computed from
phonenumber and password. See Computing the signature.Example request and response
Computing the signature
Every API request — including the login request — requires asign parameter. Compute it using the following algorithm:
- Collect all request parameters except
signitself. - Format each parameter as
key=value. - Sort the resulting strings alphabetically.
- Concatenate all sorted strings with no separator.
- Append your secret key directly to the end of the concatenated string.
- MD5 hash the full string (UTF-8 encoded).
- Use the hex digest as the
signvalue.
phonenumber=13800000000 and password=mypassword:
Code examples
Using the token
After a successful login, include thetoken and sign on every subsequent request. For GET requests, pass them as query parameters. For POST requests, include them in the request body.
GET example:
sign fresh for each request, using all parameters in that specific request (excluding sign itself).
Token expiry
Tokens are valid for 2 hours from the time of issue. After a token expires, all requests return an authentication error. To handle expiry gracefully:- Store the token and its issue timestamp locally.
- Before each request, check whether the token is within 10–15 minutes of its 2-hour expiry.
- If it is, call
POST /api_order/loginto obtain a fresh token before proceeding.
Error codes
The login endpoint returns the following error codes in thecode field of the response:
| Code | Meaning |
|---|---|
1 | Success — token returned in data |
-1 | Wrong username or password |
-2 | Username or password is empty |
-3 | Account does not have call permission |
-30 | Signature (sign) is incorrect |
-30, verify that your signature algorithm sorts parameters alphabetically and that you are using the correct secret key.