Skip to main content

Shell Authentication 1.0.1

This API enables an application to authenticate with a time-sensitive access token as part of the OAuth Authorisation flow.

Shell Authentication Quickstart

Introduction

The Shell Authentication API enables partner applications to authenticate with the API Gateway using OAuth 2.0 client credentials flow. This API provides time-sensitive access tokens that authorize requests to Shell APIs, ensuring secure communication between your application and Shell's services.

Benefit Description
Secure Access OAuth 2.0 standard with time-limited tokens
Simple Integration Single endpoint for token generation
Flexible Environments Support for both test and production environments

Authentication

Migration Note

This API provides both v1 and v2 versions of the OAuth token endpoint. Version 1 is deprecated and will be removed in an upcoming change window. New integrations should use v2, and existing users should migrate to v2 as soon as possible. The primary differences are in the response format: v2 uses standard OAuth field names (expires_in instead of expires_in(seconds) and Bearer instead of BearerToken).

Authorization flow

  1. Request Client ID and Secret

Contact Shell API Team in order to request access to OAuth authentication. The Shell API team will provide a Client ID and Secret.

  1. Request Bearer token

Once you get the credentials, make a request to the Shell Authentication API's OAuth token endpoint with your credentials.

Example request:

curl --location --request POST 'https://api-test.shell.com/v2/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=**************' \
--data-urlencode 'client_secret=**************' \
--data-urlencode 'grant_type=client_credentials'

You'll receive a Bearer token in the response:

{
   "access_token": "**************",
   "expires_in": "899",
   "token_type": "Bearer"
}

Note: The bearer token expiration time is provided in seconds.

  1. Authorize API requests

When calling Shell APIs, include the following in the header of the request.

Authorization: Bearer access_token

Base URLs

Environment URL
Test https://api-test.shell.com
Production https://api.shell.com

Core Integration

1. Generate OAuth Token

Description: Request an OAuth access token using your client credentials. The API returns a time-sensitive Bearer token that must be included in the Authorization header of all subsequent API requests. For security measures, the POST method is used instead of GET to prevent caching.

Path: POST /v2/oauth/token

Sample Request

curl --location --request POST 'https://api-test.shell.com/v2/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=twuwywTYUHAH6AHHJ' \
--data-urlencode 'client_secret=yuahaYThdvdowoUUU7wjsjMM' \
--data-urlencode 'grant_type=client_credentials'

Request Parameters

Parameter Type Required Description
client_id string Yes Client ID provided by Shell
client_secret string Yes Client Secret provided by Shell
grant_type string Yes Grant type value for access (use "client_credentials")

Sample Response

{
  "access_token": "NiE3gzPNVFpwYYMyyWu6mGFYtKN5",
  "expires_in": "899",
  "token_type": "Bearer"
}

Response Parameters

Parameter Type Description
access_token string Generated Access Token to be used in API requests
expires_in string Expiry duration in seconds
token_type string Token Type (Bearer)

Error Handling

The API uses standard HTTP status codes. In case of an error, additional details will be provided in the response body.

Error Code Description Solution
400 Bad Request - The request contains bad syntax or cannot be fulfilled Verify that all required parameters are included and properly formatted
401 Invalid Client ID - Missing Authorization header or invalid credentials Verify your client_id and client_secret are correct and properly encoded
403 Forbidden - The client does not have access rights Contact Shell API Team to verify your access permissions
404 Not Found - Unable to identify proxy for the requested URL Verify the endpoint URL is correct for your environment
405 Method Not Allowed - The HTTP method is not supported for this resource Ensure you are using POST method for the token endpoint
500 Internal Server Error - Execution failed on the server Retry the request; contact Shell Support if the issue persists

About us

The Shell Developer Portal supports partners in onboarding to Shell APIs and turning ideas into production-ready solutions.

 

Shell logo

Contact

Login to your account

Ask AI Assistant about Shell APIs and API Products