Intro to APIs
To comply with US DSCSA saleable returns requirements, companies can integrate with TraceLink through Product Information Manager and Product Information Exchange web 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.
Learn the basics about integrating with TraceLink through REST and asynchronous APIs:
REST APIs

When opting for API integration, users configure their systems to access most TraceLink resources and services pertinent to saleable returns using REST APIs. These APIs enable users to perform the primary tasks required for managing saleable returns, including verifying product, sharing master data, and configuring what information is available to business partners in the downstream supply chain.
The specific resources accessible to users differs depending on whether the user is a Producer or Consumer, but the general process is the same. To query TraceLink for information, the user's system sends a request to the appropriate TraceLink endpoint, which performs authentication and validation before locating the specified resource. The requested information is then routed back through the endpoint and returned to the customer's system, including an indication of whether the call was successful.
While Product Information Exchange and Product Information Manager are REST APIs (i.e. they exchange data in JSON format via HTTP protocol), the large amounts of data being served requires some of these APIs to process asynchronously, particularly when generating reports or submitting large records. These particular use cases include polling calls to check the status of call processing.
The context diagrams below illustrate the relevant APIs and typical flow for Producers and Consumers.

Producers can use Product Information Exchangeto integrate with Master Data Exchange and Serialized Operations Manager to sync product master data and serial number information as they go about their standard operations. Producers can also call the Product Information Exchange API to directly to manually add product records and serial number information to the TraceLink-owned network application Product Information Manager.
Consumers verify against the product records and serial number information provided by Producers to confirm the validity of products before reselling them. In addition to adding and maintaining the product information against which Consumers verify, Producers also set the rules that determine which information is returned in verification requests for their products.

Consumers configure their ERP system to call the Smart Event Manager API to verify against the product directory records and serial number information provided by Producers (Pharmaceutical Manufacturers, Repackagers) in Product Information Manager. They can also view verification histories through Product Information Exchange. The US DSCSA requires Consumers to verify that returned products are still valid, according to the Producers who manufactured the products, before these products can be resold.
Additionally, Consumers can also send requests directly to Product Information Exchange to download Producers' product master data records.

TraceLink REST APIs use Basic Authentication for secure validation of a given request, which verifies the identity of a user.

- Content-Type – The media type for the message. Valid value is
application/json
. - Authorization – The Administrator's username and password, encoded using Base64. The Administrator uses a basic token for Basic Authentication.
If the message is sent through Postman, select Basic Auth on the Authorization tab to enter the Administrator's username and password. These credentials are encrypted and added to the header.

TraceLink REST APIs use standard response codes to indicate whether an HTTP request was successful. Response status codes may include, but are not limited to, the following:

200 | OK. The request was successful. For GET, this means that the resource has been fetched. |

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

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

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. |
Asynchronous APIs

In addition to REST APIs, TraceLink accepts a variety of file formats to ensure that messages between TraceLink Owners and their Partners are exchanged seamlessly via asynchronous API. After integration is set up, when the Owner sends a message into TraceLink (targeted for a Partner) from their enterprise system, the message is sent in the Owner's preferred format. The message is translated (and stored) within TraceLink and is then reformatted into an outbound message for the Partner in their preferred file format.
For saleable returns, adding product master data using Master Data Exchange is currently the only asynchronous API used. Customers who do not own Master Data Exchange or Serialized Operations Manager do not need to set up integration via an AS2 connection. However, adding product master data using Master Data Exchange is the recommended method.

