### Get Balance Ruby Example Source: https://panel.smspubli.com/api/3.0/docs/account/get-balance Ruby implementation using Net::HTTP. ```ruby require 'uri' require 'net/http' url = URI("https://api.gateway360.com/api/3.0/account/get-balance") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(url) request["content-type"] = 'application/json' request["accept"] = 'application/json' request.body = '{ "api_key":"399d2b438a53ebed3db8a7d52107f846" }' response = http.request(request) puts response.read_body ``` -------------------------------- ### Get Balance Python Example Source: https://panel.smspubli.com/api/3.0/docs/account/get-balance Python implementation using http.client. ```python conn = http.client.HTTPSConnection("api.gateway360.com") payload = '{ "api_key":"399d2b438a53ebed3db8a7d52107f846" }' headers = { 'content-type': "application/json", 'accept': "application/json" } conn.request("POST", "/api/3.0/account/get-balance", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Get Balance VB6 Example Source: https://panel.smspubli.com/api/3.0/docs/account/get-balance VB6 implementation using MSXML2.ServerXMLHTTP. ```vb Private Sub Command1_Click() Dim objHTTP As Object Dim Json As String Dim result As String Json = fJSON Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP") URl = "https://api.gateway360.com/api/3.0/account/get-balance" objHTTP.Open "POST", URl, False objHTTP.setRequestHeader "Content-type", "application/json" objHTTP.send (Json) result = objHTTP.responseText Set objHTTP = Nothing End Sub Private Function fJSON() As String fJSON = "{" fJSON = fJSON & """api_key"":""399d2b438a53ebed3db8a7d52107f846""" fJSON = fJSON & "}" End Function ``` -------------------------------- ### Get Balance Java Example Source: https://panel.smspubli.com/api/3.0/docs/account/get-balance Java implementation using Apache HttpClient. ```java /** Imports */ import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; /** End imports */ HttpClient httpClient = HttpClientBuilder.create().build(); HttpPost request = new HttpPost("https://api.gateway360.com/api/3.0/account/get-balance"); StringEntity params = new StringEntity( "{" + " \"api_key\":\"399d2b438a53ebed3db8a7d52107f846\"" + "}"); request.addHeader("content-type", "application/json"); request.addHeader("Accept","application/json"); request.setEntity(params); HttpResponse response = httpClient.execute(request); ``` -------------------------------- ### Get Balance C# Example Source: https://panel.smspubli.com/api/3.0/docs/account/get-balance C# implementation using RestSharp. ```csharp var client = new RestClient("https://api.gateway360.com/api/3.0/account/get-balance"); var request = new RestRequest(Method.POST); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddParameter("application/json", '{ "api_key":"399d2b438a53ebed3db8a7d52107f846" }', ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Get Balance Javascript Example Source: https://panel.smspubli.com/api/3.0/docs/account/get-balance Javascript implementation using XMLHttpRequest. ```javascript var data = JSON.stringify({ "api_key":"399d2b438a53ebed3db8a7d52107f846" }); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } }); xhr.open("POST", "https://api.gateway360.com/api/3.0/account/get-balance"); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data); ``` -------------------------------- ### Get Balance PHP Example Source: https://panel.smspubli.com/api/3.0/docs/account/get-balance PHP implementation using cURL to fetch the account balance. ```php $request = '{ "api_key":"399d2b438a53ebed3db8a7d52107f846" }'; $headers = array('Content-Type: application/json'); $ch = curl_init('https://api.gateway360.com/api/3.0/account/get-balance'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); $result = curl_exec($ch); if( !curl_errno($ch) ) $result = json_decode($result); else $result = curl_error($ch); print_r($result); ``` -------------------------------- ### Java Implementation Source: https://panel.smspubli.com/api/3.0/docs/account/get-pricing Java example using Apache HttpClient to execute the POST request. ```java /** Imports */ import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; /** End imports */ HttpClient httpClient = HttpClientBuilder.create().build(); HttpPost request = new HttpPost("https://api.gateway360.com/api/3.0/account/get-balance"); StringEntity params = new StringEntity( "{" + " \"api_key\":\"399d2b438a53ebed3db8a7d52107f846\"" + " \"country_code\":\"ES\"" + "}"); request.addHeader("content-type", "application/json"); request.addHeader("Accept","application/json"); request.setEntity(params); HttpResponse response = httpClient.execute(request); ``` -------------------------------- ### Python Request Example Source: https://panel.smspubli.com/api/3.0/docs/account/get-pricing Example of how to perform the request using Python HTTPSConnection. ```python conn = http.client.HTTPSConnection("api.gateway360.com") payload = '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "prefix":"34", }' headers = { 'content-type': "application/json", 'accept': "application/json" } conn.request("POST", "/api/3.0/account/get-balance", payload, headers) res = conn.getresponse() data = res.read() ``` -------------------------------- ### Request PIN Ruby example Source: https://panel.smspubli.com/api/3.0/docs/2factor/request Ruby example using Net::HTTP to send the request. Sets SSL verification to none and prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.gateway360.com/api/2fa/request") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(url) request["content-type"] = 'application/json' request["accept"] = 'application/json' request.body = '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "msisdn":"34666666111", "sender":"GOOD PIZZA", "hlr_lookup":1 }' response = http.request(request) puts response.read_body ``` -------------------------------- ### VB6 Implementation Source: https://panel.smspubli.com/api/3.0/docs/account/get-pricing VB6 example using MSXML2.ServerXMLHTTP to send the request. ```vbnet Private Sub Command1_Click() Dim objHTTP As Object Dim Json As String Dim result As String Json = fJSON Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP") URl = "https://api.gateway360.com/api/3.0/account/pricing/sms/get-country-pricing" objHTTP.Open "POST", URl, False objHTTP.setRequestHeader "Content-type", "application/json" objHTTP.send (Json) result = objHTTP.responseText Set objHTTP = Nothing End Sub Private Function fJSON() As String fJSON = "{" fJSON = fJSON & """api_key"":""399d2b438a53ebed3db8a7d52107f846""" fJSON = fJSON & """country_code"":""ES""" fJSON = fJSON & "}" End Function ``` -------------------------------- ### Request PIN Java example Source: https://panel.smspubli.com/api/3.0/docs/2factor/request Java example using Apache HttpClient to send the request. Builds a JSON string as the entity and sets headers. ```java /** Imports */ import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; /** End imports */ HttpClient httpClient = HttpClientBuilder.create().build(); HttpPost request = new HttpPost("https://api.gateway360.com/api/2fa/request"); StringEntity params = new StringEntity( "{" + " \"api_key\":\"399d2b438a53ebed3db8a7d52107f846\"," + " \"msisdn\":\"34666666111\"," + " \"sender\":\"GOOD PIZZA\"," + " \"hlr_lookup\":1" + "}"); request.addHeader("content-type", "application/json"); request.addHeader("Accept","application/json"); request.setEntity(params); HttpResponse response = httpClient.execute(request); ``` -------------------------------- ### Create Subaccount Python Example Source: https://panel.smspubli.com/api/3.0/docs/subaccount/create Python implementation using http.client to create a subaccount. ```python conn = http.client.HTTPSConnection("api.gateway360.com") payload = '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "user_name":"new_subaccount_user_name", "email":"me@email.com", "name":"John", "surname":"Doe", "password":"new_subaccount_password", "language":"es" }' headers = { 'content-type': "application/json", 'accept': "application/json" } conn.request("POST", "/api/3.0/subaccount/create", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Request PIN PHP example Source: https://panel.smspubli.com/api/3.0/docs/2factor/request PHP example using cURL to send the request. Sets headers and POST fields, then executes the request and handles errors. ```php $request = '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "msisdn":"34666666111", "sender":"GOOD PIZZA", "hlr_lookup":1 }'; $headers = array('Content-Type: application/json'); $ch = curl_init('https://api.gateway360.com/api/2fa/request'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); $result = curl_exec($ch); if (curl_errno($ch) != 0 ){ die("curl error: ".curl_errno($ch)); } ``` -------------------------------- ### 200 OK Response Example Source: https://panel.smspubli.com/api/3.0/docs/account/get-pricing Successful response containing country details, prefixes, and network pricing. ```json { "status":"ok", "result":{ "ES":{ "name":"Spain", "prefix":"34", "networks":{ "0":{ "code":"21401", "network":"MNO - Vodafone Espana", "price":"0.0520" }, "1":{ "code":"21403", "network":"MNO - Orange Espana", "price":"0.0520" }, "2":{ "code":"21407", "network":"MNO - Movistar (Telefonica Moviles Espana)", "price":"0.0520" }, "3":{ "code":"21404", "network":"MNO - Yoigo (Xfera Moviles)", "price":"0.0520" } } } } } ``` -------------------------------- ### Create Subaccount Java Example Source: https://panel.smspubli.com/api/3.0/docs/subaccount/create Java implementation using Apache HttpClient to create a subaccount. ```java /** Imports */ import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; /** End imports */ HttpClient httpClient = HttpClientBuilder.create().build(); HttpPost request = new HttpPost("https://api.gateway360.com/api/3.0/subaccount/create"); StringEntity params = new StringEntity( "{" + " \"api_key\":\"399d2b438a53ebed3db8a7d52107f846\"," + " \"user_name\":\"new_subaccount_user_name\"," + " \"email\":\"me@email.com\"," + " \"name\":\"John\"," + " \"surname\":\"Doe\"," + " \"password\":\"new_subaccount_password\"," + " \"language\":\"es\"" + "}"); request.addHeader("content-type", "application/json"); request.addHeader("Accept","application/json"); request.setEntity(params); HttpResponse response = httpClient.execute(request); ``` -------------------------------- ### Create Subaccount Ruby Example Source: https://panel.smspubli.com/api/3.0/docs/subaccount/create Ruby implementation using Net::HTTP to create a subaccount. ```ruby require 'uri' require 'net/http' url = URI("https://api.gateway360.com/api/3.0/subaccount/create") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(url) request["content-type"] = 'application/json' request["accept"] = 'application/json' request.body = '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "user_name":"new_subaccount_user_name", "email":"me@email.com", "name":"John", "surname":"Doe", "password":"new_subaccount_password", "language":"es" }' response = http.request(request) puts response.read_body ``` -------------------------------- ### Create Subaccount C# Example Source: https://panel.smspubli.com/api/3.0/docs/subaccount/create C# implementation using RestSharp to create a subaccount. ```csharp var client = new RestClient("https://api.gateway360.com/api/3.0/subaccount/create"); var request = new RestRequest(Method.POST); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddParameter("application/json", '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "user_name":"new_subaccount_user_name", "email":"me@email.com", "name":"John", "surname":"Doe", "password":"new_subaccount_password", "language":"es" }', ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Create Subaccount PHP Example Source: https://panel.smspubli.com/api/3.0/docs/subaccount/create PHP implementation using cURL to create a subaccount. ```php $request = '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "user_name":"new_subaccount_user_name", "email":"me@email.com", "name":"John", "surname":"Doe", "password":"new_subaccount_password", "language":"es" }'; $headers = array('Content-Type: application/json'); $ch = curl_init('https://api.gateway360.com/api/3.0/subaccount/create'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); $result = curl_exec($ch); if( !curl_errno($ch) ) $result = json_decode($result); else $result = curl_error($ch); print_r($result); ``` -------------------------------- ### cURL Request Source: https://panel.smspubli.com/api/3.0/docs/account/get-pricing Example of a POST request to the pricing endpoint using cURL. ```bash curl -X POST \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -d '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "country_code":"ES", }' https://api.gateway360.com/api/3.0/account/pricing/sms/get-country-pricing ``` -------------------------------- ### Successful SMS Response Example Source: https://panel.smspubli.com/api/3.0/docs/sms/send Example of a 200 OK response where two messages were successfully processed. ```json { "status":"ok", "result":[ { "status":"ok", "sms_id":"1a8940dc7471427db3021cde5b464444", "custom":"test" }, { "status":"ok", "sms_id":"1a8940dc7471427db3021cde5b464481", "custom":"" } ] } ``` -------------------------------- ### Create Subaccount cURL Request Source: https://panel.smspubli.com/api/3.0/docs/subaccount/create Example cURL command to create a subaccount. ```bash curl -X POST \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -d '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "user_name":"new_subaccount_user_name", "email":"me@email.com", "name":"John", "surname":"Doe", "password":"new_subaccount_password", "language":"es" }' https://api.gateway360.com/api/3.0/subaccount/create ``` -------------------------------- ### cURL Request Source: https://panel.smspubli.com/api/3.0/docs/subaccount/get-info Example cURL command to perform the POST request. ```bash curl -X POST \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -d '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "user_name":"subaccount_user_name" }' https://api.gateway360.com/api/3.0/subaccount/get-info ``` -------------------------------- ### Landing Open Request JSON Example Source: https://panel.smspubli.com/api/3.0/docs/landing/get-reports-callback Example JSON payload for a landing page open report. Contains a single object keyed by sms_id with fields like msisdn, timestamp, ip, city, device, user_agent, brand, model, full_name, and marketing_name. ```json { "034d2acec0eb44af842de6a00bf4d934": { "msisdn":"34666666666", "timestamp":"2017-08-07 17:05:35", "ip":"8.8.8.8", "city":"Madrid", "device":"Android", "user_agent":"Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-G950F Build/NRD90M) AppleWebKit/537.36", "brand":"Samsung", "model":"Galaxy S8", "full_name":"Samsung Galaxy S8", "marketing_name":"SAMSUNG SM-G950F" } } ``` -------------------------------- ### PHP Implementation Source: https://panel.smspubli.com/api/3.0/docs/account/get-pricing PHP example using cURL to send the request and decode the JSON response. ```php $request = '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "country_code":"ES", }'; $headers = array('Content-Type: application/json'); $ch = curl_init('https://api.gateway360.com/api/3.0/account/pricing/sms/get-country-pricing'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); $result = curl_exec($ch); if( !curl_errno($ch) ) $result = json_decode($result); else $result = curl_error($ch); print_r($result); ``` -------------------------------- ### JavaScript XMLHttpRequest Source: https://panel.smspubli.com/api/3.0/docs/account/get-pricing Example using native XMLHttpRequest to perform the POST request. ```javascript var data = JSON.stringify({ "api_key":"399d2b438a53ebed3db8a7d52107f846", "prefix":"34", }); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } }); xhr.open("POST", "https://api.gateway360.com/api/3.0/account/pricing/sms/get-prefix-pricing"); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data); ``` -------------------------------- ### C# RestClient Request Source: https://panel.smspubli.com/api/3.0/docs/account/get-pricing Example using RestSharp to send a POST request to the get-prefix-pricing endpoint. ```csharp var client = new RestClient("https://api.gateway360.com/api/3.0/account/pricing/sms/get-prefix-pricing"); var request = new RestRequest(Method.POST); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddParameter("application/json", '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "prefix":"34", }', ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Get Balance Response Source: https://panel.smspubli.com/api/3.0/docs/account/get-balance Describes the response structure for the Get Balance API, including success and error examples. ```APIDOC ## Get Balance Response ### Description This endpoint returns the account balance and currency. The response includes a status field indicating success or error, and a result object with balance and currency details. ### Response #### Success Response (200) - **status** (string) - The sending status of request - either "ok" or "error" - **result** (object) - Object with the result. - **balance** (string) - The balance amount of your account, with 4 decimals, e.g., 155.2493 - **currency** (string) - Either EUR, USD, GBP, CREDITS, SMS, ... #### Response Example { "status":"ok", "result":{ "balance":"350.1234", "currency":"EUR" } } #### Response Example (CREDITS) { "status":"ok", "result":{ "balance":"1225", "currency":"CREDITS" } } #### Error Response (401 Unauthorized) - **status** (string) - "error" - **error_id** (string) - Error identifier, e.g., "UNAUTHORIZED" - **error_msg** (string) - Additional error information for debugging. #### Error Response Example { "status":"error", "error_id":"UNAUTHORIZED", "error_msg":"Your API key may be invalid or your IP is blocked." } #### Error Response (400 Bad Request) - **status** (string) - "error" - **error_id** (string) - Error identifier, e.g., "JSON_PARSE_ERROR" - **error_msg** (string) - Additional error information for debugging. #### Error Response Example { "status":"error", "error_id":"JSON_PARSE_ERROR", "error_msg":"Your JSON was formatted incorrectly." } ### Errors - **INVALID_CONTENT_TYPE** - The content type must be: Content-Type: application/json - **JSON_PARSE_ERROR** - Your JSON was formatted incorrectly or was considered otherwise improper or incomplete. - **MISSING_PARAMS** - Your request is incomplete and missing some mandatory parameters. - **UNAUTHORIZED** - Your API key may be invalid, double-check that your API key was input correctly or see if your current IP is blocked in your account API settings. ``` -------------------------------- ### Mixed Success and Error Response Example Source: https://panel.smspubli.com/api/3.0/docs/sms/send Example of a 200 OK response where one message was processed successfully and others encountered various errors. ```json { "status":"ok", "result":[ { "status":"ok", "sms_id":"1a8940dc7471427db3021cde5b464444", "custom":"test" }, { "status":"error", "error_id":"INVALID_SENDER", "error_msg":"Sender cannot exceed 11 alphanumeric or 15 numeric characters.", "custom":"" }, { "status":"error", "error_id":"INVALID_DESTINATION", "error_msg":"Destination number must be in international format.", "custom":"12345" }, { "status":"error", "error_id":"NOT_ENOUGH_BALANCE", "error_msg":"Your account has no funds.", "custom":"" }, { "status":"error", "error_id":"INVALID_DATETIME", "error_msg":"Invalid datetime format.", "custom":"" } ] } ``` -------------------------------- ### Landing Click Request JSON Example Source: https://panel.smspubli.com/api/3.0/docs/landing/get-reports-callback Example JSON payload for a landing page click report. Contains a single object keyed by sms_id with fields msisdn, timestamp, and click (the link clicked). ```json { "034d2acec0eb44af842de6a00bf4d934": { "msisdn":"34666666666", "timestamp":"2017-08-07 17:06:15", "click":"https://yourpage.com/more-information", } } ``` -------------------------------- ### DLR Request JSON Example Source: https://panel.smspubli.com/api/3.0/docs/landing/get-reports-callback Example JSON payload for a delivery report request. Contains an array of delivery reports with fields like sms_id, from, to, custom, sms_date, status, and dlr_date. Sent in batches of up to 1,000 reports. ```json [ { "sms_id":"034d2acec0eb44af842de6a00bf4d934", "from":"SUPERGOL", "to":"34666666666", "custom":"YourReferenceID-774843", "sms_date":"2015-06-02 01:43:47", "status":"DELIVRD", "dlr_date":"2015-06-02 01:43:50" }, { "sms_id":"034d2acec0eb44af842de6a00bf4d892", "from":"SUPERGOL", "to":"34666666666", "custom":"YourReferenceID-774849", "sms_date":"2015-06-02 01:43:47", "status":"DELIVRD", "dlr_date":"2015-06-02 01:43:49" } ] ``` -------------------------------- ### Link Open Request JSON Example Source: https://panel.smspubli.com/api/3.0/docs/link/get-reports-callback Example of a link open report request sent to your server when a client opens the URL in your message. The JSON object uses the sms_id as the key and contains msisdn, timestamp, and ip fields. ```json { "034d2acec0eb44af842de6a00bf4d934": { "msisdn":"34666666666", "timestamp":"2017-08-07 16:41:57", "ip":"8.8.8.8", } } ``` -------------------------------- ### Get Balance API Endpoint Source: https://panel.smspubli.com/api/3.0/docs/account/get-balance The base URL for the get-balance request. ```text https://api.gateway360.com/api/3.0/account/get-balance ``` -------------------------------- ### Python Add Balance Request Source: https://panel.smspubli.com/api/3.0/docs/subaccount/add-balance Python example using http.client to send a POST request with JSON payload to add balance and print the response. ```python conn = http.client.HTTPSConnection("api.gateway360.com") payload = '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "user_name":"subaccount_user_name", "amount":"150", }' headers = { 'content-type': "application/json", 'accept': "application/json" } conn.request("POST", "/api/3.0/subaccount/add-balance", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### C# Add Balance Request Source: https://panel.smspubli.com/api/3.0/docs/subaccount/add-balance C# example using RestClient to send a POST request with JSON payload to add balance. ```csharp var client = new RestClient("https://api.gateway360.com/api/3.0/subaccount/add-balance"); var request = new RestRequest(Method.POST); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddParameter("application/json", '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "user_name":"subaccount_user_name", "amount":"150", }', ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` -------------------------------- ### C# Verify PIN Example Source: https://panel.smspubli.com/api/3.0/docs/2factor/verify C# script using RestClient to send a POST to the Verify PIN endpoint. ```csharp var client = new RestClient("https://api.gateway360.com/api/2fa/verify"); var request = new RestRequest(Method.POST); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddParameter("application/json", '{ "api_key":"your_api_key_here", "msisdn":"34666666111", "pin":"581365" }', ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Java Add Balance Request Source: https://panel.smspubli.com/api/3.0/docs/subaccount/add-balance Java example using Apache HttpClient to send a POST request with JSON payload to add balance. ```java /** Imports */ import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; /** End imports */ HttpClient httpClient = HttpClientBuilder.create().build(); HttpPost request = new HttpPost("https://api.gateway360.com/api/3.0/subaccount/add-balance"); StringEntity params = new StringEntity( "{" + " \"api_key\":\"399d2b438a53ebed3db8a7d52107f846\"," + " \"user_name\":\"subaccount_user_name\"," + " \"amount\":\"150\"" + "}"); request.addHeader("content-type", "application/json"); request.addHeader("Accept","application/json"); request.setEntity(params); HttpResponse response = httpClient.execute(request); ``` -------------------------------- ### Delete subaccount Ruby request Source: https://panel.smspubli.com/api/3.0/docs/subaccount/delete Example Ruby implementation to delete a subaccount. ```ruby require 'uri' require 'net/http' url = URI("https://api.gateway360.com/api/3.0/subaccount/delete") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(url) request["content-type"] = 'application/json' request["accept"] = 'application/json' request.body = '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "user_name":"subaccount_user_name" }' response = http.request(request) puts response.read_body ``` -------------------------------- ### Delete subaccount cURL request Source: https://panel.smspubli.com/api/3.0/docs/subaccount/delete Example cURL command to delete a subaccount. ```bash curl -X POST \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -d '{ "api_key":"399d2b438a53ebed3db8a7d52107f846", "user_name":"subaccount_user_name" }' https://api.gateway360.com/api/3.0/subaccount/delete ``` -------------------------------- ### Successful Response with CREDITS Balance Source: https://panel.smspubli.com/api/3.0/docs/subaccount/get-info Example of a successful 200 OK response showing a subaccount with a balance in CREDITS. ```json { "status":"ok", "result":{ "user_name":"subaccount_user_name", "email":"me@email.com", "balance":"1225", "currency":"CREDITS" } } ``` -------------------------------- ### Subaccount Get Info Endpoint Source: https://panel.smspubli.com/api/3.0/docs/subaccount/get-info The base URL for the get-info API endpoint. ```text https://api.gateway360.com/api/3.0/subaccount/get-info ``` -------------------------------- ### Java Verify PIN Example Source: https://panel.smspubli.com/api/3.0/docs/2factor/verify Java snippet using HttpClient and HttpPost to send the verify request. The code appears complete except for a trailing .asString() which is shown separately in the source. ```java import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; HttpClient httpClient = HttpClientBuilder.create().build(); HttpPost request = new HttpPost("https://api.gateway360.com/api/2fa/verify"); StringEntity params = new StringEntity( "{" + " \"api_key\":\"399d2b438a53ebed3db8a7d52107f846\"," + " \"msisdn\":\"34666666111\"," + " \"pin\":\"581365\"" + "}"); request.addHeader("content-type", "application/json"); request.addHeader("Accept","application/json"); request.setEntity(params); HttpResponse response = httpClient.execute(request); .asString(); ``` -------------------------------- ### Get Balance JSON Request Source: https://panel.smspubli.com/api/3.0/docs/account/get-balance The required JSON structure containing the api_key. ```json { "api_key":"399d2b438a53ebed3db8a7d52107f846" } ``` -------------------------------- ### Ruby Verify PIN Example Source: https://panel.smspubli.com/api/3.0/docs/2factor/verify Ruby script using net/http to POST the JSON payload to the Verify PIN endpoint. ```ruby require 'uri' require 'net/http' url = URI("https://api.gateway360.com/api/2fa/verify") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(url) request["content-type"] = 'application/json' request["accept"] = 'application/json' request.body = '{ "api_key":"your_api_key_here", "msisdn":"3466666611", "pin":"581365" }' response = http.request(request) puts response.read_body ``` -------------------------------- ### POST /subaccount/create Source: https://panel.smspubli.com/api/3.0/docs/subaccount/create Creates a new subaccount. The response includes the new subaccount's username, password, and API key. Errors are returned with appropriate status codes and error details. ```APIDOC ## POST /subaccount/create ### Description Creates a new subaccount. The response includes the new subaccount's username, password, and API key. Errors are returned with appropriate status codes and error details. ### Method POST ### Endpoint /subaccount/create ### Response #### Success Response (200) - **status** (string) - The sending status of request - either "ok" or "error" - **result** (object) - Object with the result. - **user_name** (string) - The username of the new subaccount - **password** (string) - The password introduced in the request or, if it was empty, the password auto-generated - **api_key** (string) - Subaccount API key #### Response Example { "status":"ok", "result":{ "user_name":"new_subaccount_user_name", "password":"new_subaccount_password", "api_key":"1234abcd5678efgh0db8a9d48100f123" } } The user new_subaccount_user_name with password new_subaccount_password has been created. #### Error Response (401 Unauthorized) - **status** (string) - "error" - **error_id** (string) - Error identifier - **error_msg** (string) - Additional error information for debugging #### Response Example { "status":"error", "error_id":"UNAUTHORIZED", "error_msg":"Your API key may be invalid or your IP is blocked." } We didn't continue processing your request because your API Key wasn't valid. #### Error Response (400 Bad Request) - **status** (string) - "error" - **error_id** (string) - Error identifier - **error_msg** (string) - Additional error information for debugging #### Response Example { "status":"error", "error_id":"JSON_PARSE_ERROR", "error_msg":"Your JSON was formatted incorrectly." } We couldn't process your request. #### Error Response (400 Bad Request) - **status** (string) - "error" - **error_id** (string) - Error identifier - **error_msg** (string) - Additional error information for debugging #### Response Example { "status":"error", "error_id":"INVALID_NAME", "error_msg":"You can't keep a sub-account with that username." } We didn't continue processing your request because the new username wasn't valid. May be it was repeated #### Error Response (400 Bad Request) - **status** (string) - "error" - **error_id** (string) - Error identifier - **error_msg** (string) - Additional error information for debugging #### Response Example { "status":"error", "error_id":"INVALID_LANGUAGE", "error_msg":"Language not supported." } We didn't continue processing your request because the language wasn't valid. ### Errors - **INVALID_CONTENT_TYPE** - The content type must be: Content-Type: application/json - **JSON_PARSE_ERROR** - Your JSON was formatted incorrectly or was considered otherwise improper or incomplete. Check it here. - **MISSING_PARAMS** - Your request is incomplete and missing some mandatory parameters. - **UNAUTHORIZED** - Your API key may be invalid, double-check that your API key was input correctly or see if your current IP is blocked in your account API settings. - **INVALID_NAME** - The new username is invalid, there may be a user with that username. - **INVALID_EMAIL** - The new email has an incorrect format. - **INVALID_LANGUAGE** - Language not supported. - **INVALID_PASSWORD** - Password must be at least 12 characters long ```