Authentication
Nimble Web API uses API key authentication to secure access to our services.
Getting Your API Key
- Sign up for a Nimble account at dashboard.nimbleway.com
- Navigate to the API Keys section
- Generate a new API key for your project
- Copy and securely store your API key
Keep your API key secure and never expose it in client-side code or public repositories.
Authentication Methods
Include your API key in the Authorization header:
curl -X POST "https://api.nimbleway.com/v1/scrape" \
-H "Authorization: Bearer your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com"}'
Query Parameter Authentication
Alternatively, pass your API key as a query parameter:
curl -X POST "https://api.nimbleway.com/v1/scrape?api_key=your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com"}'
SDK Authentication
Node.js
import { NimbleClient } from '@nimbleway/sdk';
const client = new NimbleClient({
apiKey: 'your-api-key-here'
});
Python
from nimble_sdk import NimbleClient
client = NimbleClient(api_key='your-api-key-here')
PHP
<?php
require_once 'vendor/autoload.php';
use Nimble\Client;
$client = new Client([
'api_key' => 'your-api-key-here'
]);
?>
Environment Variables
For security, store your API key in environment variables:
Unix/Linux/macOS
export NIMBLE_API_KEY="your-api-key-here"
Windows
set NIMBLE_API_KEY=your-api-key-here
.env File
NIMBLE_API_KEY=your-api-key-here
Error Responses
Invalid API Key
{
"error": "Unauthorized",
"message": "Invalid API key provided",
"code": 401
}
Missing API Key
{
"error": "Bad Request",
"message": "API key is required",
"code": 400
}
Rate Limit Exceeded
{
"error": "Too Many Requests",
"message": "Rate limit exceeded. Try again in 60 seconds",
"code": 429,
"retry_after": 60
}
Best Practices
Security
- Never hardcode API keys in your source code
- Use environment variables or secure configuration files
- Rotate keys regularly for enhanced security
- Monitor usage in your dashboard
- Reuse connections when making multiple requests
- Implement exponential backoff for rate limit handling
- Cache responses when appropriate
- Use batch requests for multiple URLs
Testing Your Authentication
Test your API key with a simple request:
curl -X GET "https://api.nimbleway.com/v1/status" \
-H "Authorization: Bearer your-api-key-here"
Expected response:
{
"status": "active",
"account": "your-account-id",
"plan": "premium",
"requests_remaining": 9950
}