--- title: Authentication | micro description: How to authenticate with the Micro API --- The Micro API uses API keys for authentication. Every request must include your API key in the `x-api-key` header. Terminal window ``` curl https://api.micro.so/v2/prism/query/{teamId}/contact \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": { "select": ["full_name", "email"] } }' ``` ## Getting an API key 1. Open Micro and go to **Settings → API** 2. Click **Generate API key** 3. Copy the key — it won’t be shown again ## Keeping keys secure - Never commit API keys to source control - Use environment variables: `process.env.MICRO_API_KEY` - Revoke or regenerate keys any time in **Settings → API** ## Team ID Most API endpoints require a `{teamId}` in the URL path. You can find your team ID in **Settings → API**. We plan to derive this from the API key automatically in a future version. ## Errors If your key is missing or invalid you’ll get: | Status | Meaning | | ------ | -------------------------------------------------- | | `401` | No key provided | | `403` | Key is invalid or doesn’t have access to this team |