DocsAPI Authentication
API Authentication
Learn how to authenticate your API requests to SnowScrape.
SnowScrape uses Bearer token authentication for all API requests. Your token is generated when you log in and can be retrieved from your account settings.
Security Notice
Keep your API token secure. Never share it publicly or commit it to version control. If your token is compromised, regenerate it immediately from your account settings.
Getting Your API Token
- Log in to your SnowScrape account
- Navigate to Settings → API Keys
- Click Generate New Key
- Copy your token and store it securely
Making Authenticated Requests
Include your token in the Authorization header of every request:
Header Format
Authorization: Bearer YOUR_API_TOKEN
Example: cURL
curl -X GET "https://api.snowscrape.com/jobs/status" \ -H "Authorization: Bearer sk_live_abc123..." \ -H "Content-Type: application/json"
Example: JavaScript (fetch)
const response = await fetch('https://api.snowscrape.com/jobs/status', {
method: 'GET',
headers: {
'Authorization': `Bearer ${process.env.SNOWSCRAPE_API_KEY}`,
'Content-Type': 'application/json',
},
});
const data = await response.json();Example: Python (requests)
import os
import requests
api_key = os.environ.get('SNOWSCRAPE_API_KEY')
response = requests.get(
'https://api.snowscrape.com/jobs/status',
headers={
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json',
}
)
data = response.json()API Base URL
https://api.snowscrape.comAll API endpoints are relative to this base URL.
Token Types
| Token Prefix | Environment | Usage |
|---|---|---|
| sk_live_ | Production | Use in production applications |
| sk_test_ | Testing | For development and testing |
Error Responses
Authentication errors return specific HTTP status codes:
| Status Code | Meaning | Solution |
|---|---|---|
| 401 | Unauthorized | Token missing or invalid format |
| 403 | Forbidden | Token valid but lacks permission |
Error Response Example
{
"error": "unauthorized",
"message": "Invalid or expired API token",
"status": 401
}Best Practices
- Store API tokens in environment variables, never hardcode them
- Use test tokens (
sk_test_) during development - Rotate tokens periodically for security
- Monitor your API usage in the dashboard for unusual activity
- Use separate tokens for different applications or environments
Using Environment Variables
Store your token securely using environment variables:
# .env file (never commit this!) SNOWSCRAPE_API_KEY=sk_live_abc123... # Access in your code process.env.SNOWSCRAPE_API_KEY # Node.js os.environ['SNOWSCRAPE_API_KEY'] # Python