Authentication
How to get your API credentials and use the Travelyzer Places JWT authentication system.
Authentication
Travelyzer Places API uses a secure authentication system based on JWT (JSON Web Token) tokens. This guide walks you through setting up your API access step by step.
Process Overview
Authentication takes place in 3 simple steps:
- Create your credentials in the Developer Dashboard
- Exchange your credentials for a JWT token
- Use the token in your API requests
The JWT token is a security measure that avoids exposing your secret credentials in each request. It has a limited lifespan and can be revoked at any time.
Step 1: Create Your API Credentials
Access the Dashboard
- Go to the Developer Dashboard
- Log in or create an account
- Navigate to the "API Keys" section
Generate a New Key
- Click on "Create new key"
- Give your key a descriptive name (e.g., "Production", "Mobile App", "Backend Server")
- Click "Create"
Your Credentials
After creation, you receive two essential pieces of information:
| Credential | Format | Description |
|---|---|---|
| API Key | gck_xxxxxxxxxxxxxxxxxxxx | Public identifier of your application |
| API Secret | gcs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | Secret key for generating your tokens |
Warning: The API Secret is only displayed once during creation. Copy it immediately and store it in a safe place. If you lose it, you will need to regenerate a new secret.
Step 2: Get a JWT Token
Use your credentials to obtain a JWT token via the /api-clients/token endpoint.
Endpoint
POST https://api2.gotravelyzer.com/api-clients/tokenRequest
curl -X POST "https://api2.gotravelyzer.com/api-clients/token" \
-H "Content-Type: application/json" \
-d '{
"apiKey": "gck_your_api_key",
"apiSecret": "gcs_your_api_secret"
}'Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your API Key (format gck_xxx) |
apiSecret | string | Yes | Your API Secret (format gcs_xxx) |
expiresIn | string | No | Token validity duration (default: 1h) |
Duration Options (expiresIn)
| Value | Duration | Use Case |
|---|---|---|
1h | 1 hour | Short sessions, development |
24h | 24 hours | Web applications, daily use |
7d | 7 days | Mobile applications, scripts |
30d | 30 days | Server-to-server integrations |
Response (200 OK)
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresAt": "2026-02-24T12:00:00.000Z",
"clientId": "client_abc123"
}| Field | Type | Description |
|---|---|---|
token | string | Your JWT token to use in requests |
expiresAt | string | Expiration date and time (ISO 8601) |
clientId | string | Your application identifier |
Possible Errors
| Code | Message | Solution |
|---|---|---|
401 | Invalid API key | Check your API Key |
401 | Invalid API secret | Check your API Secret |
400 | apiKey is required | Add apiKey in the body |
400 | apiSecret is required | Add apiSecret in the body |
Step 3: Use the Token in Your Requests
Include your JWT token in the Authorization header of each API request.
Header Format
Authorization: Bearer your_jwt_tokenRequest Example
curl "https://places.gotravelyzer.com/v1/geocoding/forward?query=Paris" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."Complete Example
Here's the complete flow, from obtaining the token to the API call:
# 1. Get a JWT token
TOKEN=$(curl -s -X POST "https://api2.gotravelyzer.com/api-clients/token" \
-H "Content-Type: application/json" \
-d '{
"apiKey": "gck_your_api_key",
"apiSecret": "gcs_your_api_secret"
}' | jq -r '.token')
# 2. Use the token for a geocoding request
curl "https://places.gotravelyzer.com/v1/geocoding/forward?query=Eiffel%20Tower%20Paris" \
-H "Authorization: Bearer $TOKEN"Handling Expired Tokens
Detecting an Expired Token
When your token expires, the API returns a 401 error:
{
"statusCode": 401,
"error": "Unauthorized",
"message": "Token expired"
}Renewal Strategy
Best practice: Renew your token before it expires. Check the expiresAt field to know the expiration date.
- Store the expiration date (
expiresAt) when obtaining the token - Check before each request if the token is close to expiration
- Proactively renew the token a few minutes before expiration
- On 401 error, request a new token and retry the request
Security Best Practices
Never Expose Your Credentials
Never commit your API Key and Secret in your source code or Git repository.
Use environment variables:
# .env (do not commit this file)
TRAVELYZER_API_KEY=gck_your_api_key
TRAVELYZER_API_SECRET=gcs_your_api_secret# .gitignore
.env
.env.local
.env.productionClient vs Server Security
| Environment | Recommended Storage |
|---|---|
| Backend / Server | Environment variables, secrets manager (Vault, AWS Secrets Manager) |
| Frontend / Browser | Never store credentials client-side. Use a backend proxy. |
| Mobile | Keychain (iOS), Keystore (Android), or backend proxy |
Secret Rotation
Regularly renew your API Secrets:
- Create a new secret in the Dashboard
- Update your applications with the new secret
- Verify everything works
- Delete the old secret
After regeneration, the old secret is immediately invalidated. All tokens generated with the old secret will remain valid until they expire.
Keys by Environment
Use distinct API keys for each environment:
| Environment | Recommendation |
|---|---|
| Local Development | Dedicated "Development" key |
| Staging / Test | Dedicated "Staging" key |
| Production | Dedicated "Production" key |
This allows you to:
- Track usage by environment
- Revoke a key without impacting others
- Apply different restrictions
Authentication Errors
| Code | Message | Cause | Solution |
|---|---|---|---|
401 | Missing Authorization header | Header missing | Add Authorization: Bearer <token> |
401 | Invalid token | Malformed token | Check the token format |
401 | Token expired | Token expired | Request a new token |
403 | API key disabled | Key disabled | Reactivate the key in the Dashboard |
403 | Quota exceeded | Quota exceeded | Wait for reset or upgrade your plan |
Error Response Example
{
"statusCode": 401,
"error": "Unauthorized",
"message": "Invalid token"
}