Overview
API keys are used to authenticate your applications with Simforge. Each API key is scoped to an organization and can be used to:
- Call functions via the SDK
- Send traces to Simforge
- Access the Simforge API
Creating an API Key
- Click your profile avatar in the top-right corner of the Simforge web portal
- Select API Keys from the dropdown menu
- Click Create API Key
- Enter a name for your API key (e.g., “Production”, “Development”)
- Copy the generated API key immediately - it will only be shown once
Store your API key securely. Never commit API keys to version control or expose them in client-side code.
Using API Keys
Environment Variables
The recommended way to use API keys is through environment variables:
# .env
SIMFORGE_API_KEY=sf_your_api_key_here
SDK Configuration
Pass your API key when initializing the SDK:
import { Simforge } from "@goharvest/simforge"
const client = new Simforge({
apiKey: process.env.SIMFORGE_API_KEY,
})
VS Code Extension
Configure your API key in VS Code settings:
- Open VS Code Settings (
Cmd+, or Ctrl+,)
- Search for “Simforge”
- Enter your API key in the Simforge: Api Key field
Or use the command palette:
- Open Command Palette (
Cmd+Shift+P or Ctrl+Shift+P)
- Run Simforge: Set API Key
- Enter your API key
Managing API Keys
Viewing API Keys
Click your profile avatar and select API Keys to view all API keys for your organization. You can see:
- Key name
- Creation date
- Last used date
- Partial key (last 4 characters)
Revoking API Keys
To revoke an API key:
- Click your profile avatar and select API Keys
- Find the API key you want to revoke
- Click the Revoke button
- Confirm the revocation
Revoking an API key is immediate and permanent. Any applications using the revoked key will stop working.
Best Practices
- Use separate keys for different environments: Create separate API keys for development, staging, and production
- Rotate keys regularly: Periodically create new keys and revoke old ones
- Use descriptive names: Name your keys clearly to identify their purpose
- Monitor usage: Check the “Last Used” date to identify unused keys