Overview
Skyvern SDK authentication is handled via API keys. Different authentication methods are used depending on whether you’re running in cloud/remote mode or local/embedded mode.Getting Your API Key
Skyvern Cloud
- Navigate to app.skyvern.com/settings
- Find your API key in the Settings page
- Copy and securely store your API key
Cloud/Remote Mode Authentication
When connecting to Skyvern Cloud or a self-hosted instance, provide your API key during initialization:Using Environment Variables
Store your API key in an environment variable for better security:.env File
Create a.env file in your project root:
.env
Local/Embedded Mode Authentication
When running Skyvern locally in-process, authentication is handled through your local.env file.
Setup
- Run the quickstart command to set up your environment:
.env file with your SKYVERN_API_KEY and other configuration.
- Initialize Skyvern in local mode:
Skyvern.local() automatically reads the SKYVERN_API_KEY from your .env file. You don’t need to provide it explicitly.
Manual .env Setup
If you prefer to create the.env file manually:
.env
Cloud Browser Authentication
When connecting to cloud-hosted browsers, the SDK automatically includes your API key in the connection headers:Managing Credentials for Login Workflows
Skyvern supports storing and using credentials for automated login workflows. These credentials are separate from your SDK API key.Creating Credentials
Use the API to create credentials for login automation:Using Credentials for Login
Once created, reference credentials by ID in login workflows:Supported Credential Providers
Skyvern integrates with multiple credential providers:| Provider | Credential Type | Use Case |
|---|---|---|
| Skyvern | skyvern | Credentials stored in Skyvern Cloud |
| Bitwarden | bitwarden | Retrieve credentials from Bitwarden |
| 1Password | 1password | Retrieve credentials from 1Password |
| Azure Key Vault | azure_vault | Retrieve credentials from Azure Key Vault |
Environment Configuration
You can specify different Skyvern environments:Security Best Practices
1. Never Commit API Keys
Add.env to your .gitignore:
.gitignore
2. Use Environment Variables
Always load API keys from environment variables, never hardcode them:3. Rotate API Keys Regularly
Rotate your API keys periodically and update them in your environment:- Generate a new API key at app.skyvern.com/settings
- Update your
.envfile or environment variables - Revoke the old API key
4. Use Different Keys for Different Environments
Use separate API keys for development, staging, and production:.env.development
.env.production
5. Secure Credential Storage
When usingcreate_credential(), credentials are stored securely in Skyvern’s encrypted storage. For maximum security:
- Use credential providers like Bitwarden, 1Password, or Azure Key Vault
- Enable 2FA/TOTP for sensitive login workflows
- Regularly audit and rotate stored credentials
Troubleshooting
Invalid API Key Error
If you receive an “Invalid API key” error:- Verify your API key at app.skyvern.com/settings
- Check that your
.envfile is being loaded correctly - Ensure there are no extra spaces or quotes around the API key
Local Mode Not Finding API Key
IfSkyvern.local() fails to find SKYVERN_API_KEY:
- Run
skyvern quickstartto set up your environment - Verify
.envexists in your project root - Check that
.envcontainsSKYVERN_API_KEY=your-key
Cloud Browser Connection Failed
If cloud browser connection fails:- Verify your API key is valid for cloud environments
- Check that you’re using
SkyvernEnvironment.CLOUDor.STAGING - Ensure your network allows WebSocket connections
See Also
- Python SDK - Python SDK initialization and configuration
- TypeScript SDK - TypeScript SDK initialization and configuration
- AI Commands - Using credentials with
page.agent.login()