SMS by Anchor: API Authentication
SMS by Anchor uses Bearer token authentication. Request a token with your API credentials, then include it in the Authorisation header of every request.
Request a token
POST https://api.anchor-sms.com:8443/auth/getToken
| Parameter | Description | Type |
|---|---|---|
| username | API username provided by the Anchor administrator | Alphanumeric, max 20 |
| password | API password provided by the Anchor administrator | Alphanumeric, max 20 |
{
"username": "YOUR_USERNAME",
"password": "YOUR_PASSWORD"
}
Successful response
{
"accessToken": "eyJhbGciOiJIUzUxMiJ9...",
"refreshToken": "84b9917c-...",
"expiry": 3600000,
"tokenType": "Bearer"
}
Use the token
Authorization: Bearer YOUR_ACCESS_TOKEN
Unauthorised response
{
"timestamp": "2024-04-18T12:55:38.339+00:00",
"status": 401,
"error": "Unauthorized",
"message": "",
"path": "/auth/getToken"
}
Alternative: simple HTTP (no token)
For quick integrations, a GET endpoint accepts credentials as query parameters. Because credentials appear in the URL and may be logged, use it only server-to-server over HTTPS and prefer the token method for production.
curl -G "https://api.anchor-sms.com:8443/mt/sendMtSmsNoToken" \
--data-urlencode "to=60123456789" \
--data-urlencode "user=YOUR_USERNAME" \
--data-urlencode "pass=YOUR_PASSWORD" \
--data-urlencode "text=Message from Anchor SMS"
Optional parameters: from (sender ID) and dataCoding (0 for ASCII, 8 for Unicode).
Next Step: Send an SMS
