Nextpod SMS API - Made for developers who wish to integrate sms into their existing or new applications
The Nextpod SMS API provides access to send and recieve SMS for use in applications. All communications requires HTTPS encryption (Port 443). Our servers use the following IP addresses which will require access to send delivery reports and incoming SMS: 91.189.121.81 - 91.189.121.89
The API supports both JSON and HTTP FORM POST requests. All responses are returned as JSON by default
All API methods require an API key. You can create API keys by logging in.
We support the use of HTTP Basic authentication or form-data parameter using your account id and api key.
HTTP POST parameter authentication
All requests are sent with HTTP POST. Authroize by using parameter account_id
and api_key
.
POST https://api.nextpod.io/v3/sms HTTP/1.1
https://api.nextpod.io/v2/sms?account_id=xxx&api_key=xxx
HTTP Basic authentication
All requests are sent with an Authorization header
that contains the word "Basic" followed by a space and the API key as an
base64-encoded string. Example: Authorization: 'Basic '+ Base64Encode(":"+ api_key)
.
POST https://api.nextpod.io/v3/sms HTTP/1.1
Authorization: Basic OjZjZmJmOS05M2MwYWM2MGFjNmM1ZmMzOTAwZTU2ZDk2NmRjZDhkMmIx
All mobile numbers must be formatted as MSISDN including the country calling code and subscriber number without plus or leading zero. An example is our
switchboard number +47 9172 6200 which is formatted as 4791726200
. You can read more about the MSISDN format at Wikipedia
Parameter | Type | Description |
---|---|---|
from | string | Represents the sender ID and it can be alphanumeric or numeric. Alphanumeric sender ID length should be between 3 and 11 characters (example: Mycompany). Numeric sender ID length should be between 3 and 14 characters. Please note that some sender values are blocked and need special authroization to be used. |
to | string | The recipients mobile number including the country calling code. Example: 4799xxxxxx or 447xxxxxxx. Multiple recipients can be added by separating each mobile number with a comma. Example: 4799xxxxxxx, 447xxxxxxxx, 467xxxxxxx. Limited to max 1000 recipients in each batch. |
msg | string | Text of the message that will be sent. Maximum 1500 characters. UTF-8 encoded. |
send_time | datetime | The scheduled date and time of the message. The date value must be in ISO8601 (YYYY-MM-DDTHH:MI:SSZ). Example: 2019-09-25T08:58:00Z. If not provideded the message will be delivered immediately |
dlr_url | string | Your URL where the delivery report will be returned to. |
reference | string | Your own ID reference. This will be returned with the delivery report. Max 100 chars. |
account_id | integer | Not in use if you use HTTP Basic authentication. You can find the account ID by logging in and open "My account". |
api_key | string | Not in use if you use HTTP Basic authentication. You can find your API keys by logging in and go to "My account -> Api keys". |
gateway | integer | Force the use of a preferred gateway. This will override your default account settings. Contact customer service for more information. |
Here is two examples. The first shows you how to send SMS using JSON as body with Basic authentication. The second example shows how to send SMS using form-data and using your account_id and api_key as authentication.
Example using Body JSON
POST https://api.nextpod.io/v2/sms HTTP/1.1 Authorization: Basic OjZjZmJmOS05M2MwYWM2MGFjNmM1ZmMzOTAwZTU2ZDk2NmRjZDhkMmIx Content-Type: application/json; charset=utf-8
{ "from": "Nextpod", "to": "4791726200,4758484412", "msg": "Hello!" }
Example using form-data
POST https://api.nextpod.io/v2/sms HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=utf-8
?account_id=2532
&api_key=744ebx-btaPfo5dd0c1e15b3ed421f6e8d2c2b7b4
&from=Nextpod
&to=4791726200,4758484412
&msg=Hello!
Example with a successful request with a single recipients
POST https://api.nextpod.io/v2/sms?account_id=xx&api_key=xx&to=4791726200&from=Nextpod&msg=Hello!
{ "id": "B21BE07F-1EA0-40D3-9190-BABEFA2359FE", "from": "Nextpod", "to": "4791726200", "msg_length": "6", "msg_parts": "1", "reference": "" }
Example with a successful request with multiple recipients
POST https://api.nextpod.io/v2/sms?account_id=xx&api_key=xx&to=4791726200,4758484412&from=Nextpod&msg=Hello!
{ "recipients": 2, "sms": [ { "id": "B21BE07F-1EA0-40D3-9190-BABEFA2359FE", "from": "Nextpod", "to": "4791726200", "msg_length": "6", "msg_parts": "1", "reference": "" }, { "id": "36E34627-5A4A-43F5-9483-2FDCA2AFE9CC", "from": "Nextpod", "to": "4758484412" "msg_length": "6", "msg_parts": "1", "reference": "" } ] }
Example with a failed request
Note that if one or more parameters are missing the http status code 400 will be returned. Check the http-status text for more information. You can read more about API response codes here
400 From parameter is missing or has an invalid value
These error codes are returned by the API when posting a request to our servers.
Code | Status | Description |
---|---|---|
200 | OK | Successful transaction |
400 | Bad Request | One or more parameters has an invalid value or missing |
401 | Unauthorized | No access or incorrect API key |
402 | Out of credit | Only for pre-paid accounts. |
403 | Forbidden | No access or restrictions configured for the given key. For example, IP restrictions. |
413 | To many recipients | To many recipients. Max is 1000 unique recipients per request |
429 | To many requests | To many failed requests. The session has been blocked for the next 20 minutes |
500 | Internal server error | Internal error on our side. Transaction failed. Please contact customer service if this happens. |
All incoming SMS (MO) require either your own shortcode where Nextpod is set as your handler for incoming transactions or you have ordered one or more keywords from our shared short codes. By default, all incoming traffic are stored at Nextpod but can be forwarded to a given URL. This must be pre configured by logging in to Nextpod or set as a keyword rule
Parameter | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | string | Unique messageId from Nextpod | ||||||||||||||||
from | integer | The subscribers msisdn in full international format | ||||||||||||||||
to | string | The shortcode or mobile number the message was sent to | ||||||||||||||||
msg | string | Full message content | ||||||||||||||||
keyword | string | If identified, the keyword are given in clear text in uppercase | ||||||||||||||||
sub_keyword | string | If identified, the subkeyword are given in clear text in uppercase | ||||||||||||||||
keyword_rules | bool | True if keyword rules have been processed at Nextpod | ||||||||||||||||
mcc | integer | Mobile country code. See the most common MCC codes here.
See all mobile country codes here.
|
||||||||||||||||
mnc | integer | Mobile network code. See the Norwegian MNC codes here.
See Wikipedia for an updated list of all mobile network codes.
|
||||||||||||||||
received_time | date | When the message was received at Nextpod |
Note that the same parameters can be sent as FORM-data if the keyword or short code are configured to use FORM and not JSON.
{
"id": "1053289234",
"from": "4791726200",
"to": "2345",
"msg": "Hello wonderful world!",
"keyword": "HELLO",
"sub_keyword": "WONDERFUL",
"keyword_rules": "false",
"mcc": "242",
"mnc": "1",
"received_time": "2019-08-28T15:00:00"
}
If the parameter dlr_url
is used while sending an SMS it will trigger
delivery of delivery reports to the given URL. The data can be delivered as JSON or FORM. You can define
the format by using the dlr_method
parameter such as dlr_method = "FORM"
or dlr_method = "JSON"
Parameter | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | string | Unique messageId from Nextpod | ||||||||||||||||||
to | Integer | The subscribers msisdn in full international format | ||||||||||||||||||
sent_time | date | When the SMS was sent. Has the following format: YYYY-MM-DDTHH:MI:SSZ | ||||||||||||||||||
status_code | integer | Status codes are mapped status codes and reflect the mapped status code received from the upstream carrier.
For more information compare with the operator_status_code parameter values in the delivery report.
Note that the error codes are subject to change in the future.
|
||||||||||||||||||
status_text | string | Valid status values in table below
|
||||||||||||||||||
status_updated | date | When the SMS was finished processing by Nextpod (i.e., delivered to the subscriber or delivered to the destination network or gateway). Format: YYYY-MM-DDTHH:MI:SSZ | ||||||||||||||||||
operator_status_code | string | The actual error code received from operator, network or gateway provider. | ||||||||||||||||||
reference | string | Your own ID-reference | ||||||||||||||||||
mcc | integer | Mobile country code. See the most common MCC codes here.
See all mobile country codes here.
|
||||||||||||||||||
mnc | integer | Mobile network code. See the Norwegian MNC codes here.
See Wikipedia for an updated list of all mobile network codes.
|
||||||||||||||||||
msg_parts | Integer | Number of SMS-parts. |
This example shows a delivery report with a successfully delivered SMS. The data is posted to the url specified in the dlr-url
parameter
while sending the sms.
POST https://your.domain.com/delivery_reports_url HTTP/1.1 Content-Type: application/json; charset=utf-8
{ "id": "89ADEE05-5960-43D4-83B7-61EABA45F5F9", "reference": "5adFadX55sQfdsADFFS42", "to": "4791726200", "created_time": "2019-08-28T14:59:58Z", "sent_time": "2019-08-28T15:00:00Z", "status_updated": "2019-08-28T15:00:08Z", "status_code": "200", "status_text": "DELIVERED", "operator_status_code": "1001", "mcc": "242", "mnc": "1", "msg_parts": "1" }
Example with FORM posted data
Data can be returned as FORM-data (application/x-www-form-urlencoded). The parameters has been rearranged to be more readable.
POST https://your.domain.com/delivery_reports_url HTTP/1.1 Content-Type: application/x-www-form-urlencoded; charset=utf-8
https://your.domain.com/delivery_reports_url?id=89ADEE05-5960-43D4-83B7-61EABA45F5F9 &reference=5adFadX55sQfdsADFFS42 &to=4791726200 &created_time=2019-08-28T14:59:58Z &sent_time=2019-08-28T15:00:00Z &status_updated=2019-08-28T15:00:11Z &status_code=200 &status_text=DELIVERED &operator_status_code=1001 &mcc=242 &mnc=1 &msg_parts=1