curl --request GET \
--url https://api.example.com/api/credits/transactions{
"transactions": [
{
"id": 123,
"userId": "<string>",
"amount": 123,
"type": "<string>",
"description": "<string>",
"featureKey": "<string>",
"metadata": {},
"balanceAfter": 123,
"createdAt": "<string>"
}
],
"pagination": {
"page": 123,
"limit": 123,
"total": 123,
"pages": 123
}
}Retrieve the user’s credit transaction history
curl --request GET \
--url https://api.example.com/api/credits/transactions{
"transactions": [
{
"id": 123,
"userId": "<string>",
"amount": 123,
"type": "<string>",
"description": "<string>",
"featureKey": "<string>",
"metadata": {},
"balanceAfter": 123,
"createdAt": "<string>"
}
],
"pagination": {
"page": 123,
"limit": 123,
"total": 123,
"pages": 123
}
}purchase, spend, referral, bonus, refund, grantShow transaction properties
purchase, spend, referral, bonus, refund, grantcurl "https://your-domain.com/api/credits/transactions?page=1&limit=10&type=spend" \
-H "Cookie: connect.sid=your-session-cookie"
{
"transactions": [
{
"id": 1234,
"userId": "user-abc-123",
"amount": -25,
"type": "spend",
"description": "AI Undress - High Quality",
"featureKey": "ai_undress_high",
"metadata": {
"imageId": "img-789"
},
"balanceAfter": 175,
"createdAt": "2026-03-02T14:30:00.000Z"
},
{
"id": 1233,
"userId": "user-abc-123",
"amount": 100,
"type": "purchase",
"description": "Credit Package Purchase",
"featureKey": null,
"metadata": {
"paymentId": "pay-xyz-456",
"packageId": 1
},
"balanceAfter": 200,
"createdAt": "2026-03-02T10:15:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 45,
"pages": 5
}
}
| Code | Description |
|---|---|
| 200 | Success - Returns transaction history |
| 401 | Unauthorized - User not authenticated |
| 400 | Bad Request - Invalid pagination or type filter |
| 500 | Server error |
| Type | Description |
|---|---|
purchase | Credits purchased with real money |
spend | Credits spent on features |
referral | Credits earned from referrals |
bonus | Bonus credits (daily bonus, promotions) |
refund | Credits refunded (failed operations) |
grant | Admin-granted credits |
createdAt descending (newest first)balanceAfter shows the running balance at transaction time