Full programmatic access to your mailboxes over plain HTTPS — send messages, read folders,
search, manage drafts and labels. No IMAP configuration, no SMTP handshakes, scoped tokens you
control. Copy-paste examples in 14 languages.
The SyncGaze Mail API gives you full programmatic access to your mailboxes — send emails, read messages,
manage folders, search, and more. One secure HTTPS call. No IMAP configuration. No SMTP handshakes.
Tokens are created in your webmail under Settings → API Access and scoped to exactly the
permissions your application needs.
⚡ ~0.8 ms server-side dispatch. The API routes your mail through the SyncGaze Mail Server
internally — far faster than a client-side SMTP connection which adds 200–500ms of TCP/TLS/AUTH overhead.
Endpoint
Base URL
Base URL
https://mail.syncgaze.in/api/v1/webmail/
All endpoints are relative to this base URL. Always use HTTPS.
Security
Authentication
Include your API token in every request as a Bearer token in the
Authorization header:
HTTP Header
Authorization: Bearer sg_YOUR_TOKEN
Token Scopes
Scope
Access
Description
imap:read
Read
List folders, read messages, search, view drafts & labels
require'net/http'require'json'; require'uri'
API = "https://mail.syncgaze.in/api/v1/webmail"
TOKEN = "sg_YOUR_TOKEN"def api_get(path)
uri = URI("#{API}#{path}")
req = Net::HTTP::Get.new(uri)
req['Authorization'] = "Bearer #{TOKEN}"
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
JSON.parse(http.request(req).body)
end
p api_get('/folders/')
p api_get('/messages/?folder=INBOX&limit=20')
# ⚡ Send email — <1ms server-side dispatch
uri = URI("#{API}/send/")
req = Net::HTTP::Post.new(uri)
req['Authorization'] = "Bearer #{TOKEN}"
req['Content-Type'] = 'application/json'
req.body = { to: [{ email: 'recipient@example.com' }],
subject: 'Hello from Ruby',
body: '<p>Hi!</p>' }.to_json
http = Net::HTTP.new(uri.host, uri.port); http.use_ssl = true
p http.request(req).code
java
// Java 11+ — no external dependenciesimport java.net.URI; import java.net.http.*;
var client = HttpClient.newHttpClient();
var api = "https://mail.syncgaze.in/api/v1/webmail";
var token = "sg_YOUR_TOKEN";
// List foldersvar req = HttpRequest.newBuilder()
.uri(URI.create(api + "/folders/"))
.header("Authorization", "Bearer " + token)
.GET().build();
System.out.println(client.send(req, HttpResponse.BodyHandlers.ofString()).body());
// ⚡ Send email — <1ms server-side dispatchvar body = """
{"to":[{"email":"recipient@example.com"}],
"subject":"Hello from Java",
"body":"<p>Sent via SyncGaze API</p>"}
""";
var send = HttpRequest.newBuilder()
.uri(URI.create(api + "/send/"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body)).build();
System.out.println(client.send(send, HttpResponse.BodyHandlers.ofString()).statusCode());
csharp
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
var api = "https://mail.syncgaze.in/api/v1/webmail";
var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "sg_YOUR_TOKEN");
// List folders
Console.WriteLine(await http.GetStringAsync($"{api}/folders/"));
// List INBOX messages
Console.WriteLine(await http.GetStringAsync(
$"{api}/messages/?folder=INBOX&limit=20"));
// ⚡ Send email — <1ms server-side dispatchvar payload = """
{"to":[{"email":"recipient@example.com"}],
"subject":"Hello from C#",
"body":"<p>Sent via SyncGaze API</p>"}
""";
var resp = await http.PostAsync($"{api}/send/",
new StringContent(payload, Encoding.UTF8, "application/json"));
Console.WriteLine((int)resp.StatusCode);
rust
// Cargo.toml: reqwest = { version = "0.12", features = ["json","blocking"] }// serde_json = "1"use reqwest::blocking::Client;
use serde_json::json;
fn main() -> Result<(), reqwest::Error> {
let api = "https://mail.syncgaze.in/api/v1/webmail";
let token = "sg_YOUR_TOKEN";
let client = Client::new();
let auth = format!("Bearer {token}");
// List folderslet folders = client.get(format!("{api}/folders/"))
.header("Authorization", &auth).send()?.text()?;
println!("{folders}");
// ⚡ Send email — <1ms server-side dispatchlet r = client.post(format!("{api}/send/"))
.header("Authorization", &auth)
.json(&json!({
"to": [{ "email": "recipient@example.com" }],
"subject": "Hello from Rust",
"body": "<p>Sent via SyncGaze API</p>",
})).send()?;
println!("{}", r.status());
Ok(())
}
swift
import Foundation
let api = "https://mail.syncgaze.in/api/v1/webmail"let token = "sg_YOUR_TOKEN"func sg(_ path: String, method: String = "GET", body: Data? = nil) async throws -> Data {
var req = URLRequest(url: URL(string: api + path)!)
req.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
req.httpMethod = method
if let b = body {
req.httpBody = b
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
}
let (data, _) = try await URLSession.shared.data(for: req)
return data
}
// List folderslet folders = try await sg("/folders/")
print(String(data: folders, encoding: .utf8)!)
// ⚡ Send email — <1ms server-side dispatchlet payload = try! JSONSerialization.data(withJSONObject: [
"to": [["email": "recipient@example.com"]],
"subject": "Hello from Swift",
"body": "<p>Sent via SyncGaze API</p>",
])
let result = try await sg("/send/", method: "POST", body: payload)
print(String(data: result, encoding: .utf8)!)
kotlin
// build.gradle: implementation("com.squareup.okhttp3:okhttp:4.12.0")import okhttp3.*; import okhttp3.MediaType.Companion.toMediaType
val api = "https://mail.syncgaze.in/api/v1/webmail"val token = "sg_YOUR_TOKEN"val client = OkHttpClient()
val JSON = "application/json".toMediaType()
// List foldersval req = Request.Builder()
.url("$api/folders/")
.header("Authorization", "Bearer $token")
.build()
client.newCall(req).execute().use { println(it.body!!.string()) }
// ⚡ Send email — <1ms server-side dispatchval body = RequestBody.create(JSON, """
{"to":[{"email":"recipient@example.com"}],
"subject":"Hello from Kotlin",
"body":"<p>Sent via SyncGaze API</p>"}
""")
val send = Request.Builder()
.url("$api/send/")
.header("Authorization", "Bearer $token")
.post(body).build()
client.newCall(send).execute().use { println(it.code) }