Sub-Accounts

Manage your Sub-Accounts.

Retrieve Sub-Accounts

Retrieve the Sub-Accounts attached to your account.

Request

GET /subaccounts

There are no required properties for this API, only optional

Optional Properties

Attribute Type Description Default
status string The status of the sub-account.
Available options:
Active, Locked, Closed
skip int Where to start the returned results 0
limit int Where to end the returned results.
Limit: 1000
25
Code Example

cURL

curl https://api.voodoosms.com/subaccounts \
  -H "Authorization: Bearer {key}"

PHP

<?php

$api_key = 'API KEY';

$ch = curl_init('https://api.voodoosms.com/subaccounts');

curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: ' . $api_key
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

curl_close($ch);
Response
{
  "count": 1,
  "subaccounts": {
    {
      "account": [
        "id": 90546,
        "username": "my_sub_account",
        "email": "jon.snow@acme.com",
        "name": "Jon Snow",
        "company": "Acme Ltd",
        "balance": 2001,
        "status": "Active",
        "children": [
          {
            "id": 929767,
            "username": "my_sub-sub_account",
            "email": "jamie.lannister@acme.com",
            "name": "Jamie Lannister",
            "company": "Some Company Ltd",
            "balance": 1324,
            "status": "Active",
            "children": [],
            "created_at": 1548113852
          }
        ],
        "created_at": 1548115200
      ]
    }
  }
}
Error Response
{
  "error": {
    "code": 67,
    "msg": "Invalid status"
  }
}

Errors

Code Message Meaning
10 Limit is greater than 1000 The limit property cannot be greater than 1000
59 Cannot find any sub-accounts There are no sub-accounts attached to your account
60 Invalid status The status you have added is not valid.
Available options:
Active, Locked, Closed

Create Sub-Account

Create a new Sub-Account

Request

POST /subaccounts
Important Information You can only create Sub-Accounts if you have a Reseller account.

There are both required and optional properties for this API

PROPERTIES

Attribute Type Description
username string The username of the account
firstname string The users First Name
surname string The users Surname
number int A valid mobile number
email string A valid email address
company string The company of the sub-account
give_credits int The amount of credits to give from your credit pool

Optional Properties

Attribute Type Description
reference string A reference related to the user you’re creating
Code Example

cURL

curl -X POST https://api.voodoosms.com/subaccounts \
  -H "Authorization: Bearer {key}" \
  -d '{
    "username": "MySubAccount",
    "firstname": "Jon",
    "surname": "Snow",
    "number": "447890000000",
    "email": "jon.snow@gameofthrones.net",
    "company": "Acme Ltd",
    "give_credits": 255,
    "reference": "GOT Fan Club Member"
  }'

PHP

<?php

$api_key = 'API KEY';

$msg = json_encode(
  [
     "username" => "MySubAccount",
     "firstname" => "Jon",
     "surname" => "Snow",
     "number" => "447890000000",
     "email" => "jon.snow@gameofthrones.net",
     "company" => "Acme Ltd",
     "give_credits" => 255,
     "reference" => "GOT Fan Club Member",
  ]
);

$ch = curl_init('https://api.voodoosms.com/subaccounts');

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: ' . $api_key
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

curl_close($ch);
Response
{
  "id": 59444,
  "status": "SUCCESS",
  "data": {
    "username": "MySubAccount",
    "firstname": "Jon",
    "surname": "Snow",
    "number", "447890000000",
    "email": "jon.snow@gameofthrones.net",
    "give_credits": 255,
    "reference": "GOT Fan Club Member"
  },
  "created_at": 1547683200
}

Errors

Code Message Meaning
33 Invalid number The given mobile number is not valid
69 Invalid email The given email address is invalid
70 Username in use The chosen username is already taken
71 Not enough credits You do not have enough credits to allocate the amount specified
72 You must have Reseller permissions to use this method You must have Reseller permissions. Contact your account manager
Error Response
{
  "error": {
    "code": 70,
    "msg": "Username in use"
  }
}

Delete Sub-Account

Delete a Sub-Account

Request

DELETE /subaccounts/:id
Code Example

cURL

curl -X DELETE https://api.voodoosms.com/subaccounts/90546 \
  -H "Authorization: Beader {key}"

PHP

<?php

$api_key = 'API KEY';

$ch = curl_init('https://api.voodoosms.com/subaccounts/90546');

curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: ' . $api_key
]);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

curl_close($ch);
Error Response
{
  "error": {
    "code": 23,
    "msg": "Invalid ID"
  }
}

Errors

Code Message Meaning
23 Invalid ID The ID does not match to any of your Sub-Accounts
42 Sub-Account is already deleted Sub-Account does not exist
Response
{
  "status": "SUCCESS",
  "message": "Sub-Account has been deleted"
}

Manage

Manage your sub-accounts.

Suspend Sub-Account

Suspend a Sub-Account, preventing the user from accessing the account.

Request

DELETE /subaccounts/suspend/:id
Code Example

cURL

curl -X DELETE https://api.voodoosms.com/subaccounts/suspend/90546 \
  -H "Authorization: Beader {key}"

PHP

<?php

$api_key = 'API KEY';

$ch = curl_init('https://api.voodoosms.com/subaccounts/suspend/90546');

curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: ' . $api_key
]);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

curl_close($ch);
Response
{
  "status": "SUCCESS",
  "message": "Sub-Account has been suspended"
}

Errors

Code Message Meaning
73 Sub-Account is already suspended The Sub-Account is already suspended and cannot be re-suspended
Error Response
{
  "error": {
    "code": 73,
    "msg": "Sub-Account is already suspended"
  }
}

Unsuspend Sub-Account

Unsuspend a Sub-Account, allowing a user back into the account.

Request

DELETE /subaccounts/unsuspend/:id
Code Example

cURL

curl -X DELETE https://api.voodoosms.com/subaccounts/unsuspend/90546 \
  -H "Authorization: Beader {key}"

PHP

<?php

$api_key = 'API KEY';

$ch = curl_init('https://api.voodoosms.com/subaccounts/unsuspend/90546');

curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: ' . $api_key
]);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

curl_close($ch);
Response
{
  "status": "SUCCESS",
  "message": "Sub-Account has been unsuspended"
}

Errors

Code Message Meaning
46 Sub-Account is not suspended The Sub-Account not suspended so cannot be un-suspended
Error Response
{
  "error": {
    "code": 46,
    "msg": "Sub-Account is not suspended"
  }
}