Policies & help › Developers
SDK Documentation
Indo Mail has no official SDK yet. This page gives small, working client examples in JavaScript and Python, the Tag Manager snippet, the ad-network endpoint, and the SDKs we plan to publish.
1. Current status
There is no official Indo Mail SDK today. We have not published packages to npm, PyPI or any other registry, and nothing you find under our name there is ours. The API is plain JSON over HTTPS, so a few lines of code in any language are enough to use it. This page shows minimal clients that you can copy into your own project. They are examples, not supported libraries.
Indo Mail itself uses no third-party SDKs, and none of the examples here add any. Read the API Documentation first to learn the routes, limits and error format.
2. JavaScript client (fetch)
This small class works in modern browsers and in Node.js 18 or newer, which both have fetch. Use it from a server or a script that you control. Do not put a real password in code that runs on a public web page.
class IndoMail { constructor(base = 'https://indoemail.in') { this.base = base; this.token = null; }async call(path, { method = 'GET', body, form } = {}) { const headers = {}; if (this.token) headers.Authorization = 'Bearer ' + this.token; if (body) headers['Content-Type'] = 'application/json'; const res = await fetch(this.base + path, { method, headers, body: form || (body ? JSON.stringify(body) : undefined) }); const data = await res.json().catch(() => ({})); if (!res.ok) throw new Error(data.error || 'HTTP ' + res.status); return data; }async login(login, password) { const r = await this.call('/api/auth/login', { method: 'POST', body: { login, password } }); if (r.twoFactor) return r; this.token = r.token; return r; }async verifyCode(ticket, code) { const r = await this.call('/api/auth/login/2fa', { method: 'POST', body: { ticket, code } }); this.token = r.token; return r; }inbox(page = 1) { return this.call('/api/mail/messages?folder=inbox&limit=50&page=' + page); }search(q) { return this.call('/api/mail/messages?folder=all&q=' + encodeURIComponent(q)); }send({ to, subject, html }) { const f = new FormData(); f.append('to', to); f.append('subject', subject); f.append('html', html); return this.call('/api/mail/send', { method: 'POST', form: f }); } }
Use it like this: const mail = new IndoMail(); const r = await mail.login('you@indoemail.in', password); if (r.twoFactor) await mail.verifyCode(r.ticket, '123456'); const inbox = await mail.inbox(); await mail.send({ to: 'friend@indoemail.in', subject: 'Hello', html: '<p>Sent from my script</p>' });
To attach a file in Node.js, append a Blob to the same FormData under the field name attachments. The Content-Type header for multipart requests is set by fetch itself, so do not set it by hand.
3. Python client (requests)
This version needs only the requests package. It uses a session so that the token is sent on each call.
import requestsclass IndoMail:def __init__(self, base='https://indoemail.in'): self.base = base; self.s = requests.Session()def call(self, method, path, **kw):r = self.s.request(method, self.base + path, timeout=30, **kw)data = r.json() if r.content else {}if not r.ok: raise RuntimeError(data.get('error', r.status_code))return datadef login(self, login, password): d = self.call('POST', '/api/auth/login', json={'login': login, 'password': password}); d.get('token') and self.s.headers.update({'Authorization': 'Bearer ' + d['token']}); return ddef verify_code(self, ticket, code): d = self.call('POST', '/api/auth/login/2fa', json={'ticket': ticket, 'code': code}); self.s.headers.update({'Authorization': 'Bearer ' + d['token']}); return ddef inbox(self, page=1): return self.call('GET', '/api/mail/messages', params={'folder': 'inbox', 'limit': 50, 'page': page})def send(self, to, subject, html, files=()): return self.call('POST', '/api/mail/send', data={'to': to, 'subject': subject, 'html': html}, files=[('attachments', open(f, 'rb')) for f in files])def request_upi(self, amount, counterparty, note=''): return self.call('POST', '/api/apps/wallet/requests', json={'direction': 'receive', 'amount': amount, 'counterparty': counterparty, 'note': note})
Example: m = IndoMail(); r = m.login('you@indoemail.in', password); m.verify_code(r['ticket'], '123456') if r.get('twoFactor') else None; print(m.inbox()). Store the password in an environment variable or a secrets manager, never in the source file.
4. Handling errors and limits
- Every error body has an
errorfield. Show it to a person or write it to your log. - On 401, sign in again. Tokens last 7 days, and a 2-step ticket lasts 5 minutes.
- On 429, stop and retry later. Sign-in routes allow 20 attempts per 15 minutes. An account can send to 500 recipients per day.
- Wrap network calls in a timeout. The Python example uses 30 seconds.
- Never log passwords, tokens or message bodies.
5. Tag Manager snippet
Tag Manager counts conversions on your own website without cookies. Create a container in the Tag Manager app. You receive a container ID. Add this one line to the pages you want to measure, using your own ID in place of the example tg_a1b2c3d4:
<script async src="https://indoemail.in/t/tg_a1b2c3d4.js"></script>
The script sends the events you set up (for example every page view, or pages whose path starts with /thank-you). To count an event from your own code, call window.indoTag('signup_completed') after the script has loaded. Event names can have up to 40 characters. The script sends only the event name to POST /t/<container>/collect. It sets no cookies, stores nothing in the browser and sends no personal data, so it needs no cookie banner for this purpose.
Tag Manager is part of the advertising tools. Add a tag to a campaign in the app, and each counted event becomes a conversion in the Marketing Platform report. Your use of the script must follow the Analytics and Advertising Platform documents.
6. Ad-network endpoint
The Indo Chats Ads network lets other apps of INDO CHATS PRIVATE LIMITED show the same contextual ads that Indo Mail shows. The public endpoint is GET https://indoemail.in/api/network/ads. It needs no token and allows requests from any origin. Parameters:
| Parameter | Meaning | Default |
|---|---|---|
| country | Two-letter country code of the audience | IN |
| lang | Two-letter language code | en |
| q | Words on the page where the ad will appear. Send page words only, never a person's mail or personal data. | none |
| n | Number of ads wanted, from 1 to 3 | 1 |
The reply is a list of ads. Each has a headline, body, display URL, an optional image, the advertiser name, the label "Sponsored" and a clickUrl. Show the label with the ad. Send the person to the click URL (for example /a/58) so that the click is counted. Do not fetch ads for people on a paid plan, and do not combine ad requests with user profiles.
The same data for Indo Mail's own placements comes from GET /api/ads/serve with placement set to inbox, search, help, local or network. Local Services Ads accept an enquiry at POST /api/ads/leads/<creative id> with name and either phone or email.
7. Planned SDKs
Planned, not live. When the versioned API and API keys are released (see API Documentation), we intend to publish official client libraries. We will tell early-access developers before they appear.
| SDK | Planned scope | Status |
|---|---|---|
| JavaScript and TypeScript | Typed client for mail, Drive, contacts and Wallet; works in Node.js and browsers | Planned |
| Python | Client with async support for scripts and back-end services | Planned |
| Android (Kotlin) | Sign-in with OAuth, mail actions and Web Push device registration | Planned |
| iOS (Swift) | Same scope as Android | Planned |
| Command-line tool | Send and read mail from a terminal, with API keys | Planned |
Planned SDKs will follow the same promise as our apps: no third-party trackers, no hidden analytics, and open-source licences where we can.
8. Contact
Early access, ideas and bug reports for developers: contact@indoemail.in with the subject "Developer access". Security reports: security@indoemail.in.
INDO CHATS PRIVATE LIMITED, 168, GT Rd, near Aloka Cinema, Shibpur, Howrah, West Bengal 711102, India.