EFiling API Specifications V2
EFiling API Specifications V2
1 of 22
Date: 08-02-2024
eFiling API Specifications
Version/Revision Log
2 of 22
Date: 08-02-2024
eFiling API Specifications
Contents
Overview ....................................................................................................................................... 4
Access ........................................................................................................................................... 4
Errors ............................................................................................................................................ 4
Endpoints ...................................................................................................................................... 5
Data Format .................................................................................................................................. 5
Endpoint Details ............................................................................................................................ 6
getCollections (GET) .............................................................................................................................. 6
import (POST) ........................................................................................................................................ 7
getImportStatus (GET) .......................................................................................................................... 8
getImportLog (GET) ............................................................................................................................... 9
export (GET) ........................................................................................................................................ 10
getCertificates (POST) ......................................................................................................................... 11
getTradeParties (GET) ......................................................................................................................... 12
getTokenExpiration (GET) ................................................................................................................... 13
Data Formatting Samples ............................................................................................................ 14
coreProduct Module ........................................................................................................................... 14
Directives Module ............................................................................................................................... 16
Product Metadata Module ................................................................................................................. 17
Validations Module ............................................................................................................................. 17
Business Account List & Trade Party List Modules ............................................................................. 17
Definitions of User-Provided Fields ............................................................................................. 18
All Fields in coreProduct ..................................................................................................................... 18
All Fields in Directives ......................................................................................................................... 20
Sample JSON Payload for Upload to the /import Endpoint ......................................................... 21
3 of 22
Date: 08-02-2024
eFiling API Specifications
Overview
The eFiling API allows developers to integrate with CPSC’s Product Registry so that product certificate
data can easily be provided from third-party software, to better facilitate the collection of product
certificate data to ensure compliance with applicable laws.
Software developers handling integration with the eFiling API will be required to create accounts within
the Product Registry to facilitate integration testing. Software development accounts will enable users
to establish development/test product collections, add placeholder product certificate information,
send collaboration invitations to development team members, and access an API Portal to assist with
development. These accounts should not be used to store real certificate of compliance data.
Access
All eFiling APIs require an API token to be supplied for a valid eFiling user. To retrieve the token, the user
will login to the Product Registry portal, where they will be able to generate an API token that will
permit interaction with any Product Collections that the user is a member of. NOTE: This token grants all
equivalent accesses of the user account for which it was generated, and any changes made through the
API will directly affect the resources specified through API parameters that the user has access to. All
development activities should be done against Software Developer accounts and NOT actual importer
Business Accounts.
When development of APIs is complete, the integration will allow normal users to provide their API
tokens and secrets, which will then be passed through the API request headers as described below. This
token will allow the integrated system to act on behalf of that user in accessing and updating data that
the user has previously been granted access to. These tokens expire regularly, and the user will be
required to generate a new token for continued access to eFiling resources through the API. An API
endpoint is provided to check that the current token is still valid and return its expiration date.
The eFiling API will reside under the efiling.saferproducts.gov domain at the path /efiling/api, followed
by the specific endpoint being called.
Errors
All APIs will return 401 or 403 access errors for invalid/expired tokens and user requests to
access/update data for which they have not been granted access.
If, during development, you receive a “null” response error, it most likely means that there was an issue
with your call for which proper error handling has not yet been configured. It is important to note that
null errors are not always an indication that no data was ingested by the Product Registry, and as such,
subsequent attempts to pass the same data via the API may result in Version ID error responses. In such
instances, please reach out to the eFiling support team at [email protected] and provide a copy
of the call/payload that was sent.
A more detailed list of error response messages that will be returned from the API under various
circumstances will be added to a future iteration of this document.
4 of 22
Date: 08-02-2024
eFiling API Specifications
Endpoints
• getCollections (GET) • export (GET)
• import (POST) • getCertificates (POST)
• getImportStatus (GET) • getTradeParties (GET)
• getImportLog (GET) • getTokenExpiration (GET)
All endpoints will only be accessible to authorized users. Each call must pass both a JSON Web Token (JWT)
and its corresponding Secret in order to be validated. The JWT will be passed as a “Authorization: <JWT>”
header and the secret will be passed as a “x-api-secret: <secret>” header.
An overview of the basic data structures that will be used to send and retrieve data from the API can be
found below, followed by a detailed description of each available endpoint, including parameters that the
endpoint will accept and sample responses.
Data Format
The JSON data that gets sent to and from the eFiling Product Registry API has been organized into "modules"
to minimize the amount of structural modification necessary for the different endpoint calls.
The largest module, coreProduct, is sent/returned inside a productList object and contains all of the data
fields that represent a single, valid product certificate.
The table below details the parameter and module requirements for each endpoint. Formatting examples for
modules can be found in the Data Formatting Samples section of this document. The correct ordering of the
modules can be found in the sections detailing each individual endpoint.
JSON Modules in
Endpoint Parameters JSON Modules in Response
Request Body
getCollections None -- businessAccountList
• Certifier ID coreProduct,
import* --
• Collection ID directives
getImportStatus • Import ID -- --
• Import ID
coreProduct, directives,
getImportLog* • "Errors Only" flag --
validations
(optional)
• Certifier ID
export* • Collection ID -- coreProduct, productMetadata
• Filters (optional)
• Certifier ID Array of Product
getCertificates* coreProduct, productMetadata
• Collection ID ID/Version tuples
• Certifier ID
getTradeParties • Trade party type -- tradePartyList
(optional)
getTokenExpiration None -- --
*Data modules sent and received from these endpoints will be contained within the "productList" JSON
object (see example at the end of the document).
5 of 22
Date: 08-02-2024
eFiling API Specifications
Endpoint Details
getCollections (GET)
Description: Returns a list of Product Collections that the provided token can access.
Headers
• Authorization: <JWT>
• x-api-secret: <secret>
Parameters
• No parameters required; response is based on provided JWT
Response
• JSON list of Collection Information (will include Business Account information as well)
• Status Code
• Status Message
• Business Account List, including accessible collection names and user role(s)
Response Sample
{
"statusCode": "200",
"statusMessage": "OK",
"businessAccountList": [{
"certifierId": "example-company",
"companyName": "Example Company",
"collectionList": [{
"collectionId": "1234-5678-90987",
"collectionName": "API Demo",
"userRole": ["Collection Editor"]}, {
"collectionId": "3456-7890-12345",
"collectionName": "Another Collection",
"userRole": ["Collection Administrator", "Certifier"]
}],
},{
"certifierId": "company-two",
"companyName": "Company Two",
"collectionList": [{
"collectionId": "9876-7654-65432",
"collectionName": "Furniture",
"userRole": ["Collection Editor", "Certifier"]
}]
}]
}
6 of 22
Date: 08-02-2024
eFiling API Specifications
import (POST)
Description: Used to import Certificate of Compliance data from the accompanying JSON payload into
the specified eFiling Product Collection. This import process can be used to add new certificates or
update existing certificates. Updating existing certificate data or adding new trade parties to a Business
Account is accomplished through the "directives" module that follows the coreProduct module. A
sample JSON payload is available at the end of this document.
Headers
• Authorization: <JWT>
• x-api-secret: <secret>
Parameters
• Certifier ID (String – Required), Key: certifierId
• Collection ID (String – Required), Key: collectionId
Request Body
• Product certificate set (JSON)
o List of coreProduct/directive module pairs within a productList object (full example here)
Response
• Status Code
• Status Message
• Import ID
• Import Status (“Attempting to upload” if successful; "Upload failed" if unsuccessful)
Response Sample
{
"statusCode": "200",
"statusMessage": "OK",
"importId": "12345678-1234-4321-1234-123456789098",
"importStatus": "Attempting to upload."
}
7 of 22
Date: 08-02-2024
eFiling API Specifications
getImportStatus (GET)
Description: Depending on the quantity of data being uploaded, calls to /import can take substantial
time to process. Because of this, the /getImportStatus endpoint can be used to check the progress of an
upload, returning both a percentage complete as well as a status message.
Headers
• Authorization: <JWT>
• Secret: <secret>
Parameters
• Import ID (String – Required), Key: importId
Response
• Status Code
• Status Message
• Percentage Complete
• State ("Uploading…" if still in progress; "Complete" if finished; "Failed" if finished
unsuccessfully)
Response Sample
{
"statusCode": "200",
"statusMessage": "OK",
"percentComplete": "44",
"importStatus": "Uploading…"
}
8 of 22
Date: 08-02-2024
eFiling API Specifications
getImportLog (GET)
Description: Used to retrieve a detailed summary of a specific import event. It is recommended that
users poll getImportStatus until a status of “Complete” is returned before attempting to retrieve an
import log from this endpoint.
Headers
• Authorization: <JWT>
• x-api-secret: <secret>
Parameters
• Import ID (String – Required), Key: importId
• Errors Only flag (Boolean – Optional) (true for only error rows or false for all rows; defaults
to false if not provided), Key: errorsOnly
Response
• Status Code
• Status Message
• Response data will be wrapped in a productList object, containing:
All data provided via coreProduct modules during upload will be returned
All data provided via directives modules during upload will be returned
Additional validations module will be returned that includes any error messages
generated by the upload
Response Sample
{
"statusCode": "200",
"statusMessage": "OK",
"productList": [{
"coreProduct": {
Module data },
"directives": {
Module data },
"validations": {
Module data }
},{
"coreProduct": {
Module data },
"directives": {
Module data },
"validations": {
Module data }
}
]
}
9 of 22
Date: 08-02-2024
eFiling API Specifications
export (GET)
Description: Used to retrieve certificate data from a specific Product Collection. Parameters can be
passed with the request to filter the certificates returned to various subsets.
Headers
• Authorization: <JWT>
• x-api-secret: <secret>
Parameters
• Certifier ID (String – Required), Key: certifierId
• Collection ID (String – Required), Key: collectionId
• Optional Filters:
o Type of Date (String of "Last Test Date", "Manufacture Date", "Production Start Date",
or "Create Date" – Optional), Key: typeOfDate
o Date range start (String in date format MM/DD/CCYY – Optional unless "Type of Date"
provided), Key: startDate
o Date range end (String in date format MM/DD/CCYY – Optional unless "Type of Date"
provided), Key: endDate
o Status filter (String of "Complete", "Incomplete" or "Awaiting Certification – Optional; if
not provided, defaults to "All"), Key: status
o Visibility filter (String of "Visible", "Archived" or "Both"—Optional; if not provided,
defaults to "Visible"), Key: visibility
o Search term (String – Optional), Key: searchTerm
o Search on Field (String of "All", "Product ID", "Product Name", "Trade/Brand Name",
"Manufacturer Name" or "Lot Number" – Optional; if not provided, defaults to "All"),
Key: searchOnField
Response
• Status Code
• Status Message
• List of coreProduct/productMetadata module pairs inside a productList object that match
specified filter criteria (if provided).
Most current data for the certificate will be returned via coreProduct module
Certificate metadata will be returned via productMetadata module
Response Sample
{
"statusCode": "200",
"statusMessage": "OK",
"productList": [{
"coreProduct": {
Module data },
"productMetadata": {
Module data }
}]
}
10 of 22
Date: 08-02-2024
eFiling API Specifications
getCertificates (POST)
Description: Used to retrieve the data associated with one or more specific product certificates. If no
version ID is provided, all completed certificate versions for a provided Product ID will be returned along
with the most recent, or "latest", version (even if that version is not complete yet).
Headers
• Authorization: <JWT>
• x-api-secret: <secret>
Parameters
• Certifier ID (String – Required), Key: certifierId
• Collection ID (String – Required), Key: collectionId
• List of Product ID, Version tuples (JSON String in request body)
o Example:
[{
"productId": "34343",
"version": ""
},{
"productId": "ES221",
"version": "221-v1"}]
Response
• Status Code
• Status Message
• List of coreProduct/productMetadata module pairs inside a productList object.
• Data for each certificate based on specified version (if version ID is provided) returned
via list of coreProduct/productMetadata modules inside productList object
• Data for all completed versions of certificates for a specified Product ID will be
returned if no version is specified
• Along with all completed versions, the most recent, or "latest" certificate associated
with a Product ID will be returned. The status of this version will be identified in its
corresponding productMetadata module.
Response Sample
{
"statusCode": "200",
"statusMessage": "OK",
"productList": [{
"coreProduct": {
Module data },
"productMetadata": {
Module data }
}, {
"coreProduct": {
Module data },
"productMetadata": {
Module data }
}
]
}
11 of 22
Date: 08-02-2024
eFiling API Specifications
getTradeParties (GET)
Description: Returns a list of trade parties associated with the Business Account that owns a specific
Product Collection.
Headers
• Authorization: <JWT>
• x-api-secret: <secret>
Parameters
• Certifier ID (String – Required), Key: certifierId
• Trade Party Type (String of “All”, “Manufacturer”, “Laboratory” or “Point of Contact” –
Optional), Key: tradePartyType
Response
• Status Code
• Status Message
• JSON list of trade parties and their data
Response Sample
{
"statusCode": "200",
"statusMessage": "OK",
"tradePartyList": [{
"name": "FurnitureCo",
"gln": "0000000000001",
"alternateId": "",
"tradePartyType": "manufacturer",
"sbmId": "",
"addressLine1": "1 Main Street",
"addressLine2": "",
"aptNumber": "",
"city": "Alexandria",
"stateProvince": "VA",
"country": "USA",
"postalCode": "22311",
"phone": "555-123-4567",
"website": "www.example-company.com",
"email": "[email protected]"
},{
"name": "Example Lab",
"gln": "",
"alternateId": "example-lab",
"tradePartyType": "laboratory",
"addressLine1": "26 Side Street",
"addressLine2": "",
"aptNumber": "",
"city": "Alexandria",
"stateProvince": "VA",
"country": "USA",
"postalCode": "22311",
"phone": "+1 555-555-5555",
"website": "www.sample-website.com",
"email": "[email protected]"
}]
}
12 of 22
Date: 08-02-2024
eFiling API Specifications
getTokenExpiration (GET)
Description: Returns the expiration date and time of the API token that made the call.
Headers
• Authorization: <JWT>
• x-api-secret: <secret>
Parameters
• No parameters required
Response
• Status Code
• Status Message
• A single key-value pair containing a date-time string
Response Sample
{
"statusCode": "200",
"statusMessage": "OK",
"tokenExpiration": “2023-12-31 23:59:59.1234567 +00:00"
}
13 of 22
Date: 08-02-2024
eFiling API Specifications
coreProduct Module
This module contains all the mandatory, contingent, and optional fields that can comprise a single, valid
product certificate.
"coreProduct": {
"versionId": "B22-78782",
"primaryProductId": "34343",
"primaryProductIdType": "GTIN",
"identifiers": [{
"identifier": "",
"identType": "GTIN"}, {
"identifier": "",
"identType": "UPC"}, {
"identifier": "",
"identType": "SKU"}, {
"identifier": "",
"identType": "Model #"}, {
"identifier": "",
"identType": "Serial #"}, {
"identifier": "",
"identType": "Registered #"}, {
"identifier": "",
"identType": "Alternate ID"}],
"certificateType": "CPC",
"name": "Coffee table",
"tradeBrandName": "FurnitureCo",
"description": "Black coffee table, square",
"color": "Black",
"style": "Modern",
"manufacturer": {
"gln":"",
"alternateId": "fake-manufacturing",
"sbmId":"",
"name": "Fake Manufacturing Ltd.",
"addressLine1": "123 Example Rd.",
"addressLine2": "",
"aptNumber": "#222",
"city": "Arlington",
"stateProvince": "Virginia",
"country": "USA",
"postalCode": "20598",
14 of 22
Date: 08-02-2024
eFiling API Specifications
"phone": "555-234-5678",
"email": "[email protected]"},
"manufactureDate": "03/2020",
"productionStartDate": "03/20/2020",
"productionEndDate": "03/22/2020",
"lotNumber": "",
"lotNumberAssignedBy": "",
"lastTestDate": "04/27/2020",
"labs": [{
"type": "ITL",
"cpscId": "34636",
"gln": "",
"alternateId": "",
"name": "",
"addressLine1": "",
"addressLine2": "",
"aptNumber": "",
"city": "",
"stateProvince": "",
"country": "",
"postalCode": "",
"phone": "",
"email": "",
"citationCodes": ["1203C", "2304S", "3421D"],
"testReportId": "1234-55567",
"testURL": "www.lab1.com/tests/0187652",
"testReportAccessKey": ""},{
"type": "LAB",
"cpscId": "",
"gln": "",
"alternateId": "lab-two",
"name": "Lab Two, Inc.",
"addressLine1": "456 Placeholder Lane",
"addressLine2": "",
"aptNumber": "Ste. 42",
"city": "Los Angeles",
"stateProvince": "CA",
"country": "USA",
"postalCode": "90001",
"phone": "555-555-5555",
"email": "[email protected]",
"citationCodes": ["1201", "1202", "1207"],
"testReportId": "1234-4567",
"testURL": "www.lab-two.com/test-reports/1234567",
"testReportAccessKey": ""}],
"exemptions": ["1500.91(d)(5)", "1610.1(d)(1)"],
"poc": {
15 of 22
Date: 08-02-2024
eFiling API Specifications
"type": "Laboratory",
"gln": "",
"alternateId": "",
"name": "",
"addressLine1": " ",
"addressLine2": "",
"aptNumber": "",
"city": "",
"stateProvince": "",
"country": "",
"postalCode": "",
"phone": "",
"email": ""}
}
Directives Module
This module must follow each coreProduct module sent to the /import endpoint and will also be
returned from calls to /getImportLog. It is used to indicate when a product certificate is being updated—
as opposed to being added for the first time—and is also how a user indicates that a trade party
(manufacturer, laboratory or point of contact) is being used for the first time and should be added to the
Business Account that owns the destination Product Collection.
"directives": {
"productUpdate": "Y",
"versionIdToUpdate": "B6278-2",
"manufacturer": {
"isNew": "Y",
"gln": "",
"alternateId": "thompson-ltd"},
"labs": [{
"isNew": "N",
"gln": "",
"alternateId": "lab-two"}],
"poc": {
"isNew": "Y",
"gln": "",
"alternateId": "jane-doe"}
}
16 of 22
Date: 08-02-2024
eFiling API Specifications
"productMetadata": {
"isLatestVersion": "Y",
"status": "Incomplete",
"isArchived": "N",
"completedVersions": ["3634", "444", "44TY4"]
}
Validations Module
This module is returned to users as part of the response sent back from calls to the /getImportLog
endpoint. It contains information about error messages that may have been triggered during an attempt
to upload certificate data. (Note: the error codes and messages in the sample below are for
demonstration purposes only. A comprehensive list of error codes will be included in a later version of
this document.)
"validations": {
"importedInd": "N",
"errorDetectedInd": "Y",
"errors": [{
"errorCode": "600",
"errorMessage": "The Phone Number for the Manufacturer is invalid."}, {
"errorCode": "610",
"errorMessage": "The City for the Manufacturer is invalid."}
]
}
17 of 22
Date: 08-02-2024
eFiling API Specifications
manufacturer
18 of 22
Date: 08-02-2024
eFiling API Specifications
labs
poc
19 of 22
Date: 08-02-2024
eFiling API Specifications
manufacturer
labs
poc
20 of 22
Date: 08-02-2024
eFiling API Specifications
21 of 22
Date: 08-02-2024
eFiling API Specifications
"country": "",
"postalCode": "",
"phone": "",
"email": "",
"citationCodes": ["1201", "1202", "1203"],
"testReportId": "1234-55567",
"testURL": "test-report-url-here",
"testReportAccessKey": ""}, {
"type": "LAB",
"cpscId": "",
"alternateId": "lab-two",
"name": "Lab Two, Inc.",
"addressLine1": "456 Placeholder Lane",
"addressLine2": "",
"aptNumber": "Ste. 42",
"city": "Los Angeles",
"stateProvince": "CA",
"country": "USA",
"postalCode": "90001",
"phone": "555-555-5555",
"email": "[email protected]",
"citationCodes": ["1204", "1205", "1207"],
"testReportId": "1234-4567",
"testURL": "test-report-url-here",
"testReportAccessKey": ""}],
"exemptions": ["1199.1", "4.36.2"],
"poc": {
"type": "Importer",
"gln": "",
"alternateId": "",
"name": "",
"addressLine1": " ",
"addressLine2": "",
"aptNumber": "",
"city": "",
"stateProvince": "",
"country": "",
"postalCode": "",
"phone": "",
"email": ""}
},
"directives": {
"productUpdate": "N",
"versionIdToUpdate": "",
"manufacturer": {
"isNew": "Y",
"gln": "",
"alternateId": " fake-manufacturing"},
"labs": [{
"isNew": "Y",
"gln": "",
"alternateId": "lab-two"}],
"poc": {
"isNew": "N",
"gln": "",
"alternateId": ""}
}
}]
}
22 of 22
Date: 08-02-2024