API Headers

Sitecore Commerce uses Headers passed in via the service APIS to establish context for the call. These Headers are available from within the CommerceContext, which is passed around on all calls. There are standard "known" Headers that are supported upon installation, and additional Headers can be established for specific plugins. Plugins may reference these Headers when taking actions.

Some Headers are only relevant in certain actions. However it is not harmful to include a Header, even if the Header is not used or needed for the particular call.

Currently supported Headers

Name Usage
ShopName The name of the current Shop that you are accessing.
ShopperId A unique ID for a Shopper. This is normally a GUID, represented as a string.
CustomerId If the Shopper is registered, then an additional ID is passed in, representing the unique ID for a registered customer. This is normally a GUID, represented as a string
Currency The currency that is desired in the response. For example, if you request a SellableItem, you will get pricing in the desired currency (if available).
Language The language desired in the response. For example, if you request a SellableItem, you will get localized strings in the desired language (if available).
EffectiveDate The effective date to use during any date-based calculations. This allows time-travel scenarios where you wish to see results as if the interactions occurred at dates and times not in the present. If an EffectivateDate is not passed in, then DateTime.UtcNow is used.
Latitude A string representing the current Latitude of the Shopper.
Longitude A string representing the current Longitude of the Shopper.
IpAddress The IP address of the Shopper
Roles A "|" delimited list of roles for the caller. This may influence what actions are allowed, what information is returned in queries, or whether the query can be performed.
IsRegistered A boolean represented as a string that indicates the current caller is registered.