Credits

Get Credits

Retrieve the amount of credits you have on your account.

Request

GET /credits
Example Code

cURL

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

PHP

<?php

$api_key = 'API KEY';

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

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

$response = curl_exec($ch);

curl_close($ch);
Response
{
  "amount": 256
}
Error Response
{
  "error": {
    "code": 21,
    "msg": "You have no credits"
  }
}

Transfer

Transfer credits from your account to one of your sub-accounts. Documentation on creating Sub-Accounts is available in Sub-Accounts documentation.

Request

POST /credits

Properties

Attribute Type Description
to int The ID of the sub-account. Sub-account must be owned by parent ID.
amount int The amount of credits you want to give to the sub-account.
Example Code

cURL

curl -X POST https://api.voodoosms.com/credits \
  -H "Authorization: Bearer {key}" \
  -d '{
    "to": 59000,
    "amount": 55
  }'

PHP

<?php

$api_key = 'API KEY';

$msg = json_encode(
    [
        'to' => 59000,
        'amount' => 55
    ]
);

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

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
{
  "to": 59000,
  "amount": 55,
  "status": "SUCCESS"
}

Errors

Code Message Meaning
38 The ID you gave does not belong to your account The ID provided is not listed under your parent account.
39 Cannot transfer due to insufficient credit You don’t have enough credits in your account to transfer to the sub-account.
40 You must provide an amount > 0 You can only transfer an amount of credit that is greater than zero.
Error Response
{
  "error": {
    "code": 38,
    "msg": "The ID you gave does not belong to your account"
  }
}