Authentication
The API uses the OAuth 2.0 client credentials grant. You exchange your client id and client secret for an access token, and send that token with every request.
Get a token
Post a form to the token endpoint:
POST https://pharos.superyachttimes.com/v1/auth/service/token
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&client_id=<client id>&client_secret=<client secret>
You can also send the client id and secret in an HTTP Basic Authorization header instead of the
form fields. grant_type=client_credentials is always required.
A successful response:
{
"access_token": "eyJhbGciOi...",
"token_type": "Bearer",
"expires_in": 604800,
"scope": "partner-api:read partner-api:tier:full"
}
access_tokenis the token to send.expires_inis the token's lifetime in seconds. It is currently 7 days. Read the value rather than assuming it.scopelists what the key holds. You do not need to request or interpret scopes.
The response has Cache-Control: no-store. Do not cache it anywhere shared.
Use the token
Send it on every request:
Authorization: Bearer <access_token>
Reuse one token until it expires. When it expires, or a request answers 401, fetch a new one.
Do not fetch a token per request: the token endpoint accepts about 10 requests a minute from one
IP address and answers 429 above that.
Token errors
Failed token requests use the OAuth 2.0 error format:
| Status | error |
Cause |
|---|---|---|
| 400 | invalid_request |
grant_type missing, or only one of id and secret |
| 400 | unsupported_grant_type |
grant_type is not client_credentials |
| 401 | invalid_client |
Unknown client id, wrong secret, or a revoked key |
| 429 | none | Too many token requests |
{ "error": "invalid_client", "error_description": "Invalid client credentials" }
Keep the secret safe
- Call the API from your server only. Never put the client secret, or a token, in a browser, a mobile app or a public repository.
- Store the secret as you store your other credentials, for example in a secrets manager or an environment variable that is not committed.
- Tokens are valid for days. Treat a token like the secret.
If the secret or a token may have leaked, contact your SuperYacht Times account manager. We revoke the key and issue a new client id and secret.