Skip to main content
This guide walks you through adding the required dependencies, computing the request signature, logging in to obtain a session token, and making authenticated API calls — all in Java.

Dependencies

Add the following dependencies to your pom.xml:
pom.xml
  • Apache Commons Codec provides the DigestUtils.md5() and Hex.encodeHexString() utilities used to compute the signature.
  • Jodd HTTP is a lightweight HTTP client used to send form-encoded POST requests.

Computing the signature

Every request to the MIOeSIM API requires a sign parameter. Compute it with the createSign method below.
Sign.java
The method:
  1. Removes sign from the parameter map so it is never included in the input string.
  2. Formats each remaining parameter as key=value and sorts them alphabetically.
  3. Concatenates the sorted strings, appends your secret key, and returns the lowercase MD5 hex digest.
Never include your secret key in client-side code, public repositories, or logs. Treat it like a password.

Logging in

Call POST /api_order/login to exchange your phone number and password for a session token. The login request itself must include a valid sign.
Login.java
A successful response returns a token in the data field:
Pass the returned token to every subsequent API call.

Making authenticated API calls

After login, include both token and sign on every request. The example below calls GET /api_esim/getSkus to retrieve available eSIM packages.
GetSkus.java
Build the parameter map with token first, compute sign from that map, then add sign to the map before sending the request.
Tokens are valid for 2 hours. Store the token and its issue time, then re-authenticate before the token expires rather than calling login on every request. A refresh interval of 90 minutes works well in practice.
Replace "YOUR_PHONE_NUMBER" and "YOUR_PASSWORD" with your actual MIOeSIM account credentials before running the code.