API documentation explains the set of data you can programmatically access, insert, add and update with the use of the API service. JSON is used to seamlessly communicate between your application and SMTP PLANS API, and to perform actions like adding lists, adding subscribers to a list, updating lists or subscribers, and retrieving data like lists and records. The following document provides the information of the actions you can perform using the API service with sample requests.
API Configuration/ Generating API Token
Before you submit a post/get requests to obtain particular kinds of JSON-based responses, you need to generate the API token using your account with SMTP PLANS. Reach “API Configuration” under “Integration” in the left side navigational menu of the SMTP PLANS, to generate the API token.
API token request needs to be sent to the API Endpoint which you can find in the API configuration section under the SMTP PLANS user profile page. Following are the three fields that you will find on the API configuration page, API token field remains empty until you submit the request to generate the API token.
API Endpoint will be https://portal.smtp-plans.com/API/
API login is the login email of your user in SMTP PLANS
API Token will be generated, once you submit the request by clicking “Generate API Token”.
The API Token will look like c5a5e7bbf399665b62a9410645494f29. You don’t need to generate a new token each time for sending a request to the API, until you generate a new token the currently available will work fine. Upon generating a new token, the previous one will expire and you would be required to use a fresh API token for sending a successful request. A sample request to get all subscribers will be as following
$curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://portal.smtp-plans.com/API/getSubscribers", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_POSTFIELDS => " ", CURLOPT_COOKIE => "PHPSESSID=t23id0faeieee6e6qcjlb461n1", CURLOPT_HTTPHEADER => [ "APIToken: 512ab1f324d6fcfd4f1fcace75f45705", "Content-Type: application/json", "Login: [email protected]" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }