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 POST requests with a JSON body (Content-Type: application/json) or as normal form fields.
  • Every response is JSON with a status field: 1 means success, -1 means 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 toYour accountOne or more of your sources
Can doCreate sources and get their keysAdd contacts to its sources only
Where to useYour server onlyWebsite forms, browser code, apps
Request fielduser_keyapi_key
How you get itCreated with your accountFrom 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

FieldRequiredNotes
api_keyYesYour public source API key
nameYesContact's name
phoneYes10-digit Indian mobile number. A +91, 91 or 0 prefix and spaces are accepted.
emailNoContact'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

FieldRequiredNotes
user_keyYesYour private user key
group_nameYesName of the source, for example Website enquiry
group_typeNoP 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:

EndpointMessageFix
save-numberName is required filedSend name
save-numberPhone number is required filedSend phone
save-numberInvalid phone numberUse a 10-digit Indian mobile number
save-numberapi_key is required filedSend api_key
save-numberinvalid api_keyCheck the key on the API keys page
save-numberGroup not foundLink the key to at least one source
create-groupUser Key is missing / Invalid User KeySend your correct private user key
create-groupGroup name is missingSend group_name