API Documentation
Learn how to integrate with our game API
Authentication
All API requests require an API key. You can provide your API key in one of the following ways:
1. X-API-Key Header (Recommended)
X-API-Key: your_api_key_here
2. Query Parameter
https://webplayzz.com/api/games?api_key=your_api_key_here
3. Bearer Token
Authorization: Bearer your_api_key_here
Need an API key? Contact us to request access.
Domain Restrictions
API keys are restricted to specific domains that you specify when requesting access. This ensures that your API key can only be used from your authorized websites or applications.
- Access is limited to the specific domains you request through our contact form
- Wildcard subdomains are supported (e.g.,
*.example.com
)
Rate Limiting
To ensure fair usage and system stability, our API implements rate limiting:
- Global IP limit: 60 requests per minute per IP address
If you exceed these limits, the API will return a 429 Too Many Requests
status code with information about when you can resume making requests.
Rate Limit Headers
When you receive a rate limit response, the following headers will be included:
Header | Description |
---|---|
Retry-After | Number of seconds to wait before making another request |
X-RateLimit-Reset | Timestamp when the rate limit will reset |
Example Rate Limit Response
{
"status": "error",
"message": "Too many requests, please try again after 30 seconds."
}
Tip: Implement exponential backoff in your API clients to gracefully handle rate limiting.
API Endpoints
/api/games
Retrieves a paginated list of games.
Query Parameters
Parameter | Type | Description |
---|---|---|
per_page | integer | Number of items per page. Default: 20 |
featured | boolean | Filter to only featured games |
category | string | Filter by category slug |
search | string | Search games by name |
Example Response
{
"status": "success",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"name": "Space Adventure",
"slug": "space-adventure",
"description": "An exciting space adventure game",
"thumbnail": "https://webplayzz.com/thumbnails/space-adventure.jpg",
"game_url": "https://webplayzz.com/games/space-adventure",
"instructions": "Use arrow keys to move, space to shoot",
"active": true,
"featured": true,
"play_count": 1250,
"created_at": "2023-01-15T10:32:15.000000Z",
"updated_at": "2023-01-15T10:32:15.000000Z"
},
// ... more games
],
"first_page_url": "https://webplayzz.com/api/games?page=1",
"from": 1,
"last_page": 5,
"last_page_url": "https://webplayzz.com/api/games?page=5",
"links": [
// ... pagination links
],
"next_page_url": "https://webplayzz.com/api/games?page=2",
"path": "https://webplayzz.com/api/games",
"per_page": 20,
"prev_page_url": null,
"to": 20,
"total": 95
}
}
/api/games/popular
Retrieves a list of popular games sorted by play count.
Query Parameters
Parameter | Type | Description |
---|---|---|
limit | integer | Number of games to return. Default: 10 |
Example Response
{
"success": true,
"data": [
{
"id": 3,
"name": "Bubble Shooter",
"slug": "bubble-shooter",
"description": "Classic bubble shooter game",
"thumbnail": "https://webplayzz.com/thumbnails/bubble-shooter.jpg",
"game_url": "https://webplayzz.com/games/bubble-shooter",
"instructions": "Tap to shoot bubbles and match colors",
"active": true,
"featured": true,
"play_count": 3820,
"created_at": "2023-01-12T08:22:11.000000Z",
"updated_at": "2023-01-12T08:22:11.000000Z"
},
// ... more games
]
}
/api/games/{slug}
Retrieves detailed information about a specific game.
Path Parameters
Parameter | Type | Description |
---|---|---|
slug | string | The unique slug identifier for the game |
Example Response
{
"status": "success",
"data": {
"id": 5,
"name": "Endless Runner",
"slug": "endless-runner",
"description": "Run as far as you can while avoiding obstacles",
"thumbnail": "https://webplayzz.com/thumbnails/endless-runner.jpg",
"game_url": "https://webplayzz.com/games/endless-runner",
"instructions": "Tap to jump, swipe down to slide",
"active": true,
"featured": true,
"play_count": 2150,
"created_at": "2023-01-18T14:25:33.000000Z",
"updated_at": "2023-01-18T14:25:33.000000Z",
"categories": [
{
"id": 3,
"name": "Action",
"slug": "action",
"created_at": "2023-01-10T09:15:22.000000Z",
"updated_at": "2023-01-10T09:15:22.000000Z",
"pivot": {
"game_id": 5,
"category_id": 3
}
},
{
"id": 8,
"name": "Arcade",
"slug": "arcade",
"created_at": "2023-01-10T09:15:22.000000Z",
"updated_at": "2023-01-10T09:15:22.000000Z",
"pivot": {
"game_id": 5,
"category_id": 8
}
}
]
}
}
Error Handling
The API uses conventional HTTP response codes to indicate the success or failure of requests:
Status Code | Description |
---|---|
200 - OK | Request was successful |
400 - Bad Request | Invalid request parameters |
401 - Unauthorized | Missing or invalid API key |
403 - Forbidden | Domain not allowed for this API key |
404 - Not Found | Resource not found |
429 - Too Many Requests | Rate limit exceeded. Check the Retry-After header for wait time |
500 - Server Error | Unexpected server error |
Error Response Example
{
"status": "error",
"message": "API key is inactive"
}