Date: October 11, 2025
Status: Ready for Production
- 5 API endpoints for keyword research
- Full validation and error handling
- Support for both Bearer token and API key authentication
- Google Autocomplete integration (100% free, no API key needed)
- Optional DataForSEO API integration for enhanced metrics
- Smart fallback to estimated metrics when DataForSEO is not configured
- 24-hour caching to reduce API calls
- Opportunity score calculation algorithm
DataForSEO API (Optional - for enhanced keyword data):
- Login:
anik@wedevs.com - Password:
anik@wedevs.com
Location:
.envfile: β Configured.env.examplefile: β Configuredconfig/services.php: β Configured
POST /api/keywords/suggestions
POST /api/keywords/related
POST /api/keywords/analyze
POST /api/keywords/batch-analyze
POST /api/keywords/clear-cache
POST /api/ai/keywords/suggestions
POST /api/ai/keywords/related
POST /api/ai/keywords/analyze
POST /api/ai/keywords/batch-analyze
- Get autocomplete suggestions for any keyword
- Returns search volume, difficulty, CPC, and competition
- Supports country and language targeting
- Configurable result limit (1-100)
- Generates variations with prefixes (what, how, why, when, where, best, top)
- Generates variations with suffixes (tips, guide, tutorial, examples, tools, free, 2025)
- Returns up to 50 unique related keywords
- Automatically removes duplicates
- Detailed analysis of a specific keyword
- Calculates opportunity score (0-100)
- Provides actionable recommendations
- Includes 10 related keywords
- Analyze up to 50 keywords at once
- Automatically sorts by opportunity score
- Identifies the best keyword opportunity
- Useful for comparing multiple keyword options
- Clear cache for specific keyword or all keywords
- Useful when you need fresh data
For each keyword, the API returns:
| Metric | Description | Range |
|---|---|---|
| Search Volume | Monthly search volume | 0 - 1M+ |
| Difficulty | SEO difficulty score | 0-100 (lower is easier) |
| CPC | Cost per click (USD) | $0.01 - $100+ |
| Competition | Ad competition level | 0-1 (decimal) |
| Opportunity Score | Overall keyword opportunity | 0-100 (higher is better) |
The system calculates an opportunity score based on:
- 60% - Keyword easiness (100 - difficulty)
- 40% - Search volume (normalized logarithmically)
Recommendations:
- 70-100: Excellent opportunity - High volume with low competition
- 50-69: Good opportunity - Moderate effort required
- 30-49: Consider targeting - May require significant effort
- 0-29: Low opportunity - Consider alternative keywords
- 100% free, no API key required
- Provides keyword suggestions
- Always available as fallback
- Enhanced metrics (real search volume, accurate difficulty)
- When configured: Uses real data from Google Ads
- When not configured: Uses estimated metrics
- Free tier available at https://dataforseo.com/
// Get suggestions
const response = await fetch('/api/keywords/suggestions', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`,
'Accept': 'application/json'
},
body: JSON.stringify({
keyword: 'seo tools',
country: 'us',
language: 'en',
limit: 20
})
});
const data = await response.json();curl -X POST https://your-domain.com/api/keywords/suggestions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"keyword": "seo tools",
"country": "us",
"language": "en",
"limit": 20
}'# DataForSEO API (Optional - for enhanced keyword data)
# Leave empty to use estimated metrics
DATAFORSEO_LOGIN=anik@wedevs.com
DATAFORSEO_PASSWORD=anik@wedevs.com'dataforseo' => [
'login' => env('DATAFORSEO_LOGIN'),
'password' => env('DATAFORSEO_PASSWORD'),
],Default: us (United States)
Supported country codes:
us- United Statesuk- United Kingdomca- Canadaau- Australiade- Germanyfr- Francees- Spainit- Italynl- Netherlandsbr- Brazilin- Indiamx- Mexicojp- Japancn- China
Default: en (English)
You can use any 2-letter ISO language code.
- KEYWORD_API_DOCUMENTATION.md - Complete API reference
- KEYWORD_API_EXAMPLES.md - Code examples and use cases
- KEYWORD_API_IMPLEMENTATION_SUMMARY.md - This file
- Controller created with all endpoints
- Service layer implemented
- Routes configured (authenticated & WordPress plugin)
- DataForSEO credentials configured
- Google Autocomplete integration working
- Estimated metrics fallback implemented
- Caching system (24 hours)
- Validation rules added
- Error handling implemented
- Documentation created
- Code examples provided
-
Start the application:
php artisan serve
-
Get an authentication token:
- Login to the dashboard
- Or use API key for WordPress plugin
-
Make a test request:
curl -X POST http://localhost:8000/api/keywords/suggestions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{"keyword": "seo tools"}'
-
Push to repository:
git push origin main
-
On server, pull changes:
git pull origin main
-
Update .env file on server:
# Add DataForSEO credentials DATAFORSEO_LOGIN=anik@wedevs.com DATAFORSEO_PASSWORD=anik@wedevs.com -
Clear cache:
php artisan config:clear php artisan cache:clear
- Caching: All results are cached for 24 hours
- Rate Limiting: Controlled by Laravel's default rate limiter
- Timeouts:
- Google Autocomplete: 10 seconds
- DataForSEO API: 30 seconds
- Batch Limit: Maximum 50 keywords per batch request
- All endpoints require authentication (Bearer token or API key)
- Input validation on all parameters
- XSS protection via Laravel's built-in sanitization
- SQL injection protection via Eloquent ORM
- API credentials stored in .env file (not in code)
Solution: Check if Google Autocomplete API is accessible from your server
Solution: Verify DataForSEO credentials in .env file
Solution: Run php artisan cache:clear
For questions or issues:
- Check
KEYWORD_API_DOCUMENTATION.mdfor detailed API reference - Review
KEYWORD_API_EXAMPLES.mdfor code samples - Check Laravel logs:
storage/logs/laravel.log
The Keyword Suggestions API is now fully implemented and ready to use! It provides:
β
Free keyword suggestions via Google Autocomplete
β
Optional enhanced metrics via DataForSEO
β
Smart fallback to estimated metrics
β
Multiple analysis endpoints
β
Comprehensive documentation
β
Production-ready code
Status: READY FOR PRODUCTION π