Required parameters
Parameter | Description | Possible values |
---|---|---|
action |
Please enter the desired action here | read – read subaccountscreate – create subaccountdelete – delete subaccountupdate – Set automatic transfer of creditstransfer_credits – Transfer credits from main account to subaccount |
Read subaccounts
Example
curl -X POST https://gateway.sms77.io/api/subaccounts?action=read \ -H "X-Api-key: YOUR_API_KEY"
You will get a JSON array like this:
[ { "id": "1234567891", "username": null, "company": "Company1", "balance": "36.8100", "total_usage": "0.3000", "auto_topup": { "threshold": "1", "amount": "5" }, "contact": { "name": "John Doe", "email": "sms@acme-company1.com" } }, { "id": "1234567892", "username": "push2app", "company": "Another Company", "balance": "120.4000", "total_usage": "0.0000", "auto_topup": { "threshold": null, "amount": null }, "contact": { "name": "Donald Dummy", "email": "contact@another-acme-company.com" } } ]
Create subaccount
Parameter | Description | Example |
---|---|---|
name |
Name of the contact of the subaccount | John Doe |
email |
Email address of the contact of the subaccount | john.doe@acme-inc.com |
Example
curl -X POST https://gateway.sms77.io/api/subaccounts?action=create \ -H "X-Api-key: YOUR_API_KEY" \ -d "{ \"name\": \"John Doe\", \"email\": \"john.doe@acme-inc.com\" }"
You will get back JSON data with the subaccount object if successful:
{ "success": true, "error": null, "subaccount": { "id": "123456789", "username": null, "company": null, "balance": 0, "total_usage": 0, "auto_topup": { "threshold": 0, "amount": 0 }, "contact": { "name": "John Doe", "email": "john.doe@acme-inc.com" } } }
Delete subaccount
To delete a subaccount, please specify the ID as a parameter:
Parameter | Description | Example |
---|---|---|
id |
ID of the subaccount | 123456789 |
Example
curl -X POST https://gateway.sms77.io/api/subaccounts?action=delete \ -H "X-Api-key: YOUR_API_KEY" \ -d "{ \"id\": \"123456789\" }"
In case of error you will get the error message, otherwise data as follows:
{ "success": true, "error": null }
Transfer credit
Parameter | Description | Example |
---|---|---|
id |
ID of the subaccount | 123456789 |
amount |
Credit to be transferred | 12.00 |
Example
curl -X POST https://gateway.sms77.io/api/subaccounts?action=transfer_credits \ -H "X-Api-key: YOUR_API_KEY" \ -d "{ \"id\": \"123456789\", \"amount\": 12.00 }"
In case of error you will get the error message, otherwise data as follows:
{ "success": true, "error": null }
Update automatic charging of the subaccount
Parameter | Description | Example |
---|---|---|
id |
ID of the subaccount | 123456789 |
threshold |
Credit threshold below which credit should be transferred | 20.00 |
amount |
Credit to be transferred | 50.00 |
Example
curl -X POST https://gateway.sms77.io/api/subaccounts?action=update \ -H "X-Api-key: YOUR_API_KEY" \ -d "{ \"id\": \"123456789\", \"threshold\": 20.00, \"amount\": 50.00 }"
In case of error you will get the error message, otherwise data as follows:
{ "success": true, "error": null }