How to Use the Spyglasses API
Spyglasses provides an OpenAPI-compatible REST API that allows you to programmatically access your analytics data. This is useful for building custom integrations, dashboards, or automating workflows.
Overview
The Spyglasses API uses API key authentication. You can access analytics data, AI visibility rankings, historical metrics, publisher and placement scoring, and coverage tracking through simple HTTP requests.
There are two kinds of key, both sent in the same x-api-key header:
- Property API key — reads one property's analytics and metrics. Covered below.
- Organization API key — authorizes everything under
/api/v1/: AIVPS publisher scoring, PQS placement scoring, and coverage group ingestion. Generate it under Organization Settings → API Key.
They are not interchangeable. See Authentication for which endpoints take which, and Automating Coverage Tracking for the Zapier/n8n workflow that feeds placements into a coverage group.
Getting Started
1. Find Your API Key
Your API key is located in your property settings:
- Navigate to your Spyglasses dashboard
- Select your property from the sidebar
- Go to Settings
- Find the API Key section
- Click the copy button to copy your API key
Your API key looks like: sg_XXXXXXXX-XXXX_XXXXXXXXXXXXXXXXXXXXXXXXXXXX
Keep your API key secure! Anyone with your API key can access your analytics data. Never commit it to version control or expose it in client-side code.
2. Explore the API Documentation
Before integrating, we recommend exploring the interactive API documentation:
- Visit the External API Reference page
- Browse available endpoints
- Test endpoints directly in the browser using your API key
3. Make Your First Request
Test your API key by fetching your property details:
This returns your property information including the propertyId you'll need for other API calls:
Authentication
All API requests must include your API key in the x-api-key header:
Available Endpoints
Not all API endpoints documented are available for use with an API key. If you get an error using an endpoint, confirm it's part of the list of externally-accessible endpoints. See the External API Endpoints page for a complete list of API-accessible endpoints.
Error Handling
The API returns standard HTTP status codes:
| Status Code | Description |
|---|---|
200 | Success |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Access denied to the requested resource |
404 | Not Found - Resource doesn't exist |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error |
Error responses include a JSON body with details:
Need Help?
- Check the External API Reference for endpoint details
- Contact us at support@spyglasses.io