Retrieve Recharge History

The recharge_history endpoint allows you to query the history of recharge transactions for an organization. It includes details such as the recharge amount, bonus amount, payment method, transaction ID, and creation time. This endpoint supports pagination to efficiently navigate through historical records.

API Endpoint

To retrieve recharge history, send a GET request to the following URL:

GET https://api.genaifactory.ai/v1/recharge_history

Headers

Ensure that your request includes the following header:

Name

Type

Required

Description

formacloud-api-key

string

Yes

API key required for authenticating your request.

Query Parameters

You can use the following query parameters to specify the time period, pagination, and other details for retrieving the recharge history:

Name

Type

Required

Description

start

string

No

The start date of the history retrieval period in UTC (e.g., 2023-01-01T00:00:00Z).

end

string

No

The end date of the history retrieval period in UTC (e.g., 2023-01-31T23:59:59Z).

page_size

int

No

The maximum number of records to retrieve per page (default: 10).

page

int

No

The page number to retrieve (default: 0).

Response Body

The response will include a list of recharge records and pagination details. Each recharge record contains the following information:

Name

Type

Required

Description

recharge_id

int

Yes

The unique identifier of the recharge record.

recharge_amount

decimal

Yes

The amount of money recharged.

bonus_amount

decimal

No

The bonus amount received during the recharge.

payment_method

string

No

The payment method used for the recharge (e.g., Credit Card).

transaction_id

string

Yes

The unique transaction ID for the recharge.

note

string

No

Additional notes about the recharge.

recharge_time

string

Yes

The time when the recharge occurred, in UTC.

Example Request

curl -G 'https://api.genaifactory.ai/v1/recharge_history' \
-H 'formacloud-api-key: abc123' \
--data-urlencode "start=2023-01-01T00:00:00Z&end=2023-01-31T23:59:59Z&page_size=10&page=1"

Example Response

Success Response (Status Code 200)

{
    "history": [
        {
            "recharge_id": 1,
            "recharge_amount": 100.00,
            "bonus_amount": 10.00,
            "payment_method": "Credit Card",
            "transaction_id": "TXN123456789",
            "note": "Spring Promo",
            "recharge_time": "2023-01-10T14:35:29Z"
        },
        {
            "recharge_id": 2,
            "recharge_amount": 200.00,
            "bonus_amount": 0.00,
            "payment_method": "PayPal",
            "transaction_id": "TXN987654321",
            "note": "",
            "recharge_time": "2023-01-15T09:22:10Z"
        }
    ],
    "pagination": {
        "current_page": 1,
        "total_pages": 5,
        "total_records": 50
    }
}

Failure Response (Status Code 4XX)

{
    "error": "Invalid date range"
}

Last updated