Developers
Miaalo API
Send contacts from any form or system into your Miaalo CRM. Two endpoints, two keys.
Basics
Base URL:
https://miaalo.com/api
- Send
POSTrequests with a JSON body (Content-Type: application/json) or as normal form fields. - Every response is JSON with a
statusfield:1means success,-1means failure. - Cross-origin requests are allowed, so a browser on your own website can call the API directly.
Concepts. A contact is a person who contacted your business. A source is a list of contacts from one place (a website form, a batch, an event). A contact is identified by phone number and can belong to several sources.
API keys
Log in and open the API keys page to see both kinds of key.
| User key (private) | Source API key (public) | |
|---|---|---|
| Belongs to | Your account | One or more of your sources |
| Can do | Create sources and get their keys | Add contacts to its sources only |
| Where to use | Your server only | Website forms, browser code, apps |
| Request field | user_key | api_key |
| How you get it | Created with your account | From the API keys page, or returned by create-group |
Keep the user key secret. Anyone who has it can create sources in your account. Never put it in HTML, JavaScript or a mobile app. The source API key is safe to publish, because it can only add contacts to its own sources.
POST /api/save-number
Saves a contact and adds it to every source linked to the source API key.
Fields
| Field | Required | Notes |
|---|---|---|
api_key | Yes | Your public source API key |
name | Yes | Contact's name |
phone | Yes | 10-digit Indian mobile number. A +91, 91 or 0 prefix and spaces are accepted. |
email | No | Contact's email address |
Example
curl -X POST https://miaalo.com/api/save-number \
-H "Content-Type: application/json" \
-d '{"api_key":"YOUR_GROUP_KEY","name":"Aarav Sharma","phone":"9876543210","email":"aarav@example.com"}'
{ "status": 1, "data": { "message": "Success" } }
If a contact with the same phone number already exists in your account, no duplicate is created. The existing contact is added to the key's sources.
Website form example
Paste this into any page. Replace YOUR_GROUP_KEY with the source API key for this form.
<form id="enquiry">
<input name="name" placeholder="Your name" required>
<input name="phone" placeholder="Mobile number" required>
<input name="email" type="email" placeholder="Email (optional)">
<button>Send enquiry</button>
<p id="enquiry-msg"></p>
</form>
<script>
document.getElementById("enquiry").addEventListener("submit", async (e) => {
e.preventDefault();
const data = Object.fromEntries(new FormData(e.target));
data.api_key = "YOUR_GROUP_KEY";
const res = await fetch("https://miaalo.com/api/save-number", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data)
}).then(r => r.json());
document.getElementById("enquiry-msg").textContent =
res.status === 1 ? "Thanks! We will get back to you." : res.data.message;
if (res.status === 1) e.target.reset();
});
</script>
Each submission appears in Contacts and in the source's contact list right away.
POST /api/create-group
Creates a source in your account and returns its source API key. Call it from your server, because it needs your private user key.
Fields
| Field | Required | Notes |
|---|---|---|
user_key | Yes | Your private user key |
group_name | Yes | Name of the source, for example Website enquiry |
group_type | No | P for a private source (default). Any other value makes the source public, so people can join it from your sign-up page. |
Example
curl -X POST https://miaalo.com/api/create-group \
-H "Content-Type: application/json" \
-d '{"user_key":"YOUR_USER_KEY","group_name":"Website enquiry"}'
{ "status": 1, "key": "aB3dE5fG7h", "data": { "message": "Success" } }
The key is the source API key. Use it as api_key in
save-number. Calling create-group again with the same name returns the
same source and key, so it is safe to retry.
Responses and errors
Check the status field, not the HTTP code. On failure, data.message says why:
| Endpoint | Message | Fix |
|---|---|---|
| save-number | Name is required filed | Send name |
| save-number | Phone number is required filed | Send phone |
| save-number | Invalid phone number | Use a 10-digit Indian mobile number |
| save-number | api_key is required filed | Send api_key |
| save-number | invalid api_key | Check the key on the API keys page |
| save-number | Group not found | Link the key to at least one source |
| create-group | User Key is missing / Invalid User Key | Send your correct private user key |
| create-group | Group name is missing | Send group_name |