While shipping settings include endpoints to manage carrier credentials, the Create Configuration request may not be functional for you. In this case, you can use the Carrier Service (or CARS) to add and update carrier credentials instead.
This service is not currently exposed on the API documentation site, so use this guide to understand how to use it. The full credential creation process requires using both the Shipping Settings and Carrier Service APIs as well as the Admin UI.
Carrier Service API
The Carrier Service API holds credentials for label printing only. All other credentials are added and updated via shipping settings or location configurations, which can be done completely in the Admin user interfaces.
The only endpoint you will use from the Carrier Service is the addOrUpdateCredential call:
POST .../commerce/shipping/carrierService/api/v1/addOrUpdateCredential
Carrier Configuration Process
The below steps explain how to configure carrier credentials using a combination of the Shipping Settings API and Carrier Service API.
Create Carrier Credential Set
This step uses the Shipping Settings API and thus can be done in the Admin UI. If using the API, call Create Carrier Credential Set to create the initial credential set (using FedEx as an example below).
POST .../api/commerce/shipping/admin/carriers/credential-sets/FEDEX
The request body should follow the below template. Enter your API developer credentials, not the carrier credentials. For the FedEx example, the carrierId
would be "fedex."
{ "carrierId": "string", "name": "string", "values": [ { "key": "accountnumber", "value": "string" }, { "key": "apipassword", "value": "string" }, { "key": "apiusername", "value": "string" }, { "key": "meternumber", "value": "string" }, { "key": "pickuptype", "value": "string" } ] }
Create Carrier Credentials
This step can only be done via the Carrier Service API and is not possible through the Admin UI. Call the below endpoint to create new carrier credentials (or update credentials that you previously created).
POST .../api/commerce/shipping/carrierService/api/v1/addOrUpdateCredential
The request body should follow the below template. For the FedEx example, the carrier
field would be "FEDEX."
{ "tenantID": integer, "locationCode": "string", "carrier":"string", "values":{ "ACCOUNT_NUMBER": "string", "PASSWORD":"string", "ACCESS_KEY":"string", "METER_NUMBER":"string", "HUB_ID":"string" } }
Enable the Carrier
Now that everything is set up via API, you should enable the carrier. These steps are documented in more detail in the user interface guides linked below.
- Enable the carrier in the Admin UI at System > Settings > Shipping > Carrier > Shipping Methods & Rates. Selecting a carrier here and linking it to the credentials you created will make it available for configuration at the location group level. You can also set the shipping method options for that carrier as needed.
- Use location group configurations at Main > Orders > Location Groups to allow fulfillment locations to use that carrier. If desired, you can perform the location group configurations via the Location Groups API instead.