The relevant Message Type (e.g. SOM_DESTROY_EVENT) and Info Exchange Display Name (e.g. Destroy Event) are included above each Guidelines Table. The Message Type is used when setting up B2B connections. Use the Info Exchange Display Name in Info Exchange to monitor and troubleshoot messages exchanged with Partners. See the Info Exchange Online Help for additional information.
How the Message Type is used depends on the type of B2B connection:
- AS2: The Message Type is in the AS2 header (e.g. SOM_DESTROY_EVENT).
- HTTP Post: The Message Type is part of the URL (e.g. https://prodb2b.tracelink.com:5443/server?request=send&directory=inbox/SOM_DESTROY_EVENT&filename=<filename>).
- SSTP: The Message Type is the folder in which the message is saved.
In Info Exchange Profiles, the Message Type is included in the "transaction" column of the Transactional Maps CSV file.

The Errors table displays all potential errors that may be encountered for a message. In the "Description" column, the term "source" is used to refer to the specific element in question. For example, in the description for the cmn:PartnerId element below, "source" refers to cmn:ParterId itself. No value has been provided for this element, therefore triggering the error message.
Data Element | Error Message | Description |
---|---|---|
Class 1 | ||
cmn:DeliveryLocation | @type | DeliveryLocation type attribute is required when source delivery location is populated !!! | The error occurs if cmn:DeliveryLocation is populated, but the source is empty or null. |
Valid delivery location type is required !!! | The error occurs if the source is present, but there is no matching entry in the lookup file. | |
cmn:PartnerId | @type | Party type attribute is required when source partner Id is populated !!! | The error occurs if cmn:PartnerId is populated, but the source is empty or null. |
Valid partner identifier type is required !!! | The error occurs if the source is present, but there is no matching entry in the lookup file. | |
cmn:DeliveryDirection | Delivery direction of Sent or Received is required !!! | The error occurs if the source is empty or null. |
cmn:PartnerId | Partner identifier is required for delivery direction Received !!! | The error occurs if DeliveryDirection = Received , but the source is empty or null. |
Class 2 | ||
cmn:DeliveryNumber | Delivery [Delivery Number]: Shipment transaction for specified delivery number must be a sales shipment. Transfer shipment may not be voided. | The error occurs if the source refers to a transfer shipment instead of a sales shipment. |
Delivery [Delivery Number]: Shipment transaction for specified delivery number has not been submitted. | The error occurs if the source does not refer to a shipment in a submitted state. | |
Delivery [Delivery Number]: The serial numbers for the specified deliver must be in a Commissioned - Shipped state. | The error occurs if serial numbers are not in a Commissioned - Shipped state. | |
Class 3 | ||
The following is thrown for all Class 3 errors: “INTERNALERROR=Internal error from server [server details].” Please contact Support if this error is encountered. |
How to use this guide

A Guidelines Table contains field/element requirements for a message:
Data Element | Occurs Length |
Format | Description | |||||
---|---|---|---|---|---|---|---|---|
som:SOMVoidShipment | 1…1 - |
- | Required. Root element of message. | |||||
som:ControlFileHeader | 1…1 - |
- | Required. XML file control header record. | |||||
cmn:FileSenderNumber | 1…1 1/20 |
String | Required. File sender's company identifier.1 | |||||
cmn:FileReceiverNumber | 1…1 1/20 |
String | Required. File recipient's company identifier.2 | |||||
cmn:FileControlNumber | 1…1 1/* |
String | Required. Unique file control ID number.3 | |||||
cmn:FileDate | 1…1 1/* |
Date | Required. Date file generated in XML YYYY-MM-DD format.4 | |||||
cmn:FileTime | 1…1 1/* |
Time | Required. Time file generated in XML HH:MM:SSZ format.5 | |||||
som:MessageBody | 1…1 - |
- | Required. Main body of message. | |||||
cmn:DeliveryLocation | 0…1 0/* |
String | Specifies identifier of facility or warehouse to scope the Sales Shipment Status update for the serial numbers matching the specified item code and lot number only at the specified location. If the location is omitted, the Sales Shipment status update will be applied globally to all matching serial numbers in the system.6 | |||||
@type | 1…1 1/1 |
String | Conditionally required if cmn:DeliveryLocation is present. Location identifier type.7 See the LocationId enumeration list for valid values. |

This column indicates the source/element name included in the API call.

This column indicates the minimum and maximum amount of times that the particular element can occur within the API call (note that repeating elements are indicated in the "Description" column). In the example above, the urn:serialNumbersRequest element must occur a minimum of once and can only occur up to once for the maximum occurrence as indicated by the "1...1". If "*" is indicated, the element has an unbounded maximum occurrence.

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


- Navigate to a message in the appropriate API Guide and open the Guidelines table.
- Click the Download icon (
).
- The file downloads locally.
In the Excel output of the API Guidelines:
- Upon opening the downloaded file in Excel, a dialog box may appear that reads "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. Click "Yes" 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.
-
The footnote data input sample is located in the data element description. Format is *[footnote number] †[footnote content]. The two footnote character symbols do not change the value of the data and are present to visually separate the footnote number from the footnote content.

Sample requests and responses, where relevant, are provided for each message.
Below is a Download Product Master Data Request example:
{ "t": { "v": 1, "m": "pie--consumer-download-mds--v1", "app-id": "393C3176-6F7C-438D-B06F-DDCDA21C2E5C" }, "p": { "records": [ { "packagingCode": "10312345678910", "packagingCodeType": "GTIN-14" }, { "packagingCode": "00312345678913", "packagingCodeType": "GTIN-14" } ] } }

Message examples can be easily copied and pasted into a text editor by selecting the Copy to Clipboard icon ().
- Create a blank text file and it save locally.
- Navigate to the message sample within the appropriate API Guide.
- Select the Copy to Clipboard icon (
).
The Copied to Clipboard icon (
) displays for 2 seconds, indicating that the copy is successful.
- Navigate to the first row of the saved text file and select Paste.
The message example's structure is maintained.
Syntax highlights will not reflect unless enabled in the file editor.