Regenerate API Key
Generate a new API key, invalidating the current one.
Endpoint
POST /v1/user/api-key/regenerate
Example Request
curl -X POST "https://api.scrapebit.com/v1/user/api-key/regenerate" \
-H "Authorization: Bearer YOUR_CURRENT_API_KEY" \
-H "Content-Type: application/json"
Response
{
"success": true,
"data": {
"api_key": "sb_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"created_at": "2025-01-31T16:00:00Z",
"previous_key_invalidated": true
},
"message": "API key regenerated successfully. Your old key is now invalid."
}
Important
The full API key is only shown once in this response. Store it securely immediately. You will not be able to retrieve the full key again.
What Happens
- A new API key is generated
- The old API key is immediately invalidated
- All requests using the old key will fail with
401 Unauthorized - The new key is returned in the response
When to Regenerate
- Security breach: If you suspect your key was compromised
- Key rotation: As part of regular security practices
- Team changes: When team members with access leave
- Accidental exposure: If the key was committed to version control
After Regenerating
- Update your applications with the new API key
- Update environment variables in all deployments
- Test that everything works with the new key
- Remove any stored copies of the old key
Error Responses
Rate Limited
You can only regenerate your API key once per hour:
{
"success": false,
"error": {
"code": "rate_limited",
"message": "You can only regenerate your API key once per hour. Please try again later.",
"retry_after": 2400
}
}
Alternative: Web Dashboard
You can also regenerate your API key from the Scrapebit web dashboard:
- Log in to scrapebit.com
- Go to Settings → Profile
- Click Regenerate API Key
- Copy and save your new key
Credits
This endpoint does not consume credits.