The Flexi API accepts a range of inputs and dynamically determines how to process your SMS message.
It is designed to be an ultra simple API integration specifically for SMS so that you can seamlessly redirect your existing endpoints into the TNZ network by simply changing the URL and Authorization header.
The Flexi API has been tested with Twilio, eTXT, mTXT, GroupText, MessageMedia, 3CX and a range of other tools.
This endpoint is simplified and supports sending SMS only.
For access to our fully featured tool-kit, please refer to our REST API.
If you don't have an account, head to https://www.tnz.co.nz/Customer/SignUp/ and register.
To use the API, an Auth Token is required in the Authorization HTTP header.
To export your Auth Token:
At any time, you can refresh your Auth Token by clicking the button and exporting your new Auth Token. This action will invalidate any apps using your old Auth Token.
Auth Tokens can be used for multiple use-cases, with SubAccount and Department values helping in tracking reporting and billing.
API v2.04 utilizes JWT token Authentication. For OAuth2 authentication options, contact your TNZ representative.
This flexible API allows you to send multiple message types. For a brief overview of the API, see the TNZ API Structure guide.
https://flexiapi.tnz.co.nz/api/v2.04/flexi/sms
[Version]
is the API Version ('v2.04')[MessageType]
is the type of message (currently only 'sms' is supported)The HTTP Headers define the API call's formatting -
Content-Type="application/json; encoding='utf-8'"
Accept="application/json; encoding='utf-8'"
Authorization="Basic [Auth Token]"
** The 'Accept' header is optional but encouraged
You can find your Auth Token in the TNZ Dashboard.
The Body contains your message details.
The Flexi API is designed to be flexible! Input any parameters and the API will do its best to match and send your SMS.
{
"to": "+6421000001",
"from": "5555",
"body": "Hello, this is a test."
}
API URL: https://flexiapi.tnz.co.nz/api/v2.04/flexi/sms
HTTP Method: POST
HTTP Headers: Content-Type="application/json; encoding='utf-8'"
Accept="application/json; encoding='utf-8'"
Authorization="Basic [Your Auth Token]"
{
"to": "+6421000001",
"from": "5555",
"body": "Hello, this is a test."
}
200 OK
- Message Accepted400 BAD REQUEST
- Invalid Variables401 Unauthorized
- Invalid Auth Token500 Internal Server Error
- API Server FaultNote:
A "Success" response indicates that the API has accepted your parameters, not that the message has been delivered. Refer to the API - Status Reporting section for delivery results.
For a list of error messages, see TNZ API Errors.
Any of the examples listed below will be ingested by the API.
If variable names are mixed-and-matched, the API will attempt to identify possible variable names merge them into a known schema.
If you require different parameter names, Contact Us and we can review your requirements.
{
"to": "+6421000001",
"from": "5555",
"body": "Hello, this is a test."
}
{
"to_number": "+6421000001",
"from_number": "5555",
"message": "Hello, this is a test."
}
{
"mobile": "+6421000001",
"message": "Hello, this is a test."
}
{
"destination": "+6421000001",
"message": "Hello, this is a test."
}
{
"messages": [
{
"destination_number": "+6421000001"
"content": "Hello, this is a test.",
}
]
}
{
"destination_number": "+6421000001",
"format": "SMS",
"content": "Hello, this is a test.",
"message_id": "877c19ef-fa2e-4cec-827a-e1df9b5509f7",
"callback_url": "https://www.example.com/webhook",
}
to | tonumber |
to_number | tosms |
to_sms | tomobile |
to_mobile | mobile |
mobilenumber | mobile_number |
handset | number |
destination | destinationnumber |
destination_number | destinationmobile |
recipient | msisdn |
target |
from | fromnumber |
from_number | fromsms |
from_sms | frommobile |
from_mobile | source |
sourcenumber | source_number |
sourcemobile |
message | message_text |
messagetext | text |
body | sms |
content |