Getting started
Authentication
Every request is authenticated with an API key sent in the X-API-Key header. Store the key in a server-side environment variable and never expose it to browsers.
- X-API-KeyHeader on every request
- 401Missing or invalid key
- Server-sideWhere the key belongs
Authenticated request
Send the key in the X-API-Key header. The same key works on every endpoint in the reference.
curl "https://api.envoapi.com/api/v2/profiles/avery-chen-synthetic" \ -H "X-API-Key: $ENVO_API_KEY"Call the API from your backend
Browser-facing apps should call your own server route, which then calls EnvoAPI with X-API-Key. Keys shipped in client-side code are public.
export async function getProfile(publicIdentifier: string) { const res = await fetch( `https://api.envoapi.com/api/v2/profiles/${encodeURIComponent(publicIdentifier)}`, { headers: { "X-API-Key": process.env.ENVO_API_KEY ?? "", }, }, ); return res.json();}The same pattern in Python:
import osfrom urllib.parse import quoteimport requestsdef get_profile(public_identifier: str): res = requests.get( "https://api.envoapi.com/api/v2/profiles/" + quote(public_identifier, safe=""), headers={"X-API-Key": os.environ["ENVO_API_KEY"]}, timeout=30, ) return res.json()When a key is missing or invalid
Requests without a valid key return 401 with the standard error envelope. Do not echo API keys in logs, UI, analytics, or error messages.
{ "success": false, "data": null, "pagination": null, "meta": { "error": { "statusCode": 401, "type": "unauthorized", "detail": "Authentication required" } }}When a request that should be authenticated comes back 401, the cause is almost always on the sending side:
- The value of
X-API-Keyis the key alone — noBearerprefix, no quotes around the value. - An unset environment variable sends an empty header value. When debugging, log whether the header is present and non-empty — never the key itself.
- A key pasted with surrounding whitespace or a trailing line break fails. Trim the value before sending it.
- The same key works on every endpoint, so a
401on one endpoint but not another points at the request that is missing the header — for example a second HTTP client in the codebase that never had it added.
Keeping keys safe
- Store keys in environment variables or a secrets manager, not in source control.
- Use a placeholder such as
$ENVO_API_KEYin documentation, scripts, and examples. - Rotate a key immediately if it leaks, then update your server environment.