Authentication
All MergeGuide API requests require authentication. This guide covers available authentication methods.Authentication Methods
API Key (Recommended)
Use an API key for programmatic access:OAuth 2.0
For interactive applications, use OAuth 2.0:Obtaining API Keys
Via Dashboard
- Go to portal.mergeguide.ai
- Navigate to Settings > API Keys
- Click Generate New Key
- Set name, permissions, and expiration
- Copy the key (shown only once)
Via CLI
API Key Format
API keys follow this format:Key Permissions (Scopes)
| Scope | Description |
|---|---|
read:evaluations | View evaluation results |
write:evaluations | Create new evaluations |
read:policies | View policy configurations |
write:policies | Modify policies |
read:org | View organization details |
write:org | Modify organization settings |
admin | Full administrative access |
Combining Scopes
Using API Keys
HTTP Header (Recommended)
Query Parameter (Not Recommended)
For legacy systems only:Environment Variable
Store keys in environment variables:Key Management
Listing Keys
Revoking Keys
Key Expiration
Set expiration when creating keys:30m- 30 minutes24h- 24 hours7d- 7 days90d- 90 daysnever- No expiration (not recommended)
OAuth 2.0 Flow
Authorization Code Flow
- Redirect user to authorize:
- Exchange code for token:
- Response:
Refreshing Tokens
Security Best Practices
Key Storage
- Never commit keys to version control
- Use environment variables or secrets managers
- Rotate keys regularly (every 90 days recommended)
- Use minimum required scopes
Secrets Managers
IP Allowlisting
Restrict key usage to specific IPs:Error Responses
401 Unauthorized
- Missing Authorization header
- Invalid key format
- Expired key
- Revoked key
403 Forbidden
- Key lacks required scope
- IP not in allowlist
- Organization access denied
Enterprise Authentication
SAML 2.0 SSO
Available on Team, Business, and Enterprise plans. Connect your SAML 2.0 identity provider (Okta, Azure AD, Google Workspace, etc.) for single sign-on. See SAML Setup.OIDC / OAuth 2.0 + PKCE
Available on Team, Business, and Enterprise plans. For OpenID Connect-compatible IdPs:- Authorization endpoint:
https://auth.mergeguide.ai/oidc/authorize - Token endpoint:
https://auth.mergeguide.ai/oidc/token - Redirect URI:
https://portal.mergeguide.ai/auth/oidc/callback - Supported flows: Authorization Code with PKCE
SCIM v2 Provisioning
Available on Business and Enterprise plans. Automate user lifecycle management from your IdP:- Base URL:
https://api.mergeguide.ai/scim/v2 - Authentication: Bearer token (generate in Settings > Security > SCIM)
- Supported operations: Create, Read, Update, Delete, Group sync
WebAuthn / FIDO2 + TOTP MFA
Multi-factor authentication options available on all plans:- WebAuthn/Passkeys — Hardware keys (YubiKey) and platform authenticators (Face ID, Touch ID, Windows Hello)
- TOTP — Time-based one-time passwords (Authy, Google Authenticator, 1Password)