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.

Find your key, add it to the sample site, create a source, and add contacts. About 1.5 minutes.
Who can use itPaid plans, once the Miaalo team has turned it on for your account
Where it isAPI Keys page, User API key card
Where it goesYour server only (for example a .env file). Never in website or browser code.

1. Find your user API key

  1. In Miaalo, open API Keys.
  2. Find the User API key card at the top.
  3. Click Show to see the key, or Copy to copy it.

If the card says Not turned on yet, email [email protected] 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://miaalo.com
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://miaalo.com/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://miaalo.com/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: "[email protected]" })
}).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:

FileWhat it does
.envYour Miaalo URL, user API key and source name
miaalo.mjscreateSource() and addContact(): the two API calls
server.mjsCreates the source when it starts, serves the site, and saves each enquiry
public/index.htmlThe contact form. It posts to the site's own server, never to Miaalo directly.

Ask [email protected] 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.