Skip to content

Using API Keys

This guide provides integration examples for using API keys to authenticate with Shield's REST API.


Standard Bearer Token Authentication

Include the API key in the Authorization header with each request:

Request Format
curl -X GET "https://your-shield-host:8080/api/apps" \
  -H "Authorization: Bearer YOUR_API_KEY"
import requests

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://your-shield-host:8080"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}

response = requests.get(f"{BASE_URL}/api/apps", headers=HEADERS)
apps = response.json()
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://your-shield-host:8080';

fetch(`${BASE_URL}/api/apps`, {
  headers: {
    'Authorization': `Bearer ${API_KEY}`
  }
})
.then(res => res.json())
.then(data => console.log(data));

Query Parameter Authentication (CSV Export Only)

For the CSV export endpoint only, the token can be passed as a query parameter. This accommodation is provided for BI tools and data analysis platforms that cannot easily set custom HTTP headers:

GET /api/activities/csv?token=YOUR_API_KEY&search=...

This method is only supported for the /api/activities/csv endpoint. All other endpoints require the standard Authorization header.