Endpoint – Multiple, the base url is https://portal.2sms.us/ and the uri are per method in keeping with RESTful design
API Docs – https://portal.2sms.us/help
Authentication using OAuth 2.0
2sms uses OAuth2.0 for authorization for the application API.
To create a new ClientID and Secret on your account:
1. Login to your account
2. Click on “Settings” on the left
3. Click on “API Clients”
4. Click on “Add”
5. Enter a display name in the client name field and a secret
6. Click on “Save”
7. A confirmation screen displaying the Client ID and Client Secret is displayed, make note of these
8. Click on “Finish”
To generate an access token from the client ID and client secret, create an HTTP POST request to the following URL: https://portal.2sms.us/Token
With the following information in the body:
grant_type=client_credentials&client_id={theclientidthatwasgeneratedforyou}&client_secret= {thesecretyoudefined}
Replace with the client ID provided and with the client secret created.
In the response to this request you will find the access token which expires after 8 hours. You can either use the refresh token or regenerate using the above request again.
When posting requests to the API use the following headers:
• Accept: application/json
• Content-Type: application/json
• Authorisation: Bearer {accesstoken}
Sending a Single Message
Method: POST
URL: https://portal.2sms.us/api/v2/sms/messages
Body:
{
"Contacts": {
"QuickRecipients": {
"+12345678901": 2
}
},
"Content": "Standard Send Test",
"Options": {},
"Type": 1
}
Other methods can be found here: https://portal.2sms.us/help