The Mirialabs API
Connect your payroll, HR, visitor or building software to your doors and people. A REST API with JSON, keys with scopes, and reports in JSON, CSV or Excel.
Getting started
The API is part of the Premium+ plan. It works with sites that use cloud sync (all new sites do).
- In the Manager, open the organisation, then Organisation › API keys, and make a key. Give it only the access it needs.
- Copy the key: it is shown only once. Keep it on your server, never in a web page or a mobile app.
- Make your first call:
curl https://mirialabs.com/api/v2/me \
-H "Authorization: Bearer mlk_your_key"Base address of every call: https://mirialabs.com/api/v2
Keys and scopes
Send the key with every call, in the Authorization header. A key belongs to your organisation. It can reach all its sites, or only the ones you choose, and does only what its scopes allow.
| Scope | Allows |
|---|---|
people:read | Read people and groups |
people:write | Add, change and delete people and groups |
events:read | Read access events and who is on site |
reports:read | Read reports: timesheets, most active people |
doors:open | Open doors remotely |
Sites and doors need no scope. A key that leaks can be revoked at once in the Manager; make a new one for the software.
Requests and answers
- JSON in and out (Content-Type: application/json for POST and PATCH).
- Times are in UTC, ISO 8601 (2026-12-04T08:02:11Z). Days in reports follow the site's time zone, given by GET /sites.
- Lists come page by page, with a pagination block: page, per_page, total, total_pages.
- Sites have a number id; people, groups and doors have text ids. Use the ids the API gives you.
{
"data": [ … ],
"pagination": {"page": 1, "per_page": 50, "total": 132, "total_pages": 3}
}Errors and limits
An error has an HTTP status and a body with a stable code (for your program) and a message (for people):
{"error": {"code": "missing_scope", "message": "This key does not have the people:write scope."}}| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No key, or an unknown, revoked or expired key. |
| 403 | plan_required | The organisation is not on Premium+ any more. The key works again on Premium+. |
| 403 | missing_scope | The key does not have the scope this call needs. |
| 403 | plan_limit | The plan's people limit is reached. |
| 404 | not_found | Unknown site, person, group or door, or a site the key may not reach. |
| 409 | conflict | A person with this card, or a group with this name, is already on the site. |
| 409 | site_not_synced | The site still runs in the older device-by-device mode: contact us to switch it to cloud sync. |
| 409 | managed_by_organisation | The person or group is managed for the whole organisation: change it in the Manager. |
| 409 | device_offline | The door's controller is offline. |
| 422 | invalid | A field is missing or wrong: the message says which. |
| 429 | rate_limited | Too many calls: wait for the time given in Retry-After. |
| 502 | not_saved / not_opened | The cloud could not do it right now: try again. |
Each key may make 600 calls per minute. Every answer tells you where you stand: X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (Unix time).
Sites and doors
/meThe key: its name, scopes, sites and organisation. A good first call.
Answer
{
"data": {
"key": {
"name": "Payroll export",
"prefix": "mlk_3f9a1c2e",
"scopes": [
"reports:read"
],
"sites": null
},
"organisation": {
"id": 12,
"plan": "premium_plus"
}
}
}/sitesThe sites the key can reach.
Answer
{
"data": [
{
"id": 21,
"name": "Head office",
"timezone": "Africa/Bamako",
"city": "Bamako",
"synced": true
}
]
}/sites/{site}/doorsThe doors of a site.
Answer
{
"data": [
{
"id": "1104…0041.output.1",
"name": "Main entrance",
"device_serial": "1104…0041",
"open_seconds": 5
}
]
}/sites/{site}/doors/{door}/opendoors:openOpens a door for its usual time. The answer 202 means the order was sent; the opening then shows in the events, type remote.
Answer
{
"data": {
"door": "1104…0041.output.1",
"request_id": "6f1c…",
"status": "sent"
}
}People
/sites/{site}/peoplepeople:readThe people of a site, page by page.
q- Search in name, card number and email.
group- Only the people of this group.
page, per_page- Page from 1, and 1 to 200 items per page (default 50).
Answer
{
"data": [
{
"id": "6ac1…de",
"card_number": "3664241488",
"first_name": "Fatou",
"last_name": "Kamissoko",
"company": "ACME",
"groups": [
"Staff"
],
"active": true,
"last_seen": {
"at": "2026-12-04T08:02:11Z",
"reader": "Main entrance"
}
}
],
"pagination": {
"page": 1,
"per_page": 50,
"total": 132,
"total_pages": 3
}
}/sites/{site}/people/{person}people:readOne person, by id.
/sites/{site}/people/card/{card_number}people:readOne person, by card number. Every call on /people/{person} also works with /people/card/{card_number}: handy when your software knows the badge, not our id.
/sites/{site}/peoplepeople:writeAdds a person. Required: first_name, last_name, and card_number or ble_tag_address. Also: email, company (created if new), groups, active, start_date, end_date. The devices of the site get the person within seconds.
Body
{
"first_name": "Moussa",
"last_name": "Diallo",
"card_number": "0004521887",
"company": "ACME",
"groups": [
"Staff"
],
"end_date": "2027-06-30"
}/sites/{site}/people/card/{card_number}people:writeChanges only the fields sent (or use /people/{person}). Turn someone off with {"active": false}: they keep their card and groups. groups replaces their groups. The card number cannot change.
Body
{
"active": false,
"groups": [
"Staff",
"Night shift"
]
}/sites/{site}/people/card/{card_number}people:writeRemoves the person from the site and its devices: their card stops working. Answer 204, no body. To stop access for a while, turn them off instead.
Groups
/sites/{site}/groupspeople:readThe groups of a site. A person's groups decide which doors they may open, and when.
Answer
{
"data": [
{
"id": "6ac1…f4",
"name": "Staff",
"color": "#1554B5",
"description": null,
"managed_by_organisation": false
}
]
}/sites/{site}/groupspeople:writeAdds a group. Required: name. Also: color (#RRGGBB, one is chosen if not sent) and description. Then give it access in the Manager (Access policies), and put people in it with their groups.
Body
{
"name": "Contractors",
"color": "#F7941D",
"description": "Outside companies"
}/sites/{site}/groups/{group}people:writeChanges only the fields sent: name, color, description. A renamed group keeps its people and its access.
Body
{
"name": "Contractors 2027"
}/sites/{site}/groups/{group}people:writeRemoves the group. Its people stay, without this group and the access it gave them. Answer 204, no body.
Activity
/sites/{site}/eventsevents:readAccess events, newest first: badges, buttons, remote openings, Geo, schedules.
from, to- ISO 8601 date or time. A date alone is a whole day in the site's time zone. Default: the last 7 days. 92 days at most.
card_number- Only this person.
door- Only this door id.
result- granted or denied.
page, per_page- Page from 1, and 1 to 200 items per page (default 50).
format- json (default), csv or xlsx (Excel).
Answer
{
"data": [
{
"id": 13269925,
"time": "2026-12-04T08:02:11Z",
"type": "card",
"result": "granted",
"direction": "in",
"person": {
"card_number": "3664241488",
"first_name": "Fatou",
"last_name": "Kamissoko",
"company": "ACME",
"groups": [
"Staff"
]
},
"door": {
"id": "1104…0041.output.1",
"name": "Main entrance"
},
"zone": "Building A"
}
],
"pagination": {
"page": 1,
"per_page": 50,
"total": 812,
"total_pages": 17
}
}/sites/{site}/presenceevents:readWho is on site now: people seen entering a zone in the last 24 hours, with no exit since.
Answer
{
"count": 1,
"data": [
{
"card_number": "3664241488",
"first_name": "Fatou",
"last_name": "Kamissoko",
"company": "ACME",
"zone": "Building A",
"since": "2026-12-04T08:02:11Z",
"source": "reader"
}
]
}Reports
/sites/{site}/reports/timesheetsreports:readOne row per person and day, in the site's time zone: first and last time seen (badge readers and Geo), the time between them, the time spent in zones and the number of events. Ready for payroll.
from, to- ISO 8601 date or time. A date alone is a whole day in the site's time zone. Default: the last 7 days. 92 days at most.
card_number- Only this person.
format- json (default), csv or xlsx (Excel).
Answer
{
"timezone": "Africa/Bamako",
"data": [
{
"date": "2026-12-04",
"card_number": "3664241488",
"first_name": "Fatou",
"last_name": "Kamissoko",
"company": "ACME",
"first_seen": "2026-12-04T08:02:11+00:00",
"last_seen": "2026-12-04T17:31:40+00:00",
"seconds_on_site": 34169,
"seconds_in_zones": 32400,
"events": 6
}
]
}/sites/{site}/reports/most-activereports:readThe people with the most granted events over the period.
from, to- ISO 8601 date or time. A date alone is a whole day in the site's time zone. Default: the last 7 days. 92 days at most.
limit- How many people, 1 to 100 (default 10).
format- json (default), csv or xlsx (Excel).
Answer
{
"data": [
{
"rank": 1,
"card_number": "3664241488",
"first_name": "Fatou",
"last_name": "Kamissoko",
"company": "ACME",
"events": 148,
"days_present": 22,
"last_seen": "2026-12-04T17:31:40Z"
}
]
}CSV and Excel
Events, timesheets and most active people also come as files: add format=csv or format=xlsx. CSV files open in Excel with accents intact.
curl "https://mirialabs.com/api/v2/sites/21/reports/timesheets?from=2026-11-01&to=2026-11-30&format=xlsx" \
-H "Authorization: Bearer mlk_your_key" -o timesheets-november.xlsxOpenAPI and versions
The full description of the API, in the OpenAPI 3 standard, is at /api/v2/openapi.json. Import it into Postman, Insomnia or Swagger, or generate a client in your language.
Browse it and try every call with your key in the interactive reference.
This is version 2. We add fields and endpoints without breaking what works: your program should ignore fields it does not know. A change that breaks would come as a new version, announced in advance. Version 1 keys of each site keep working.
A question or an endpoint you need? Write to us.