Get SMS Credit endpoint

Updated on Apr 28, 2024

Introduction

By visiting this endpoint, users can retrieve information about the remaining SMS credit balance. This endpoint can be used to monitor usage and ensure that there’s enough credit to send SMS to the subscribers. It can be accessed by the website administrator or anyone who has permission to see the credit information on the account.

GET /wp-json/wpsms/v1/credit

Request

<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://site.com/wp-json/wpsms/v1/credit',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic ***',
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Response:

{
    "credit": "10.00 USD"
}