Account Information
GET
/account/profile
Retrieve your account profile and credit balance.
Example Response
{
"success": true,
"data": {
"user": {
"email": "user@example.com",
"full_name": "John Doe",
"created_at": "2024-01-15T10:30:00Z"
},
"credit_balance": {
"total": 1500.00,
"subscription": 1000.00,
"pay_as_you_go": 500.00
}
}
}
Services
GET
/services
List all available services and their credit costs.
Example Response
{
"success": true,
"data": {
"services": [
{
"id": 1,
"name": "Text Processing",
"description": "Advanced text analysis and processing",
"credit_cost": 10.00,
"is_active": true
},
{
"id": 2,
"name": "Image Analysis",
"description": "AI-powered image recognition and analysis",
"credit_cost": 25.00,
"is_active": true
}
]
}
}
POST
/services/{service_id}/use
Use a service (consumes credits based on service cost).
Request Body
{
"input_data": {
// Service-specific input parameters
}
}
Example Response
{
"success": true,
"data": {
"result": {
// Service-specific output
},
"credits_consumed": 10.00,
"remaining_balance": 1490.00
}
}
Credit Management
GET
/credits/balance
Get current credit balance with detailed breakdown.
Example Response
{
"success": true,
"data": {
"total_balance": 1500.00,
"subscription_credits": {
"amount": 1000.00,
"expires_at": "2024-02-15T23:59:59Z"
},
"pay_as_you_go_credits": {
"amount": 500.00,
"expires_at": null
}
}
}
GET
/credits/transactions
List recent credit transactions with pagination.
Query Parameters
page
- Page number (default: 1)
limit
- Items per page (default: 20, max: 100)
type
- Filter by transaction type (purchase, subscription, consumption, admin)
Example Response
{
"success": true,
"data": {
"transactions": [
{
"id": 123,
"amount": -10.00,
"description": "Text Processing service usage",
"type": "consumption",
"created_at": "2024-01-20T14:30:00Z"
}
],
"pagination": {
"current_page": 1,
"total_pages": 5,
"total_items": 95
}
}
}