Overview
The Limrun SDK uses API key authentication to secure access to the API. You can authenticate requests by providing your API key when initializing the client.API Key
Authentication is handled through theapiKey option in the ClientOptions interface:
LIM_API_KEY environment variable. If found, it will be used as the default API key.
Authentication Methods
Using Environment Variables
The simplest way to authenticate is by setting theLIM_API_KEY environment variable:
Explicit API Key
You can also provide the API key directly when creating the client:Runtime API Key
For applications where the API key needs to be determined at runtime:How Authentication Works
When you make a request, the SDK automatically adds anAuthorization header with your API key:
Authorization: Bearer YOUR_API_KEY
Authentication Validation
The SDK validates that authentication is properly configured before making requests:Authorization header is not explicitly set, an error will be thrown.
Custom Base URL
If you need to use a custom API endpoint (e.g., for testing or a private deployment), you can configure thebaseURL option:
Using a Custom Endpoint
Environment Variable
You can also set the base URL via theLIMRUN_BASE_URL environment variable:
Default Base URL
If neither thebaseURL option nor the LIMRUN_BASE_URL environment variable is set, the SDK defaults to:
Error Handling
If authentication fails, you’ll receive anAuthenticationError (401 status code). See the Error Handling guide for more details on handling authentication errors.