> ## Documentation Index
> Fetch the complete documentation index at: https://blackswan-23965643.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# GET /v1/history/{wallet} — On-Chain Loan History

> GET /v1/history/{wallet} — Returns total loans, successful repayments, and default count for any EVM wallet address on the BlackSwan protocol.

This endpoint returns the complete loan performance history for a wallet — including total loans taken, how many were repaid successfully, and how many resulted in a default. Use it when you need to audit a wallet's track record or display a repayment scorecard to users.

<ParamField path="wallet" type="string" required>
  The EVM wallet address to query (e.g. `0x4EEA76237a91880B1c8B7a1c740610fFC0306EE4`).
</ParamField>

<ParamField query="network" type="string">
  The network to query. Accepted values: `amoy` (default) or `sepolia`.
</ParamField>

## Endpoint

```
GET https://api.blackswanfinance.xyz/v1/history/{wallet}
```

## Request Example

<CodeGroup>
  ```bash Amoy (default) theme={null}
  curl https://api.blackswanfinance.xyz/v1/history/0x4EEA76237a91880B1c8B7a1c740610fFC0306EE4
  ```

  ```bash Sepolia theme={null}
  curl "https://api.blackswanfinance.xyz/v1/history/0x4EEA76237a91880B1c8B7a1c740610fFC0306EE4?network=sepolia"
  ```
</CodeGroup>

## Response — 200 OK

```json theme={null}
{
  "totalLoans": 1,
  "successfulLoans": 1,
  "defaults": 0
}
```

<ResponseField name="totalLoans" type="number">
  The total number of loans the wallet has taken out on the specified network, regardless of outcome.
</ResponseField>

<ResponseField name="successfulLoans" type="number">
  The number of loans the wallet has fully repaid without defaulting. A value equal to `totalLoans` indicates a perfect repayment record.
</ResponseField>

<ResponseField name="defaults" type="number">
  The number of loans that resulted in a default. A value of `0` indicates the wallet has never defaulted.

  <Expandable title="How defaults affect credit">
    Each default reduces the wallet's `trustRatio`, which in turn raises its `currentApr` and can lower its credit tier. Repeated defaults may move a wallet from tier `C` down to tier `D` or `E`. You can inspect the current trust ratio and tier using [GET /v1/credit](/api/credit).
  </Expandable>
</ResponseField>

## Error Codes

| Status Code | Meaning                                                                       |
| ----------- | ----------------------------------------------------------------------------- |
| `400`       | Invalid wallet address — the address is malformed or not a valid EVM address. |
| `500`       | Server error — an unexpected error occurred on the BlackSwan API.             |
