> ## Documentation Index
> Fetch the complete documentation index at: https://docs.credprotocol.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Reputation Summary

> Read on-chain aggregated reputation summary for an agent

## Overview

Reads the aggregated feedback summary from the [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) Reputation Registry on Base. Returns the count and average of all Cred Protocol feedback entries for the specified agent, broken down by tag.

<Info>
  This is a view call (no gas cost) that reads directly from the on-chain Reputation Registry.
</Info>

## Authentication

| Method       | Header                               | Cost        |
| ------------ | ------------------------------------ | ----------- |
| API Token    | `Authorization: Bearer YOUR_API_KEY` | 1 Cred Unit |
| x402 Payment | `X-PAYMENT: <signed_payment>`        | \$0.01 USDC |

## Path Parameters

<ParamField path="agent_id" type="integer" required>
  ERC-8004 agent ID. Must be >= 1.
</ParamField>

## Response

<ResponseField name="agent_id" type="integer">
  The ERC-8004 agent ID
</ResponseField>

<ResponseField name="summaries" type="array">
  Summary per feedback tag (only includes tags with at least one entry)
</ResponseField>

<ResponseField name="summaries[].tag1" type="string">
  Feedback metric type (e.g., `creditScore`, `sybilRisk`, `identityCount`)
</ResponseField>

<ResponseField name="summaries[].tag2" type="string">
  Provider identifier (always `credprotocol` for Cred submissions)
</ResponseField>

<ResponseField name="summaries[].count" type="integer">
  Number of feedback entries for this tag
</ResponseField>

<ResponseField name="summaries[].summary_value" type="number">
  Aggregated value (sum or average depending on the contract implementation)
</ResponseField>

<ResponseField name="summaries[].summary_value_decimals" type="integer">
  Decimal places for the summary value
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.credprotocol.com/api/v2/agents/18/reputation/summary" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const agentId = 18;

  const response = await fetch(`https://api.credprotocol.com/api/v2/agents/${agentId}/reputation/summary`, {
    headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
  });

  const data = await response.json();
  data.summaries.forEach(s => {
    console.log(`${s.tag1}: ${s.summary_value} (${s.count} entries)`);
  });
  ```

  ```python Python theme={null}
  import requests

  agent_id = 18

  response = requests.get(
      f'https://api.credprotocol.com/api/v2/agents/{agent_id}/reputation/summary',
      headers={'Authorization': 'Bearer YOUR_API_KEY'}
  )

  data = response.json()
  for s in data['summaries']:
      print(f"{s['tag1']}: {s['summary_value']} ({s['count']} entries)")
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "agent_id": 18,
    "summaries": [
      {
        "tag1": "creditScore",
        "tag2": "credprotocol",
        "count": 5,
        "summary_value": 745.0,
        "summary_value_decimals": 0
      },
      {
        "tag1": "sybilRisk",
        "tag2": "credprotocol",
        "count": 5,
        "summary_value": 15.0,
        "summary_value_decimals": 0
      },
      {
        "tag1": "identityCount",
        "tag2": "credprotocol",
        "count": 5,
        "summary_value": 3.0,
        "summary_value_decimals": 0
      }
    ]
  }
  ```

  ```json 404 theme={null}
  {
    "detail": "Agent 999 does not exist in the Identity Registry"
  }
  ```
</ResponseExample>

## Performance

* **Response Time**: Typically 1-3 seconds (multiple on-chain view calls)
* **Data Source**: On-chain `getSummary()` calls to the Reputation Registry on Base (chain 8453)
