API documentation For developers
Use your user API key
Create sources and add contacts from your own server, step by step with a sample website.
With your user API key, your own server can create sources and add contacts to them, so you don't set anything up inside Miaalo by hand. This page walks through it with a small sample website.
| Who can use it | Paid plans, once the Miaalo team has turned it on for your account |
|---|---|
| Where it is | API Keys page, User API key card |
| Where it goes | Your server only (for example a .env file). Never in website or browser code. |
1. Find your user API key
- In Miaalo, open API Keys.
- Find the User API key card at the top.
- Click Show to see the key, or Copy to copy it.
If the card says Not turned on yet, email info@fairshare.tech and the team will set it up.
2. Put the key on your server
Save it as a setting on your server, not in your code:
MIAALO_URL=https://bulksms.fairshare.tech
MIAALO_USER_KEY=paste-your-user-api-key-here
MIAALO_SOURCE=Bloom Dental website
Anyone with this key can create sources in your account. Keep it out of Git and out of the browser.
3. Create a source
Send your user key and a source name to POST /create-group. Miaalo creates the source and returns its form key.
const res = await fetch("https://bulksms.fairshare.tech/api/create-group", {
method: "POST",
headers: { "Content-Type": "application/json", "Accept": "application/json" },
body: JSON.stringify({ user_key: process.env.MIAALO_USER_KEY, group_name: "Bloom Dental website" })
}).then(r => r.json());
const formKey = res.key; // { "status": 1, "key": "...", "data": { "message": "Success" } }
The new source appears under Sources in Miaalo, and its key appears on API Keys. Sending the same name again returns the same key, so it's safe to run every time your server starts.
4. Add contacts
When a visitor sends your form, post their details with the form key to POST /save-number:
await fetch("https://bulksms.fairshare.tech/api/save-number", {
method: "POST",
headers: { "Content-Type": "application/json", "Accept": "application/json" },
body: JSON.stringify({ api_key: formKey, name: "Rohan Mehta", phone: "9812345670", email: "rohan@example.com" })
}).then(r => r.json());
The contact appears in Contacts, inside the new source. The form key can only add contacts. It can't read or delete anything.
Sample website
The sample is a fictional dental clinic's site in Node.js with no dependencies. Its files:
| File | What it does |
|---|---|
.env | Your Miaalo URL, user API key and source name |
miaalo.mjs | createSource() and addContact(): the two API calls |
server.mjs | Creates the source when it starts, serves the site, and saves each enquiry |
public/index.html | The contact form. It posts to the site's own server, never to Miaalo directly. |
Ask info@fairshare.tech for a copy of the sample. Every field and error is in the API reference.
Errors you may see
- Invalid User Key: the key is wrong or has been changed. Copy it again from API Keys.
- not turned on for your account or a paid feature: the feature isn't active. Contact the Miaalo team.
- Source limit reached: your plan's source limit is used up. Upgrade, or reuse an existing source name.