Skip to main content
GET
/
api
/
credits
/
transactions
Get credit transactions
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
  }
}
Returns a paginated list of all credit transactions for the authenticated user, including purchases, spending, referrals, and bonuses.

Request

page
integer
default:"1"
Page number for pagination
limit
integer
default:"50"
Number of transactions per page (max 100)
type
string
Filter by transaction type: purchase, spend, referral, bonus, refund, grant

Response

transactions
array
required
Array of transaction objects
pagination
object
required
Pagination metadata

Example Request

curl "https://your-domain.com/api/credits/transactions?page=1&limit=10&type=spend" \
  -H "Cookie: connect.sid=your-session-cookie"

Example Response

{
  "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
  }
}

Response Codes

CodeDescription
200Success - Returns transaction history
401Unauthorized - User not authenticated
400Bad Request - Invalid pagination or type filter
500Server error

Transaction Types

TypeDescription
purchaseCredits purchased with real money
spendCredits spent on features
referralCredits earned from referrals
bonusBonus credits (daily bonus, promotions)
refundCredits refunded (failed operations)
grantAdmin-granted credits

Notes

  • Transactions are ordered by createdAt descending (newest first)
  • Negative amounts indicate debits, positive indicate credits
  • balanceAfter shows the running balance at transaction time
  • Metadata varies by transaction type

Build docs developers (and LLMs) love