Get credit transactions
curl --request GET \
--url https://api.example.com/api/credits/transactionsimport requests
url = "https://api.example.com/api/credits/transactions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/credits/transactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/credits/transactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/credits/transactions"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/credits/transactions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/credits/transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"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
}
}Credits
Get credit transactions
Retrieve the user’s credit transaction history
GET
/
api
/
credits
/
transactions
Get credit transactions
curl --request GET \
--url https://api.example.com/api/credits/transactionsimport requests
url = "https://api.example.com/api/credits/transactions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/credits/transactions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/credits/transactions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/credits/transactions"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/credits/transactions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/credits/transactions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"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
integer
default:"1"
Page number for pagination
integer
default:"50"
Number of transactions per page (max 100)
string
Filter by transaction type:
purchase, spend, referral, bonus, refund, grantResponse
array
required
Array of transaction objects
Show transaction properties
Show transaction properties
integer
required
Transaction ID
string
required
User ID
integer
required
Credit amount (positive for credit, negative for debit)
string
required
Transaction type:
purchase, spend, referral, bonus, refund, grantstring
required
Human-readable transaction description
string
Feature key for spend transactions (e.g., “smart_caption”, “ai_undress”)
object
Additional transaction metadata (payment ID, referral code, etc.)
integer
required
User’s credit balance after this transaction
string
required
ISO timestamp of transaction
object
required
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
| Code | Description |
|---|---|
| 200 | Success - Returns transaction history |
| 401 | Unauthorized - User not authenticated |
| 400 | Bad Request - Invalid pagination or type filter |
| 500 | Server error |
Transaction Types
| 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 |
Notes
- Transactions are ordered by
createdAtdescending (newest first) - Negative amounts indicate debits, positive indicate credits
balanceAftershows the running balance at transaction time- Metadata varies by transaction type
Related Endpoints
- Get Balance - Check current balance
- Get Pricing - View feature pricing