Get the API key for Daytona API.
Authentication is resolved in the following priority order:
options.apiKey is provided, it is used directly.If no API key is found, an error is thrown with setup instructions.
# Get your API key from https://app.daytona.io
export DAYTONA_API_KEY=your_api_key_heregetAuthApiKey(options: __type): string| Name | Type | Description |
|---|---|---|
options | __type | Optional authentication configuration from DaytonaSandboxOptions |
// With explicit API key
const apiKey = getAuthApiKey({ apiKey: "my-api-key" });
// Using environment variables (auto-detected)
const apiKey = getAuthApiKey();
// From DaytonaSandboxOptions
const options: DaytonaSandboxOptions = {
auth: { apiKey: "my-api-key" }
};
const apiKey = getAuthApiKey(options.auth);