Du-Hub Creator API Documentation
Overview
The Du-Hub Creator API provides access to creation statistics and data for authenticated creators. The API uses token-based authentication via Laravel Sanctum.
Base URL
https://du-hub.com/api/v1
Authentication
All API requests require authentication using a Bearer token. Include your token in the Authorization header:
Authorization: Bearer YOUR_TOKEN_HERE
Creating API Tokens
You can create API tokens through the web interface at /api-tokens or via the API:
POST /tokens
{
"email": "your@email.com",
"password": "your_password",
"token_name": "My API Token",
"abilities": ["read"]
}
Response:
{
"success": true,
"data": {
"token": "1|abc123...",
"token_name": "My API Token",
"abilities": ["read"],
"expires_at": null
}
}
Rate Limiting
API requests are rate limited to 60 requests per minute per user.
Endpoints
Token Management
List Tokens
GET /tokens
Returns all API tokens for the authenticated user.
Response:
{
"success": true,
"data": [
{
"id": 1,
"name": "My API Token",
"abilities": ["read"],
"last_used_at": "2025-01-15T10:30:00Z",
"created_at": "2025-01-10T09:00:00Z"
}
]
}
Delete Token
DELETE /tokens/{token_id}
Deletes the specified API token.
Response:
{
"success": true,
"message": "Token deleted successfully."
}
Creator Data
Get Profile
GET /creator/profile
Returns the authenticated user's profile information and statistics.
Response:
{
"success": true,
"data": {
"id": 1,
"username": "creator123",
"name": "John Doe",
"email": "john@example.com",
"bio": "Lua script developer",
"profile_picture": "/storage/profiles/avatar.jpg",
"created_at": "2025-01-01T00:00:00Z",
"statistics": {
"creation_count": 15,
"total_downloads": 1250,
"total_likes": 89,
"forum_posts": 42,
"badges_count": 5
}
}
}
List Creations
GET /creator/creations
Returns paginated list of the authenticated user's creations.
Query Parameters:
page(optional): Page number for pagination
Response:
{
"success": true,
"data": {
"data": [
{
"id": 1,
"title": "Advanced HUD Script",
"slug": "advanced-hud-script",
"description": "A comprehensive HUD for ships",
"category_id": 2,
"version": "1.2.0",
"download_count": 150,
"like_count": 12,
"file_size": 2048576,
"is_approved": true,
"created_at": "2025-01-05T10:00:00Z",
"updated_at": "2025-01-10T15:30:00Z"
}
],
"links": {
"first": "...",
"last": "...",
"prev": null,
"next": "..."
},
"meta": {
"current_page": 1,
"per_page": 20,
"total": 15
}
}
}
Get Specific Creation
GET /creator/creations/{creation_id}
Returns detailed information about a specific creation.
Response:
{
"success": true,
"data": {
"id": 1,
"title": "Advanced HUD Script",
"slug": "advanced-hud-script",
"description": "A comprehensive HUD for ships",
"category": {
"id": 2,
"name": "Lua Scripts",
"slug": "lua-scripts"
},
"tags": [
{
"id": 1,
"name": "HUD",
"slug": "hud"
}
],
"version": "1.2.0",
"changelog": "Fixed display issues",
"download_count": 150,
"like_count": 12,
"file_size": 2048576,
"file_path": "creations/1/1/1.2.0/script.lua",
"is_approved": true,
"created_at": "2025-01-05T10:00:00Z",
"updated_at": "2025-01-10T15:30:00Z",
"versions": [
{
"id": 1,
"version": "1.0.0",
"file_path": "creations/1/1/1.0.0/script.lua",
"changelog": "Initial release",
"created_at": "2025-01-05T10:00:00Z"
}
],
"statistics": {
"daily_downloads": {
"labels": ["2025-01-01", "2025-01-02", "..."],
"data": [5, 8, 12, "..."]
},
"weekly_downloads": {
"labels": ["2024-12-01", "2024-12-08", "..."],
"data": [25, 35, 42, "..."]
},
"monthly_downloads": {
"labels": ["2024-01", "2024-02", "..."],
"data": [120, 150, 180, "..."]
}
}
}
}
Get Statistics
GET /creator/statistics
Returns comprehensive statistics for the authenticated user.
Response:
{
"success": true,
"data": {
"overview": {
"total_creations": 15,
"total_downloads": 1250,
"total_likes": 89,
"total_file_size": 52428800,
"approved_creations": 14,
"pending_creations": 1
},
"top_creations": [
{
"id": 1,
"title": "Advanced HUD Script",
"slug": "advanced-hud-script",
"download_count": 150,
"like_count": 12
}
],
"recent_activity": {
"recent_uploads": [
{
"id": 15,
"title": "New Factory Script",
"slug": "new-factory-script",
"created_at": "2025-01-15T10:00:00Z"
}
],
"recent_updates": [
{
"id": 1,
"title": "Advanced HUD Script",
"slug": "advanced-hud-script",
"updated_at": "2025-01-10T15:30:00Z"
}
]
},
"category_breakdown": [
{
"category": "Lua Scripts",
"count": 10,
"downloads": 800
},
{
"category": "Blueprints",
"count": 5,
"downloads": 450
}
],
"monthly_stats": [
{
"month": "2024-12",
"uploads": 2,
"total_downloads": 150,
"total_likes": 12
},
{
"month": "2025-01",
"uploads": 3,
"total_downloads": 200,
"total_likes": 18
}
]
}
}
Error Responses
All error responses follow this format:
{
"success": false,
"message": "Error description",
"errors": {
"field": ["Specific validation errors"]
}
}
Common HTTP Status Codes
200- Success201- Created (for token creation)400- Bad Request401- Unauthorized (invalid or missing token)403- Forbidden (insufficient permissions)404- Not Found422- Validation Error429- Too Many Requests (rate limited)500- Internal Server Error
Token Abilities
Currently supported token abilities:
read- Read access to creator data and statisticswrite- Write access (reserved for future features)
Versioning
The API is versioned using URL prefixes (/api/v1). Breaking changes will result in a new version number.
Support
For API support, please contact us through the platform or create an issue in our repository.