Query Contract
Purpose
Returns information relating to any contractual term applied to the SIM specified in the <iccid> element.
This allows you to determine:
- Whether a contract is active
- The type of contract applied
- How many calendar months remain
If no contract is associated with the SIM, both response elements will be returned empty.
Endpoint
POST https://api.m2miportal.com
Content-Type: application/xml
Accept: application/xml
Request (XML)
<query-contract version="1" api-id="123456">
<authentication>
<username>username</username>
<password>password</password>
</authentication>
<iccid>1234567890123456789</iccid>
</query-contract>Response (Success)
<query-contract-response api-id="123456">
<api-outcome>Success</api-outcome>
<contract-type>1</contract-type>
<months-remaining>5</months-remaining>
</query-contract-response>
Response Elements
Element | Description |
|---|---|
<contract-type> | Single digit integer: 1 or 2. |
<months-remaining> | Integer representing the number of calendar months remaining on the contract. If 0, the contract term has expired. |
If the SIM has no contract associated with it, both elements will be returned empty.
Contract Types
Contract Type 1 — Minimum Term
- SIMs cannot be moved to another group or closed until the contract period has expired.
- Many groups operate with a minimum term of one month, meaning the SIM must remain in the group until the calendar month has completed.
Contract Type 2 — Fixed Term
- Typically includes an initial fee.
- Runs for a fixed period.
- Group moves are not permitted during the contract period.
- At the end of the period, the SIM is automatically deactivated.
Behaviour Notes
- Contracts are evaluated against calendar months.
- <months-remaining> is decremented at midnight UTC at the start of each new calendar month.
- A value of 0 indicates that the contract term has expired.
Response (Failure)
If a request cannot be processed, the response will include:
- api-outcome indicating failure
- An error description explaining the reason
Failure responses may occur due to:
- Invalid authentication credentials
- Invalid or unknown identifiers (for example ICCID or MSISDN)
- Invalid or missing parameters
- Values not permitted for the specified SIM type or account configuration
- Insufficient permissions
Integrating systems should validate input data before submission and implement appropriate error handling and logging.