How to Get Your API Key
Your API key is a unique, automatically generated token that securely authenticates your requests to the SdashAPI servers. It is absolutely critical that you keep this key secure and never expose it in client-side code, such as plain HTML/JS files or compiled mobile applications, as this could allow unauthorized users to consume your API quotas.
Step 1: Access the Developer Dashboard
1.3.1Once you have created and verified your account, log in and navigate to your Developer Dashboard. The dashboard is your control center for managing your API access, viewing your request statistics, and upgrading your subscription plans if you need a higher volume of requests.
Step 2: Generate or Copy Your Key
1.3.2Within the dashboard interface, locate the API Keys section. Here, you will see your default API token clearly displayed. You can copy this token directly to your clipboard to use in your applications.
Security Best Practices
1.3.3To ensure your account remains secure and your quotas are not abused by bad actors, follow these fundamental security practices:
- Use Environment Variables: Never hardcode your API key as a string in your source code. Instead, store it in a
.envfile (which should be added to your.gitignorefile) and access it dynamically during runtime. - Server-Side Requests Only: You should make API requests from a secure backend server environment, such as Node.js, PHP, or Python. Making requests directly from a user's web browser using client-side JavaScript will expose your key to anyone inspecting the network tab in their browser developer tools.
Rotating Compromised Keys
1.3.4If you ever suspect that your key has been compromised or accidentally committed to a public GitHub repository, you can instantly revoke it. Navigate to the API Keys section and click the Regenerate Key button. This will immediately invalidate the old key and issue a new one, stopping any unauthorized traffic.
Managing Multiple Environments
1.3.5As your application grows, you may want to separate your local development traffic from your live production traffic. You can generate multiple API keys from the dashboard, assigning one for development and one for production, allowing you to track analytics separately for each environment.