API Authentication

Document image


Authentication with SparkLayer works by creating an OAuth client credential for the environment within the SparkLayer Dashboard and authenticating with an OAuth2 flow. This ensures that every user that uses the application gets assigned an individualised token.

Environment Domain

Depending on the environment you're accessing, the domain denotes the environment you are using:

Area

Domain

Live

https://app.sparklayer.io

Test

https://test.app.sparklayer.io

Retrieving an access token

Please note: You can retreive the Client ID and Secret from the SparkLayer Dashboard

You can create a POST request to the /api/auth/token using the domain above. It must have a header of Content-type=application/json and the Site-Id provided from the dashboard when creating an API key.

Please note: It's recommended to set the User-Agent to help us debug any issues you may encounter.

JSON


If the details are correct you will recieve the below:

JSON


To use the access_token that you retrieved, you will need to send it as a header with all of your requests. The header should look like this:

Item

Details

Authorization

Bearer 7zA5ltJNkiI2WzhU90fTmYJANRcXYJPXsB8SnIEM3x37B2genuwqyv5tVdfLkUWV

Please note: Make sure to replace 7zA5ltJNkiI2WzhU90fTmYJANRcXYJPXsB8SnIEM3x37B2genuwqyv5tVdfLkUWV with your actual access_token. Once the token expires it is no longer valid.

Example Auth Request:

Text


Example Auth Response:

Text


Example API Request:

Text


Example API Response:

Text




Updated 14 Nov 2024
Did this page help you?