API overview
Almost every action in the Miridia portal is also available through the API. Use the API to connect a system to Miridia, to import data, or to build your own automation.
Two APIs
Miridia has two REST APIs. Each API has its own host.
| API | Host | What it does |
|---|---|---|
| Global API | https://global.miridia.io | Your identity and your account: login, organisations, API keys, subscriptions, and support tickets. |
| Core API | https://api.miridia.io | The data of your business: products, prices, locations, inventory, purchase orders, transfer orders, production, orders, customers, workflows, and insights. |
The Global API issues the token. The Core API accepts that token and serves the data of your organisation.
How a request finds your data
Each request to the Core API must answer two questions: which organisation, and which business.
- The organisation comes from the credential. A token or an API key belongs to one organisation. Miridia keeps the data of each organisation separate. A credential can never read the data of a different organisation.
- The business comes from the
X-Business-Idheader. Send the id of the business in this header on each request. Miridia makes sure that the user is a member of that business. An API key that names a business does not need the header.
A few operations do not need a business, for example GET /api/me. The reference tells you when the header is not necessary.
The reference
Each page of the reference covers one resource. Each operation shows:
- The method and the path.
- The access rule: which permission the caller needs.
- The parameters and the request body, with each field.
- The response envelope, and a link to each model on the page.
- A
curlexample and an example response.
Versions
Most Core API paths include a version segment, for example /api/v1/purchase-orders. The segment lets Miridia add a new version of an operation next to the current version. Some older paths have no version segment, for example /api/business.
OpenAPI documents
The reference comes from the OpenAPI documents of the two APIs. Download them to generate a client, or to import the APIs into a tool such as Postman.