Authentication
We provide a powerful API to access market data. All requests require an API key sent via the X-API-Key header.
Generate and manage keys at insight.apeek.io under API Access.
Send your API key
cURL
curl "https://api.apeek.io/constituents/series=SP500" -H "X-API-Key: YOUR_API_KEY"
Code examples
Python
import os, requests
API_KEY = os.getenv("apeek_API_KEY", "YOUR_API_KEY")
url = "https://api.apeek.io/constituents/series=SP500"
headers = {"X-API-Key": API_KEY}
params = {"limit": 1000, "offset": 0}
resp = requests.get(url, headers=headers, params=params)
resp.raise_for_status()
data = resp.json()
print(data["total_rows"], "rows available")
Best practices
- Never commit keys to source control.
- Use environment variables or a secrets manager.
- Rotate keys periodically and on team changes.
- Scope keys per environment (dev, staging, prod).
- Audit and remove unused keys regularly.
Key rotation
- Create a new key in API Access at insight.apeek.io.
- Deploy the new key to your environment variables.
- Verify requests succeed using the new key.
- Revoke the old key.
Testing in Postman
- Create a new GET request to https://api.apeek.io/constituents/series=SP500
- On the Headers tab, add
X-API-Keywith your key. - Send. You should receive JSON with
rows,total_rows,limit,offset,latency.
Common auth errors
401 Not authenticated
Missing or invalid key.
{
"detail": "Not authenticated"
}
Checklist
- Header name exactly
X-API-Key. - No extra spaces or quotes around the key.
- Request sent to
https://api.apeek.io.
403 Forbidden
Key revoked or not allowed.
{
"detail": "forbidden"
}
Checklist
- Generate a new key and retry.
- Confirm the key is active in the portal.
Quick copy & paste
Minimal cURL
curl "https://api.apeek.io/yields/series=1M,3M,10Y?limit=10&offset=0" -H "X-API-Key: YOUR_API_KEY"
Minimal Python
import requests
r = requests.get(
"https://api.apeek.io/constituents/series=SP500",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"limit": 5, "offset": 0}
)
print(r.status_code, r.json().get("rows", [])[:2])
FAQ
Q: Where do I get my API key?
A: Log in to insight.apeek.io, open API Access, and click Generate Key.
Q: Can I use query params for auth?
A: Use the X-API-Key header. Query-param auth is not supported.
Q: Do keys expire?
A: Keys remain valid until you rotate or revoke them in the portal.