Eyelit MES offers integration with third-party applications through the use of a Public API. A series of endpoints are exposed and can be called by an external system (normally a middleware provider) to make changes directly within a given instance of the Eyelit software. The calls to these endpoints are done through the use of pre-formatted JSON packets and are authorised through OAuth 2.0.
- The method used by Eyelit MES is OAuth 2.0 – Password and Username.
- A call to [environment].mestec.net/Token is needed to create the access token. This token has a lifespan of 5 hours.
- The username and password required are that of an Eyelit user account within the target environment.
- This user account must be appropriately licensed and have the correct roles to carry out any transactions attempted by the endpoints.
- Management of this user account is the customer's responsibility.
Multi-site Access
A single public API endpoint routes requests to the appropriate site based on a Site ID provided in the payload with a tenant specified in the parameters that identifies the site applicable to the call. This enables multi-site integrations while keeping a single base URL for all environments.
Authorisation
The Eyelit MES API uses bearer token authentication. You generate an access token with your tenant identifier and MES user credentials, then send that token with each API request.
Make sure that you have the following:
- Your tenant identifier. The tenant identifier uses the format
<environment>-mes, where<environment>is the name of your MES environment. For example, if your environment isdev1050, your tenant identifier isdev1050-mes.

- An MES username and password. Use the credentials of the MES user that your integration runs as. The token grants the same access as that user.
Generate an access token
- Open the Swagger docs for your MES environment via the Integration Management -> Public API Documentation.
- Select an API documentation version to open the Swagger documentation.
- Scroll to the top of the page and select Authorize and expand the token endpoint.
- Click Try it out. The fields become editable.
- In the tenant identifier field, enter your tenant identifier. For example,
dev2050-mes. - Make sure that the grant type is set to
password. This value is populated by default. - Enter the username and password of your MES user.
- Click Execute.
- In the response body, copy the
access_token. You need this value in the next procedure.
- The response also includes an
expires_invalue, of18000seconds (5 hours). This value shows how long the token remains valid.
Authorize your requests and call an endpoint
You authorise once at the top of the Swagger docs. The token is valid for 5 hours and applies to every endpoint that your MES user can access.
- Scroll to the top of the Swagger docs and click the Authorize button, or click the lock located to the right of the endpoint to display the Available authorizations pop-up. The lock is black when you have already authorized and grey when authorisation is required.
- In the Value field, paste the access token that you copied.
- Click Authorize, and then close the pop-up.
- Go to the endpoint that you want to call and expand it.
- Click Try it out.
- Enter the request values. For endpoints that need a request body, you can copy the example request body and edit the values.
- Click Execute. The response is displayed under the request.
Request Parameters
After authorisation, you can make calls to Eyelit MES endpoints. Every API call requires a standard set of request parameters in addition to the parameters that may be required for the call.
You need to specify the tenant and the minor version for the major version of the API. You could provide these as part of the header URL, or as part of the SQL query. Both header and query options are supported, but just one is required.


