Quick Start Guide for retrieving the documents using Shell MarketHub Document API
This guide helps you to fetch the USF documents from Shell MarketHub2.0 platform, which consist of the SMH API Service called Document API.
The Document API uses the OAuth2 authorization code grant type to obtain permission for you from Shell to retrieve the following documents:
- Rack/Contract Price
- Invoice Documents
- Settlement Documents - Daily Settlement Advice (DSA), Deferred Tax (DFT), Statement of Account (SOA)
Retrieving documents from SMH 2.0 is a two step process as mentioned below:
-
Your application sends the OAuth 2.0 authentication request to Shell's Authentication server with the Client Credentials (Client ID and Client Secret) provided by Shell to generate a time sensivite accessToken.
-
After the authentication is successful, your applications sends a document retrieval request to Shell MarketHub2.0 system using document API
Authentication
SMH Document API is secured by OAuth 2.0. It uses Client Credentials grant Type to allow the API consumer to access data. The end to end process is illustrated in the sequence diagram below :
Below is the sequence followed:
- Your applications makes a request to Shell's Authentication Server (OAuth Authentication) to obtain Access token.
- Your application then uses the Access token, API Service Account Credentials (Client ID, Client Secret, apiKey) and RequestId to make requests to SMH 2.0 Document API via Shell API Management Gateway.
Base URLs
| Environment | Base URL |
|---|---|
| Test | https://api-test.shell.com |
| Production | https://api.shell.com |
Get an Access Token
Once you receive the Client ID and Client Secret, next step is to obtain an access token by making a request to {Shell Authentication Server}/as/token.oauth2 endpoint to authenticate.
Key request parameters
| Element | Value |
|---|---|
| Method | POST |
| Endpoint | /as/token.oauth2 |
| Headers | Content-Type: application/x-www-form-urlencoded |
| data-url-encode | client_id=******************* |
| data-url-encode | client_secret=*********** |
| data-url-encode | grant_type=client_credentials |
Sample request
curl --location 'https://sso-dev.shell.com/as/token.oauth2' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=***********' \
--data-urlencode 'client_secret=**********' \
--data-urlencode 'grant_type=client_credentials'
Sample response
{
"access_token": "***********",
"token_type": "Bearer",
"expires_in": 899
}
Note: The Access Token is valid for 899s (15 mins).
Invoke Document API for Rack/Contract Price
Key Request Parameters
| Element | Value | ||||
|---|---|---|---|---|---|
| Method | POST |
||||
| Endpoint | /commerce/usfuels/v1/document |
||||
| Headers | Content-Type: application/json | ||||
| _clientid: This is the unique client Id that is provided by Shell OR SMH 2.0 Team. | |||||
| _clientsecret: This is the secret for the client Id that is provided by Shell or SMH 2.0 Team. | |||||
| apiKey: This is a unique Shell API key provided by Shell or SMH 2.0 Team. | |||||
| Authorization: Bearer access_token (Access Token is generated from the OAuth end point.) | |||||
| RequestId: This is the UUID for the request generated by the API consumer to uniquely identify and track the request. | |||||
| Body | |||||
| Parameter Name | Description | Mandatory or Optional | Data Type | Example | |
| documentType | This is the document type. The values are: rackPrice or contractPrice | Mandatory | string | rackPrice | |
| outputFormat | This is the format in which the output would be displayed. The values are: json, xml, csv. | Mandatory | string | xml | |
| soldTo | soldTo: This is the number that uniquely identifies the SoldTo for which the document belong. It is provided to the customer during implementation of the API. The length allowed is 10. | Mandatory | string | 12345678 | |
| fromDate | fromDate: This is the earliest date of search criteria. The format is YYYYMMDD. | Optional | string | 20250214 | |
| toDate | toDate: This is the latest date of search criteria. The format is YYYYMMDD. | Optional | string | 20250315 |
Sample Request
curl --location 'https://api-dev.shell.com/commerce/usfuels/v1/document' \
--header 'RequestId: f47ac10b-58cc-4372-a567-0e02b2c3d479' \
--header 'client_secret: ***********' \
--header 'client_id: ***********' \
--header 'apiKey: ***********' \
--header 'Referrer-Policy: no-referrer' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"documentType": "rackPrice",
"outputFormat": "xml",
"soldTo": "********",
"fromDate": "20250214",
"toDate": "20250315"
}'
Sample Response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<NAXML-FuelsDoc>
<TransmissionHeader>
<TransmissionId>************</TransmissionId>
<TransmissionDate>2025-05-17</TransmissionDate>
<TransmissionTime>12:38</TransmissionTime>
<TransmissionStatus actionType="original"/>
</TransmissionHeader>
<Parties>
<Supplier>
<Name ident="************" identType="DUNS">SHELL</Name>
<City>Houston</City>
<State>TX</State>
</Supplier>
<Buyer>
<Name classOfTrade="Wholesale" ident="************" identType="CustomerNumber">TEST ABC</Name>
<FuelPriceInfo>
<Terminal>
<Name ident="************" identType="PlantNumber">TEST</Name>
<City>INDIANAPOLIS</City>
<FuelProduct>
<EffectiveDate>20250313</EffectiveDate>
<EffectiveTime>1800</EffectiveTime>
<FuelProductId identType="************">************</FuelProductId>
<Price>************</Price>
<NetChange>************</NetChange>
</FuelProduct>
</Terminal>
</FuelPriceInfo>
</Buyer>
</Parties>
<SaleTerms>FOB</SaleTerms>
</NAXML-FuelsDoc>
Invoke Document API for Invoice Documents
Key Request parameters
| Element | Value | ||||
|---|---|---|---|---|---|
| Method | POST |
||||
| Endpoint | /commerce/usfuels/v1/document |
||||
| Headers | Content-Type: application/json | ||||
| _clientid: This is the unique client Id that is provided by Shell OR SMH 2.0 Team. | |||||
| _clientsecret: This is the secret for the client Id that is provided by Shell or SMH 2.0 Team. | |||||
| apiKey: This is a unique Shell API key provided by Shell or SMH 2.0 Team. | |||||
| Authorization: Bearer access_token (Access Token is generated from the OAuth end point.) | |||||
| RequestId: This is the UUID for the request generated by the API consumer to uniquely identify and track the request. | |||||
| Body | |||||
| Parameter Name | Description | Mandatory or Optional | Data Type | Example | |
| documentType | This is the document type. The values are: invoice | Mandatory | string | invoice | |
| outputFormat | This is the format in which the output would be displayed. The values are: txt, xml. | Mandatory | string | xml | |
| soldTo | soldTo: This is the number that uniquely identifies the SoldTo for which the document belong. It is provided to the customer during implementation of the API. The length allowed is 10. | Mandatory | string | 12306595 | |
| fromDate | fromDate: This is the earliest date of search criteria. The format is YYYYMMDD. | Optional | string | 20250214 | |
| toDate | toDate: This is the latest date of search criteria. The format is YYYYMMDD. | Optional | string | 20250315 |
Sample Request
curl --location 'https://api-dev.shell.com/commerce/usfuels/v1/document' \
--header 'RequestId: f47ac10b-58cc-4372-a567-0e02b2c3d479' \
--header 'client_secret: ***********' \
--header 'client_id: ***********' \
--header 'apiKey: ***********' \
--header 'Referrer-Policy: no-referrer' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"DocumentType": "invoice",
"OutpuTFormat": "txt",
"soldTo": "********",
"fromDate": "20250401",
"toDate": "20250428"
}'
Sample response
Shell Oil Products US
Debit Note
-------------------------------------------------------------------------------
INVOICE NO: ********** INVOICE DATE: 03/25/2025
-------------------------------------------------------------------------------
......
.....
Invoke Document API for Settlement Documents - DSA
Key request parameters
| Element | Value | ||||
|---|---|---|---|---|---|
| Method | POST |
||||
| Endpoint | /commerce/usfuels/v1/document |
||||
| Headers | Content-Type: application/json | ||||
| _clientid: This is the unique client Id that is provided by Shell OR SMH 2.0 Team. | |||||
| _clientsecret: This is the secret for the client Id that is provided by Shell or SMH 2.0 Team. | |||||
| apiKey: This is a unique Shell API key provided by Shell or SMH 2.0 Team. | |||||
| Authorization: Bearer access_token (Access Token is generated from the OAuth end point.) | |||||
| RequestId: This is the UUID for the request generated by the API consumer to uniquely identify and track the request. | |||||
| Body | |||||
| Parameter Name | Description | Mandatory or Optional | Data Type | Example | |
| documentType | This is the document type. The values are soa, settlement, dft. | Mandatory | string | settlement | |
| outputFormat | This is the format in which the output would be displayed. The values are: txt. | Mandatory | string | txt | |
| payerId | This is the payer code. Payer is the entity responsible for making payments for goods or services. | Mandatory | string | 12345678 | |
| fromDate | fromDate: This is the earliest date of search criteria. The format is YYYYMMDD. | Optional | string | 20250214 | |
| toDate | toDate: This is the latest date of search criteria. The format is YYYYMMDD. | Optional | string | 20250315 |
Sample request
curl --location 'https://api-dev.shell.com/commerce/usfuels/v1/document' \
--header 'RequestId: f47ac10b-58cc-4372-a567-0e02b2c3d479' \
--header 'client_secret: ***********' \
--header 'client_id: ***********' \
--header 'apiKey: ***********' \
--header 'Referrer-Policy: no-referrer' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--header 'Cookie: PF=6vTDSS6KmpAq5vdrbNZFEI; ROUTE=.api-f84974cb5-sqsbq' \
--data '{
"DocumentType": "settlement",
"OutpuTFormat": "txt",
"payerId": "********",
"fromDate": "20250226",
"toDate": "20250320"
}'
Sample Response
Settlement Advice
Shell Oil Products US
For any queries please contact Customer Service
Telephone: ******************
Fax: ************
http://www.shell.com
Payer Number: US16 ********
......
.....
Invoke Document API for Settlement Documents - DFT
Key Request parameters
| Element | Value | ||||
|---|---|---|---|---|---|
| Method | POST |
||||
| Endpoint | /commerce/usfuels/v1/document |
||||
| Headers | Content-Type: application/json | ||||
| _clientid: This is the unique client Id that is provided by Shell OR SMH 2.0 Team. | |||||
| _clientsecret: This is the secret for the client Id that is provided by Shell or SMH 2.0 Team. | |||||
| apiKey: This is a unique Shell API key provided by Shell or SMH 2.0 Team. | |||||
| Authorization: Bearer access_token (Access Token is generated from the OAuth end point.) | |||||
| RequestId: This is the UUID for the request generated by the API consumer to uniquely identify and track the request. | |||||
| Body | |||||
| Parameter Name | Description | Mandatory or Optional | Data Type | Example | |
| documentType | This is the document type. The values are soa, settlement, dft. | Mandatory | string | dft | |
| outputFormat | This is the format in which the output would be displayed. The values are: txt. | Mandatory | string | txt | |
| payerId | This is the payer code. Payer is the entity responsible for making payments for goods or services. | Mandatory | string | 12345678 | |
| fromDate | fromDate: This is the earliest date of search criteria. The format is YYYYMMDD. | Optional | string | 20250214 | |
| toDate | toDate: This is the latest date of search criteria. The format is YYYYMMDD. | Optional | string | 20250315 |
sample request
curl --location 'https://api-test.shell.com/commerce/usfuels/v1/document' \
--header 'RequestId: f47ac10b-58cc-4372-a567-0e02b2c3d479' \
--header 'client_secret: ***********' \
--header 'client_id: ***********' \
--header 'apiKey: ***********' \
--header 'Referrer-Policy: no-referrer' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"DocumentType": "dft",
"OutpuTFormat": "txt",
"payerId": "********",
"fromDate": "20250226",
"toDate": "20250320"
}'
sample response
204 No Content
Invoke Document API for Settlement Documents - SOA
Key request Parameters
| Element | Value | ||||
|---|---|---|---|---|---|
| Method | POST |
||||
| Endpoint | /commerce/usfuels/v1/document |
||||
| Headers | Content-Type: application/json | ||||
| _clientid: This is the unique client Id that is provided by Shell OR SMH 2.0 Team. | |||||
| _clientsecret: This is the secret for the client Id that is provided by Shell or SMH 2.0 Team. | |||||
| apiKey: This is a unique Shell API key provided by Shell or SMH 2.0 Team. | |||||
| Authorization: Bearer access_token (Access Token is generated from the OAuth end point.) | |||||
| RequestId: This is the UUID for the request generated by the API consumer to uniquely identify and track the request. | |||||
| Body | |||||
| Parameter Name | Description | Mandatory or Optional | Data Type | Example | |
| documentType | This is the document type. The values are soa, settlement, dft. | Mandatory | string | soa | |
| outputFormat | This is the format in which the output would be displayed. The values are: txt. | Mandatory | string | txt | |
| payerId | This is the payer code. Payer is the entity responsible for making payments for goods or services. | Mandatory | string | **** | |
| fromDate | fromDate: This is the earliest date of search criteria. The format is YYYYMMDD. | Optional | string | 20250214 | |
| toDate | toDate: This is the latest date of search criteria. The format is YYYYMMDD. | Optional | string | 20250315 |
Sample_Request
curl --location 'https://api-dev.shell.com/commerce/usfuels/v1/document' \
--header 'RequestId: f47ac10b-58cc-4372-a567-0e02b2c3d479' \
--header 'client_secret: ***********' \
--header 'client_id: ***********' \
--header 'apiKey: ***********' \
--header 'Referrer-Policy: no-referrer' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"DocumentType": "soa",
"OutpuTFormat": "txt",
"payerId": "********",
"fromDate": "20250226",
"toDate": "20250320"
}'
Sample_Response
Statement of Account as of 02/28/2025
************************
For any queries please contact Customer Service
Telephone: ******************
Fax: ************
http://www.shell.com
Payer Number: ****************
......
.....
Success Codes
| HTTP Status Code | Value | Condition/Definiation |
|---|---|---|
| 200 | Ok | This status code indicates that the request was successful. The server has successfully processed the request and is returning the requested resource. |
| 204 | No Content | This status code indicates that the request was successful, but there is no content to send in the response body. |
Error Codes
| HTTP Status Code | Value | Possible causes |
|---|---|---|
| 400 | Bad Request | Mandatory request header not available as expected. |
| Request body is not in the expected format or does not include required data for specific document type request. | ||
| 401 | UnAuthorized | Invalid access_token. |
| Invalid apiKey. | ||
| Invalid credentials. | ||
| 500 | Internal Server Error | Any error at service provider end while executing the request. |
