# View unit history

Endpoint: GET /s2s/v1.0/client/credit/history
Security: BearerAuthentication

## Security:

  - `BearerAuthentication` (unknown)
    http bearer

## Query parameters:

  - `page_size` (integer)
    Number of results to return in a page. Valid value should be between 1 and 30. Default 20.

  - `starting_token` (string)
    Token for current page. Start with `null` for the first page, and use `next_token` from the previous response to start next page

## Response 200:

  - `200` (unknown)
    Successful retrieval of the unit usage history

## Response 200 fields (application/json):

  - `status` (integer)
    Response status
    Example: 200

  - `result` (object)

  - `result.next_token` (string)
    Token to query next page.
    Example: 73a3c9e69b89

  - `result.history` (array)

  - `result.history.id` (integer)
    Unique identifier of the history
    Example: 38173479337460984

  - `result.history.timestamp` (integer)
    Unix timestamp of the history (ms)
    Example: 1703146067000

  - `result.history.action` (string)
    Action of this history
    Enum: "photo_enhance", "api_photo_enhance", "object_removal", "api_object_removal", "background_removal", "api_background_removal", "colorize", "api_colorize", "text_to_image", "api_text_to_image", "hair_style", "api_hair_style", "blur_background", "change_background", "wig", "trial_gift_text_to_image", "sign_up_gift", "subscription_credits", "subscriber_gift", "permanent_credits", "compensation_from_customer_service", "renew", "expire"

  - `result.history.target_id` (string)
    Id of the target for this unit. For example, when running AI Photo Enhance task, `target_id` for this history will be `task_id` of the AI Photo Enhance task. When purchasing unit, the `target_id` for this history will be `order_id`
    Example: 7TWFkuE2Z9uR0NOxSmQ1rh4PJ5Zx7YJ5U9SAz51q0QHVwMP+Jb1XbjPsf7ZgUgLY

  - `result.history.info` (object)

  - `result.history.info.credits` (array)
    Detailed information for each unit
    Example: [{"id":24409059381740548,"amount":-2},{"id":27297116883780870,"amount":0}]

  - `result.history.info.credits.id` (integer)
    Id of the unit

  - `result.history.info.credits.amount` (integer)
    This paramenter is deprecated. Use amount_dec instead. Total amount changed from this unit.

  - `result.history.info.credits.amount_dec` (number)
    The net change in units recorded, presented to two decimal places.

  - `result.history.info.dst_actions` (array)
    The dst_actions of skin analysis
    Example: [ "hd_wrinkle", "hd_pore", "hd_texture" ]

## Response 400:

  - `400` (unknown)
    Invalid request parameters

## Response 400 fields (application/json):

  - `status` (integer)
    Response status
    Example: 400

  - `error` (string)
    Example: Invalid parameter value

  - `error_code` (string)
    Example: InvalidParameters

## Response 401:

  - `401` (unknown)
    Invalid access token

## Response 401 fields (application/json):

  - `status` (integer)
    Response status
    Example: 401

  - `error_code` (string)
    Error code:
* InvalidAccessToken - Access token is not given or not valid
    Enum: "InvalidAccessToken"

