Get Balance
Local Mail Balance API allows you to render the total available balance, You can utilize the Balance API to integrate this data in one of your application or feed to dashboards, or send notifications
get
https://api.localmail.io
/v1/accounts/balance
Account Balance

Code Samples

CURL
PHP
GO
NODE.JS
PYTHON
RUBY
JAVA
SWIFT
C#
1
curl --location --request GET 'https://api.localmail.io/v1/accounts/balance' \
2
--header 'sid: {sid}' \
3
--header 'accesskey: {accesskey}'
Copied!
1
<?php
2
3
$sid = "enter your SID token";
4
$accesskey = "enter your Accesskey token";
5
6
$curl = curl_init();
7
8
curl_setopt_array($curl, array(
9
CURLOPT_URL => 'https://api.localmail.io/v1/accounts/balance',
10
CURLOPT_RETURNTRANSFER => true,
11
CURLOPT_ENCODING => '',
12
CURLOPT_MAXREDIRS => 10,
13
CURLOPT_TIMEOUT => 0,
14
CURLOPT_FOLLOWLOCATION => true,
15
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
16
CURLOPT_CUSTOMREQUEST => 'GET',
17
CURLOPT_HTTPHEADER => array(
18
'sid: $sid',
19
'accesskey: $accesskey'
20
),
21
));
22
23
$response = curl_exec($curl);
24
25
curl_close($curl);
26
echo $response;
27
28
Copied!
1
package main
2
3
import (
4
"fmt"
5
"net/http"
6
"io/ioutil"
7
)
8
9
func main() {
10
11
url := "https://api.localmail.io/v1/accounts/balance"
12
method := "GET"
13
14
client := &http.Client {
15
}
16
req, err := http.NewRequest(method, url, nil)
17
18
if err != nil {
19
fmt.Println(err)
20
return
21
}
22
req.Header.Add("sid", "{sid}")
23
req.Header.Add("accesskey", "{apikey}")
24
25
res, err := client.Do(req)
26
if err != nil {
27
fmt.Println(err)
28
return
29
}
30
defer res.Body.Close()
31
32
body, err := ioutil.ReadAll(res.Body)
33
if err != nil {
34
fmt.Println(err)
35
return
36
}
37
fmt.Println(string(body))
38
}
Copied!
1
var request = require('request');
2
var options = {
3
'method': 'GET',
4
'url': 'https://api.localmail.io/v1/accounts/balance',
5
'headers': {
6
'sid': '{sid}',
7
'accesskey': '{accesskey}'
8
}
9
};
10
request(options, function (error, response) {
11
if (error) throw new Error(error);
12
console.log(response.body);
13
});
Copied!
1
import requests
2
3
url = "https://api.localmail.io/v1/accounts/balance"
4
5
payload={}
6
headers = {
7
'sid': '{sid}',
8
'accesskey': '{accesskey}'
9
}
10
11
response = requests.request("GET", url, headers=headers, data=payload)
12
13
print(response.text)
14
Copied!
1
require "uri"
2
require "net/http"
3
4
url = URI("https://api.localmail.io/v1/accounts/balance")
5
6
https = Net::HTTP.new(url.host, url.port)
7
https.use_ssl = true
8
9
request = Net::HTTP::Get.new(url)
10
request["sid"] = "{sid}"
11
request["accesskey"] = "{accesskey}"
12
13
response = https.request(request)
14
puts response.read_body
15
Copied!
1
OkHttpClient client = new OkHttpClient().newBuilder()
2
.build();
3
Request request = new Request.Builder()
4
.url("https://api.localmail.io/v1/accounts/balance")
5
.method("GET", null)
6
.addHeader("sid", "{sid}")
7
.addHeader("accesskey", "{accesskey}")
8
.build();
9
Response response = client.newCall(request).execute();
Copied!
1
import Foundation
2
#if canImport(FoundationNetworking)
3
import FoundationNetworking
4
#endif
5
6
var semaphore = DispatchSemaphore (value: 0)
7
8
var request = URLRequest(url: URL(string: "https://api.localmail.io/v1/accounts/balance")!,timeoutInterval: Double.infinity)
9
request.addValue("{sid}", forHTTPHeaderField: "sid")
10
request.addValue("{apikey}", forHTTPHeaderField: "accesskey")
11
12
request.httpMethod = "GET"
13
14
let task = URLSession.shared.dataTask(with: request) { data, response, error in
15
guard let data = data else {
16
print(String(describing: error))
17
semaphore.signal()
18
return
19
}
20
print(String(data: data, encoding: .utf8)!)
21
semaphore.signal()
22
}
23
24
task.resume()
25
semaphore.wait()
26
Copied!
1
var client = new RestClient("https://api.localmail.io/v1/accounts/balance");
2
client.Timeout = -1;
3
var request = new RestRequest(Method.GET);
4
request.AddHeader("sid", "{sid}");
5
request.AddHeader("accesskey", "{accesskey}");
6
IRestResponse response = client.Execute(request);
7
Console.WriteLine(response.Content);
Copied!
Last modified 4mo ago
Copy link