Authenticating with the API using a key
The API recognises your company by the key that every request sends. This page explains how it is sent, what sets test and live keys apart and when the API rejects a request.
curl https://prisradar.ch/api/v1/usage \ -H "Authorization: Bearer $PRISRADAR_KEY"
{
"error": {
"code": "unauthorized",
"message": "Der Schlüssel fehlt, ist falsch oder gesperrt."
}
}How do I send the key?
In the Authorization header, as a so-called bearer token: Authorization: Bearer pr_live_… Every request except status must have it. The connection always runs over HTTPS so that nobody can read the key on the way. Without a key, or with a wrong one, you get error 401 unauthorized.
The method is a standard; it is described in RFC 6750.
What sets test and live keys apart?
Test keys begin with pr_test_. They check the request as if it were real, including make and model in the catalogue, but always return the same sample values with test: true and cost you nothing. Live keys begin with pr_live_, return real market values and count towards your package’s monthly quota.
When does the API reject a key?
With 401 if the key is missing, wrong or revoked, or your access is paused. With 403 if the key is restricted to certain server addresses and the request comes from another one. In both cases error.message gives the reason in a German sentence.
You create, restrict and revoke keys in the console.
Didn’t find what you’re looking for?Write to info@prisradar.ch or use the contact form.