The idealo Insights API is secured by OAuth2. At a high level, you follow four steps:
-
Obtain OAuth2 credentials from idealo Business.
-
Obtain an access token from the authorization server.
-
Do an idealo Insights API request with the access token in the
Authorizationheader. -
Refresh the access token, if necessary.
Credentials
To access the API you need a client id and a client secret. You can generate them in idealo Business under 'API clients' → 'idealo Insights API'.
|
Note
|
The client secret is only shown once at creation time! If you no longer have access to it or forgot it, create new credentials and delete the old ones. |
Access token
To generate an access token, do a POST request against the authorization endpoint and use your client id
and client secret for HTTP Basic authentication.
Request headers
| Header | Description |
|---|---|
|
|
|
|
Example request
POST /mer/businessaccount/api/v1/oauth/token HTTP/1.1
Host: api.idealo.com
Authorization: Basic <place your Base64 encoded clientId:clientSecret here>
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials
The same request with curl:
$ curl 'https://api.idealo.com/mer/businessaccount/api/v1/oauth/token' -i -X POST \
-u '<clientId>:<clientSecret>' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials'
Example response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"access_token" : "eyJraWQiOiJrMSIsImFsZyI[...]",
"token_type" : "bearer",
"expires_in" : 3600,
"scope" : "INSIGHTSAPI:READ_REPORTS",
"shop_id" : 123456
}
Response fields
| Path | Type | Description |
|---|---|---|
|
String |
The access token (a JWT). Provide it in the |
|
String |
The token type. Always |
|
Number |
The lifetime of the access token in seconds. |
|
String |
The scopes granted to the token. Must include |
|
Number |
The shop id the access token is valid for. |
The access token is a JWT; you can decode it, for example with jwt.io, to inspect its claims.
Refresh the access token
The access token expires after some time, by default 3600 seconds. There is no refresh token: to refresh it, just get a new one as described under Access token.
Token requirements
The access token must be a JWT carrying:
| Claim | Requirement |
|---|---|
|
Must include |
|
Must be present. Otherwise the request is rejected with |
|
Must include |
|
Must match the |