Get Credit Histories

Get Credit Histories

Retrieve the complete history of credit purchases, allocations, returns, and free credits for a specific organization by providing the organization UUID. This endpoint supports pagination and filtering via query parameters, allowing you to view credit history records in a paginated format.


Request Details

  • Method: GET

  • URL: {{host}}/api/v2/credits/histories

  • Query Parameters:

    • page (number, required): The page number for the results.

    • per_page (number, required): The number of results to include per page.

    • organization_uuid (string, required): The UUID of the organization whose credit history you want to retrieve.

    • user_type (string, optional): Filter by user type (e.g., ENTERPRISE_API).

    • sort (string, optional): Field to sort by (e.g., received_by).

    • order (string, optional): Sort order (asc or desc).


Example Response

{
  "page": 2,
  "per_page": 1,
  "total": 25,
  "histories": [
    {
      "id": "c1a2b3d4-5678-90ab-cdef-1234567890ab",
      "organization_uuid": "44b24ef6-098c-4481-93ac-4ab48aa6e16d",
      "type": "purchase",
      "amount": 1000,
      "currency": "USD",
      "created_at": "2024-06-01T12:34:56Z",
      "user_type": "ENTERPRISE_API",
      "details": {
        "source": "admin",
        "note": "Initial purchase"
      }
    }
  ]
}

Sample Error Response

{
  "error": {
    "code": 400,
    "message": "Missing required parameter: organization_uuid"
  }
}

Usage Notes

  • Authentication: This endpoint requires a valid user token. Ensure the user-token variable is set in your environment or request headers.

  • Pagination: Use the page and per_page query parameters to navigate through paginated results.

  • Required Parameters: organization_uuid, page, and per_page must be provided. Omitting required parameters will result in an error response.

  • Sorting and Filtering: Optional parameters like sort, order, and user_type can be used to refine results.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Query Params
integer
integer
string
string
Response

Language
Credentials
Bearer
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here!