Skip to content
Mirialabs
Developers

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).

  1. In the Manager, open the organisation, then Organisation › API keys, and make a key. Give it only the access it needs.
  2. Copy the key: it is shown only once. Keep it on your server, never in a web page or a mobile app.
  3. Make your first call:
cURL
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.

ScopeAllows
people:readRead people and groups
people:writeAdd, change and delete people and groups
events:readRead access events and who is on site
reports:readRead reports: timesheets, most active people
doors:openOpen 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.
JSON
{
  "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):

JSON
{"error": {"code": "missing_scope", "message": "This key does not have the people:write scope."}}
StatusCodeWhen
401unauthorizedNo key, or an unknown, revoked or expired key.
403plan_requiredThe organisation is not on Premium+ any more. The key works again on Premium+.
403missing_scopeThe key does not have the scope this call needs.
403plan_limitThe plan's people limit is reached.
404not_foundUnknown site, person, group or door, or a site the key may not reach.
409conflictA person with this card, or a group with this name, is already on the site.
409site_not_syncedThe site still runs in the older device-by-device mode: contact us to switch it to cloud sync.
409managed_by_organisationThe person or group is managed for the whole organisation: change it in the Manager.
409device_offlineThe door's controller is offline.
422invalidA field is missing or wrong: the message says which.
429rate_limitedToo many calls: wait for the time given in Retry-After.
502not_saved / not_openedThe 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

GET/me

The key: its name, scopes, sites and organisation. A good first call.

Answer

JSON
{
  "data": {
    "key": {
      "name": "Payroll export",
      "prefix": "mlk_3f9a1c2e",
      "scopes": [
        "reports:read"
      ],
      "sites": null
    },
    "organisation": {
      "id": 12,
      "plan": "premium_plus"
    }
  }
}
GET/sites

The sites the key can reach.

Answer

JSON
{
  "data": [
    {
      "id": 21,
      "name": "Head office",
      "timezone": "Africa/Bamako",
      "city": "Bamako",
      "synced": true
    }
  ]
}
GET/sites/{site}/doors

The doors of a site.

Answer

JSON
{
  "data": [
    {
      "id": "1104…0041.output.1",
      "name": "Main entrance",
      "device_serial": "1104…0041",
      "open_seconds": 5
    }
  ]
}
POST/sites/{site}/doors/{door}/opendoors:open

Opens a door for its usual time. The answer 202 means the order was sent; the opening then shows in the events, type remote.

Answer

JSON
{
  "data": {
    "door": "1104…0041.output.1",
    "request_id": "6f1c…",
    "status": "sent"
  }
}

People

GET/sites/{site}/peoplepeople:read

The 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

JSON
{
  "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
  }
}
GET/sites/{site}/people/{person}people:read

One person, by id.

GET/sites/{site}/people/card/{card_number}people:read

One 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.

POST/sites/{site}/peoplepeople:write

Adds 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

JSON
{
  "first_name": "Moussa",
  "last_name": "Diallo",
  "card_number": "0004521887",
  "company": "ACME",
  "groups": [
    "Staff"
  ],
  "end_date": "2027-06-30"
}
PATCH/sites/{site}/people/card/{card_number}people:write

Changes 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

JSON
{
  "active": false,
  "groups": [
    "Staff",
    "Night shift"
  ]
}
DELETE/sites/{site}/people/card/{card_number}people:write

Removes 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

GET/sites/{site}/groupspeople:read

The groups of a site. A person's groups decide which doors they may open, and when.

Answer

JSON
{
  "data": [
    {
      "id": "6ac1…f4",
      "name": "Staff",
      "color": "#1554B5",
      "description": null,
      "managed_by_organisation": false
    }
  ]
}
POST/sites/{site}/groupspeople:write

Adds 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

JSON
{
  "name": "Contractors",
  "color": "#F7941D",
  "description": "Outside companies"
}
PATCH/sites/{site}/groups/{group}people:write

Changes only the fields sent: name, color, description. A renamed group keeps its people and its access.

Body

JSON
{
  "name": "Contractors 2027"
}
DELETE/sites/{site}/groups/{group}people:write

Removes the group. Its people stay, without this group and the access it gave them. Answer 204, no body.

Activity

GET/sites/{site}/eventsevents:read

Access 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

JSON
{
  "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
  }
}
GET/sites/{site}/presenceevents:read

Who is on site now: people seen entering a zone in the last 24 hours, with no exit since.

Answer

JSON
{
  "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

GET/sites/{site}/reports/timesheetsreports:read

One 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

JSON
{
  "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
    }
  ]
}
GET/sites/{site}/reports/most-activereports:read

The 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

JSON
{
  "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
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.xlsx

OpenAPI 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.