Every request to the Vangrid API must be authenticated with an API key passed as a Bearer token. This page covers how to obtain a key, how to include it in your requests, and how to handle common authentication errors.Documentation Index
Fetch the complete documentation index at: https://docs.vangrid.io/llms.txt
Use this file to discover all available pages before exploring further.
Get an API key
Vangrid API access requires an enterprise account. To request one, email hello@vangrid.io with your name, organization, and a brief description of what you’re building. Once your account is provisioned, you can generate and manage API keys from the Vangrid dashboard. Each key is scoped to your account and carries the permissions assigned to your plan.If you need multiple keys — for example, to isolate production from development environments — you can create additional keys from the dashboard at any time.
Pass your API key in requests
Include your API key in theAuthorization header of every HTTP request, using the Bearer scheme:
Authentication errors
If something goes wrong with your credentials, the API returns one of two status codes:401 Unauthorized
A401 response means the API could not authenticate your request. Common causes:
- The
Authorizationheader is missing from the request. - The API key is malformed or contains extra whitespace.
- The API key has been revoked or has expired.
Bearer <your-api-key> with a single space between Bearer and the key.
403 Forbidden
A403 response means the API recognized your credentials but your account does not have permission to perform the requested action. Common causes:
- The endpoint or feature is not included in your account tier.
- Your API key is scoped to a different environment or region.
- Your account has reached a usage limit.
403, contact hello@vangrid.io to review your account permissions.
Best practices
Follow these practices to keep your credentials secure:-
Use environment variables. Read your API key from an environment variable such as
VANGRID_API_KEYrather than writing it directly in code. Use a.envfile locally and a secrets manager in production. - Rotate keys regularly. Generate a new API key on a regular schedule and revoke old ones from the dashboard. Treat key rotation as routine maintenance, not just a response to incidents.
- Use separate keys per environment. Create distinct keys for development, staging, and production. If a development key is compromised, your production workload is unaffected.
- Revoke keys you no longer use. If a key was shared with a contractor, used in a demo, or belongs to a deprecated integration, revoke it promptly from the dashboard.
- Monitor for unexpected usage. Review your API usage in the dashboard periodically. Unusual spikes in request volume may indicate a leaked key.