Intro to APIs
Before referring to the API portion of this guide, users that might integrate via API should work with their TraceLink implementation team to help configure their system and receive the appropriate endpoints and authentication information.
The OPUS accepts all APIs through one exposed /api/events endpoint per environment using the POST HTTP method regardless of the operation being performed or the object being operated upon. This is unlike a traditional RESTful Web service, which exposes multiple endpoints where users can perform operations with HTTP methods (e.g. GET, POST, PUT, etc.). The app that handles the request and the objects affected by the request are determined based on the contents of the header section of the request body.These event-driven APIs can be used to integrate the TraceLink app with your company's internal systems (e.g. enterprise resource planning system, warehouse management system).
Request header
The request header includes the Authorization OAuth token required to authenticate and access the Serial Number Provision API.
Request body
The request body used to generate the API key and API secret includes the following header and payload elements:
- header – Contains information required to process the request:
- headerVersion – The header version. Valid value is
1. - eventName – The event associated with the API credential-generation response. Valid value is
[app-name]:[event-name]:[version](e.g.authorization-manager:generate-apiKeyCredentials:v1). - ownerId – The identifier for the company that is providing the app.
- appName – The application that owns the event (e.g.
user-admin). - dataspace – The dataspace within the environment that the request call is being made. Valid value is
default.
- headerVersion – The header version. Valid value is
- payload – Includes the contents of the request.
- data – The dataspace within the environment that the request call is being made. Valid value is
default. - description – A description used to identify the generated API credentials.
- data – The dataspace within the environment that the request call is being made. Valid value is
Request example:
{
"header": {
"headerVersion": 1,
"eventName": "authorization-manager:generate-apiKeyCredentials:v1",
"ownerId": "00000000-0000-0000-0000-000000000000",
"appName": "user-admin",
"dataspace": "default"
},
"payload": {
"data": {
"description": "description"
}
}
}
Response body
The response contains the following header and payload elements:
- header – Contains information about the API credential-generation response. This must include the following parameters:
- headerVersion – The header version. Valid value is
1. - eventName – The event associated with the API credential-generation response. Valid value is
[app-name]:[event-name]:[version](e.g.authorization-manager:generate-apiKeyCredentials-response:v1). - ownerId – The identifier for the company that is providing the app.
- isErr – Indicates whether an error occurred while processing the request.
- errCode – The response status code.
- licensePlate – The identifier associated with the request.
- headerVersion – The header version. Valid value is
- payload– Includes the contents of the request.
- apiKey – The generated API key.
- apiSecret – The generated API secret. The API key and API secret are used to obtain an OAuth token.
Response example:
{
"header": {
"headerVersion": 1,
"eventName": "authorization-manager:generate-apiKeyCredentials-response:v1",
"ownerId": "00000000-0000-0000-0000-000000000000",
"isErr": false,
"errCode": "200_OK",
"licensePlate": "zgCmz4-sj1"
},
"payload": {
"apiKey": "a9d632bd-4ee9-403b-8dad-14ecda6ef92a",
"apiSecret": "ObvyJ5RqU1k0w9QhduOGqZj360oy58pc"
}
}
Serialized Number Exchange roles determine the functions and APIs that users can access. The following table lists the available roles and their associated permissions.
| Role Name | User | Role description | Permission type | Allowed actions |
|---|---|---|---|---|
| Serialization Operator | Operator / API Integration | Business user with standard access to request serial numbers through the user interface and API. | Experience Task, API |
|
| Member – Classic Access | Operator / Services / Support |
Business user with permission to access the TraceLink-Classic window. |
Experience Task |
|
| Code | Description |
|---|---|
| 200 | OK. The request was successful. |
| Code | Description |
|---|---|
| 307 | Temporary Redirect. The client must get the requested resource at another URI with the same HTTP method that was used in the prior request. |
| Code | Description |
|---|---|
| 400 | Bad Request. The server could not understand the request due to invalid syntax. |
| 401 | Unauthorized. The client is unauthenticated, not allowed access, and should re-request credentials. |
| 403 | Forbidden. The request is valid and the client is authenticated, but the client is not allowed access rights to the content for any reason. |
| 404 | Not Found. The server cannot find the requested item. This can also mean that the endpoint is valid but the resource does not exist. |
| Code | Description |
|---|---|
| 500 | Internal Server Error. The server has encountered an unknown error. |
| 502 | Bad Gateway. The server is working as a gateway to handle the request and received an invalid response. |
| 503 | Service Unavailable. The server is not ready to handle the request. |
| 504 | Gateway Timeout. The server is acting as a gateway and cannot get a response in time. |
How to use this guide
A guidelines table contains element requirements for a message:
| Element | Type | Description | |
|---|---|---|---|
| Header |
(missing or bad snippet) The response header. |
||
| headerVersion | Integer | (missing or bad snippet)(missing or bad snippet) | |
| eventName | String | (missing or bad snippet)The fully qualified name of the event response. Valid value is [app-name]:[event-name]:[version] (e.g. authorization-manager:generate-apiKeyCredentials-response:v1). |
|
| ownerId | String | (missing or bad snippet) The identifier for the Owner company associated with the request. | |
| isErr | String |
(missing or bad snippet) Indicates whether the request was successful. Valid values:
|
|
| errCode | String |
(missing or bad snippet) The status code of the response. |
|
| errMsg | String | (missing or bad snippet) if the call is unsuccessful. The message associated with the error code ( | |
| licensePlate | String | (missing or bad snippet) The unique identifier for the message instance. | |
| Payload | – |
(missing or bad snippet) |
|
| apiKey | String |
(missing or bad snippet) The generated API key. |
|
| apiKey | String |
(missing or bad snippet)The generated API secret. |
|
This column indicates the source/element name included in the API call.
This column indicates the element's data format type (e.g. String, Integer, Boolean, Date, or Time).
This column indicates whether the element is required for the message and provides a brief description of the element, including any relevant notes (e.g. country requirements, formatting notes, etc.).
Hover over a footnote to display the data input sample for that Data Element. If using the printed version of the document, refer to the matching footnote at the bottom of the table.Class 1
Class 1 errors are Map In errors.
Class 2
Class 2 errors are data translation Processing Failed errors.
Class 3 Errors
Class 3 errors occur when data translation to a third party (i.e. the Partner receiving the message) fails due to an internal server error. Class 3 errors are rare, though they can also occur due to missing or incorrect information in master data. If a message returns a class 3 error, check master data first, add missing information or edit incorrect data, and resubmit the message. If the class 3 error continues to occur when master data is definitely correct, contact TraceLink Support.
- Navigate to the guidelines table for the message you want to export.
- Select the Download
icon. - The file downloads locally.
In the Excel output of the API Guidelines:
- When you open the file in Excel, the following dialog box might display: "The file format and extension of [file name] don't match. The file could be corrupted or unsafe. Unless you trust its source, don't open it. Do you want to open it anyway?" This message is expected. Select to open the file.
- The Occurs and Length values will be enclosed by square brackets (i.e. [1...1] or [1/20]). These brackets do not change the value of the data and are present to prevent Excel from interpreting the Occurs and Length values as dates or fractions.
API examples can be easily copied and pasted into a text editor by selecting .
- Create a blank text file and save it locally.
- Navigate to the API example that you want to copy.
- Select .
- Navigate to the first row of the saved text file, right-click, and select .
The API example's structure is maintained.
Syntax highlights will not reflect unless enabled in the file editor. There is a known issue in the documentation where the example might have extra spaces or quotation marks added if copied through a Chromium-based browser (e.g. Google Chrome, Microsoft Edge). This issue will be fixed in a future revision. For now, if this problem results in a validation error, either:
- Manually copy the example by highlighting the full text, right-clicking, and selecting .
or
- Use a non-Chromium-based browser (e.g. Mozilla Firefox, Apple Safari) to copy the example.
- Manually copy the example by highlighting the full text, right-clicking, and selecting .


