Skip to main content

Authentication

GoRoute uses API keys to authenticate requests. All API requests must include your API key in the X-API-Key header.

API Key Formatโ€‹

GoRoute API keys follow this format:

pk_goroute_{32_character_random_string}

Example:

pk_goroute_b9dfe1472f85caca2631b3862418b1085437bc2a56624e47

Using Your API Keyโ€‹

Include your API key in every request:

curl -X GET https://app.goroute.ai/peppol-api/api/v1/invoices \
-H "X-API-Key: pk_goroute_your_key_here"

Python Exampleโ€‹

import requests

headers = {
"X-API-Key": "pk_goroute_your_key_here",
"Content-Type": "application/json"
}

response = requests.get(
"https://app.goroute.ai/peppol-api/api/v1/invoices",
headers=headers
)

Node.js Exampleโ€‹

const axios = require('axios');

const response = await axios.get(
'https://app.goroute.ai/peppol-api/api/v1/invoices',
{
headers: {
'X-API-Key': 'pk_goroute_your_key_here'
}
}
);

C# Exampleโ€‹

using System.Net.Http;

var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "pk_goroute_your_key_here");

var response = await client.GetAsync(
"https://app.goroute.ai/peppol-api/api/v1/invoices"
);

Creating API Keysโ€‹

  1. Log in to the GoRoute Dashboard
  2. Navigate to Settings โ†’ API Keys
  3. Click Create API Key
  4. Give it a descriptive name (e.g., "Production Backend", "CI/CD Pipeline")
  5. Copy the key immediately โ€” it won't be shown again

API Key Best Practicesโ€‹

โœ… Doโ€‹

  • Store keys in environment variables or secret managers
  • Use different keys for development, staging, and production
  • Rotate keys periodically (every 90 days recommended)
  • Use descriptive names to identify key purposes
  • Revoke unused keys promptly

โŒ Don'tโ€‹

  • Commit keys to source control (Git, SVN)
  • Expose keys in client-side code (JavaScript, mobile apps)
  • Share keys via email or chat
  • Use the same key across multiple environments
  • Log API keys in application logs

Environment Variablesโ€‹

Store your API key as an environment variable:

# Linux/macOS
export GOROUTE_API_KEY="pk_goroute_your_key_here"

# Windows PowerShell
$env:GOROUTE_API_KEY = "pk_goroute_your_key_here"

# Windows CMD
set GOROUTE_API_KEY=pk_goroute_your_key_here

Then use it in your code:

import os
API_KEY = os.environ.get("GOROUTE_API_KEY")

Key Rotationโ€‹

To rotate an API key:

  1. Create a new API key
  2. Update your application to use the new key
  3. Deploy the update
  4. Verify the new key works
  5. Revoke the old key
Zero-Downtime Rotation

GoRoute allows multiple active API keys per organization. Create the new key before revoking the old one to avoid downtime.

Error Responsesโ€‹

Missing API Keyโ€‹

{
"error": {
"code": "UNAUTHORIZED",
"message": "API key is required. Include X-API-Key header."
}
}

HTTP Status: 401 Unauthorized

Invalid API Keyโ€‹

{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid API key. Check that your key is correct."
}
}

HTTP Status: 401 Unauthorized

Revoked API Keyโ€‹

{
"error": {
"code": "UNAUTHORIZED",
"message": "This API key has been revoked."
}
}

HTTP Status: 401 Unauthorized

Rate Limitingโ€‹

API keys are subject to rate limits:

TierRequests/MinuteRequests/Day
Free601,000
Starter30010,000
Business1,000100,000
EnterpriseCustomCustom

When rate limited, you'll receive:

{
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Retry after 60 seconds.",
"retry_after": 60
}
}

HTTP Status: 429 Too Many Requests

See Rate Limits for more details.

IP Whitelisting (Enterprise)โ€‹

Enterprise customers can restrict API key usage to specific IP addresses:

  1. Go to Settings โ†’ API Keys
  2. Click on the key to configure
  3. Enable IP Whitelisting
  4. Add allowed IP addresses or CIDR ranges

Audit Logsโ€‹

All API key usage is logged. View usage in the dashboard:

  • Last used timestamp
  • Request counts
  • Error rates
  • Geographic distribution

Next Stepsโ€‹