Send SMS
Sends an SMS message to one or more SIMs.
Auth Scope
urn:grt:gemmContent-Type
application/jsonBase URL
https://gemmapi2.granitenet.com/v2/api/gemm/v1Uses and Requirements
Response Behavior
The Send SMS API responds either synchronously or asynchronously, depending on the number of SIMs and the SIM’s carrier:
| Request | Response |
|---|---|
1 SIM on carrier WEBNG, POD19IOT, POD19ABIR, TMO or TMOCC | Synchronous. The SMS is sent immediately and the response contains the result. |
1 SIM on carrier VZW (Verizon) | Asynchronous. The response contains only a transactionID. The result is sent later in a callback. |
| 2 to 1,000 SIMs (any supported carrier) | Asynchronous. The response contains only a transactionID. One callback is sent for each SIM, all with the same transactionID. |
Validation
- All requests: each ICCID must be 19 or 20 characters (numeric, with
Fallowed as the 20th character), ICCIDs must be unique, and the message must be 1 to 140 characters. If any check fails, Mobility rejects the whole request with HTTP400. - Single SIM: the SIM must also belong to your account, be in
Activatedstatus, be on a supported carrier, and have no other request in progress. Mobility checks these before it sends the SMS. - Bulk SIMs: Mobility checks the status and carrier of each SIM during processing. A SIM that fails these checks is reported as a failure in its callback. The other SIMs are still processed.
HTTP Status Codes
| Status | When |
|---|---|
200 | Single SIM on WEBNG, POD19IOT, POD19ABIR, TMO or TMOCC: the SMS was sent and the response contains a transactionID and result.status success. Single SIM on VZW, or 2 to 1,000 SIMs: the request was accepted and only a transactionID was returned. The result for each SIM is sent later in a callback. A synchronous single-SIM request also returns 200 with the carrier gateway's own response (result.status failure) when the gateway call itself returned an error status, so check result.status. |
400 | Validation failed (an ICCID that is not 19-20 characters, duplicate ICCIDs, more than 1,000 SIMs, or a message that is missing or longer than 140 characters). For a single SIM, also when the SIM was not found, is not Activated, is on an unsupported carrier or already has a request in progress, or when a synchronous carrier rejected the SMS (the body is then the carrier gateway's response, not the standard error format). |
401 | The bearer token is missing, invalid or expired, or you do not have access to the account in the macnum header. |
403 | Send SMS is not enabled for your account, or your token's role does not allow this action. For a single SIM, also when the SIM belongs to an account you do not have access to or that is not under the account in the macnum header. |
429 | Too many requests were sent in a short period. Wait briefly and retry. |
500 | An unexpected server error occurred. |
503 | The system is under scheduled maintenance. Retry after the maintenance window. |
504 | A dependent service did not respond in time. Retry the request. |
Headers
| Header | Value |
|---|---|
Authorization | Bearer access-token |
Content-Type | application/json |
macnum | Macnum of the top level account for your organization. |
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sims | array of simInfo objects | Yes | Up to 1,000 SIMs to send the message to, specified by simInfo objects. |
simInfo | object | Yes | SIM information. |
iccid | string | Yes | 19-20 digits. An F is allowed as the 20th character. |
message | string | Yes | The message that you want to send, 1 to 140 characters. |
Request Examples
Responses
Synchronous Success Response (200 OK)
Response Fields
| Parameter | Type | Description |
|---|---|---|
transactionID | string | A unique string that identifies the request. |
result | object | An object containing the result status. |
status | string | Result status: success or failure. |
message | string | Result message. |
Asynchronous Immediate Success Response (200 OK)
Response Fields
| Parameter | Type | Description |
|---|---|---|
transactionID | string | A unique string that associates the request with the results sent in callbacks. Mobility sends a separate callback for each SIM that matched the request, showing whether the operation succeeded for that SIM and containing any requested information. All callbacks for the request have the same transactionID. |
Callback Success Response
Callback Response Fields
| Parameter | Type | Description |
|---|---|---|
requestType | string | Name of the requested action. For Send SMS, the value is SendSms. |
transactionID | string | A unique string that associates the request with the results sent in callbacks. Mobility sends a separate callback for each SIM that matched the request, showing whether the operation succeeded for that SIM and containing any requested information. All callbacks for the request have the same transactionID. |
simInfo | object | SIM information. |
iccid | string | 19-20 digits. |
msisdn | string | 10 digits. |
result | object | An object containing the result status. |
status | string | Result status: success or failure. |
message | string | Result message. |
errors | object | A list of error objects, if any. |
errorCode | string | Error code. |
errorMessage | string | Error message. |
callbackCount | integer | The number of times this callback message has been sent. |
maxCallbackThreshold | integer | The maximum number of times this callback message will be sent if it is not correctly acknowledged. |
Failure Responses
Immediate Error Message
Error Response Fields
| Parameter | Type | Description |
|---|---|---|
result | object | An object containing the result status. |
status | string | Result status: success or failure. |
errors | object | A list of error objects, if any. |
errorCode | string | Error code. |
errorMessage | string | Error message. |
Single SIM, Carrier Error
For a single SIM on a synchronous carrier (WEBNG, POD19IOT, POD19ABIR, TMO or TMOCC), a carrier-side rejection returns the carrier gateway’s own response instead of the format above. Check result.status rather than relying on the HTTP status alone — the response is HTTP 200 when the gateway call itself returned an error status, and HTTP 400 when the gateway responded successfully but with result.status failure.
Error Response Fields
| Parameter | Type | Description |
|---|---|---|
carrierKey | string | The unique identifier of the SIM's carrier. |
requestType | string | Name of the requested action. For Send SMS, the value is SendSms. |
transactionDateTime | string | The timestamp when the transaction was initiated. |
transactionKey | string | A unique identifier for tracking the request and response. |
result | object | An object containing the result status. |
status | string | Result status: success or failure. |
messages | array of objects | Additional information about the result. |
code | string | Success or Failure. |
gatewayMessage | string | The gateway message that shows whether the request completed or failed. |
carrierMessage | string | The message returned by the carrier, when one is available. |
Example Failure Callback: Verizon or Bulk SIMs
Error Response Fields
| Parameter | Type | Description |
|---|---|---|
requestType | string | Name of the requested action. For Send SMS, the value is SendSms. |
transactionID | string | The transactionID returned in the immediate response. All callbacks for a request have the same transactionID. |
simInfo | object | SIM information. |
iccid | string | 19-20 digits. |
msisdn | string | 10 digits. |
result | object | An object containing the result status. |
status | string | Result status: failure. |
errors | array of objects | A list of error objects. |
errorCode | string | Error code. |
errorMessage | string | Error message. |
callbackCount | integer | The number of times this callback message has been sent. |
maxCallbackThreshold | integer | The maximum number of times this callback message will be sent if it is not correctly acknowledged. |
Code Examples
Related Links
Last updated on