Skip to content

Authentication

To interact with the Spark Commodities API, your application must authenticate. You should use OAuth v2.0 to authenticate to the Spark REST API. Authenticating requires the following steps:

Create an OAuth2 Client

You must first create an OAuth2 client- this is a one-time operation, and each OAuth2 client provides you with a Client ID and a Client Secret. Visit our application to manage your clients. Once your OAuth2 client is set up, you can download your Client ID and Client Secret as a CSV.

Note 1

Client ID and Client Secret must be kept confidential in storage.

Note 2

OAuth2 clients are owned by an organisation and not a user. This is to ensure that personnel changes are easier to manage in the future.

Generate an Access Token

TLDR

Create an Access Token with querying /oauth/token

Detailed version

After obtaining a Client ID and a Client Secret, you can make an API call to obtain an access token using the Create an Access Token endpoint.

To create an access token, you will have to specify a scope: this is a list of permissions your application requires.

An access token is an opaque string that denotes who has authorized which permissions to the Spark API. This access token has short-lived access (30 minutes).

When the Spark API issues a new access token, it also generates a refresh token that expires after a very long time (this is also returned in the API response). When your access token expires, your application can use the refresh token to obtain a new access token. It can do this behind the scenes, and without the user’s involvement, so that it’s a seamless process to the user.

Available scopes are

  • read:prices: Reading Spark contracts and price releases. Require an LNG Freight or an LNG Cargo subscription.
  • read:routes: Reading Spark routes. Require an LNG Freight subscription.
  • read:access: Reading Spark Access data. Require an Access subscription.
  • read:netbacks: Reading Spark Netbacks data. Require an LNG Cargo subscription.

Deprecation note

Scope read:lng-freight-prices is now deprecated. It has been replaced by read:prices. You can still use it, but its support will be dropped at the latest on 2022-12-31.

Make Authenticated Requests

To authenticate subsequent API requests, you have to provide a valid access token in an HTTP header:

GET https://api.sparkcommodities.com/v1.0/contracts/ HTTP/1.1
HOST: my-server
Accept: application/json
Authorization: Bearer <access_token>

Note

All requests must be made over HTTPS.