> ## 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.

# Submit Reputation Feedback

> Submit on-chain reputation feedback for an AI agent

## Overview

Computes Cred Protocol credit score, sybil risk, and identity attestations for the given agent, then submits the results as on-chain feedback to the [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) Reputation Registry on Base.

The submission happens **asynchronously** — this endpoint returns immediately with a tracking ID. Use the [status endpoint](/api-reference/agents/submission-status) to poll for completion.

<Warning>
  This endpoint costs **10 Cred Units** per submission (covers computation + on-chain gas on Base).
</Warning>

## Authentication

| Method       | Header                               | Cost          |
| ------------ | ------------------------------------ | ------------- |
| API Token    | `Authorization: Bearer YOUR_API_KEY` | 10 Cred Units |
| x402 Payment | `X-PAYMENT: <signed_payment>`        | \$0.10 USDC   |

## Path Parameters

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

## Request Body

<ParamField body="address" type="string" required>
  Ethereum address to score for this agent (e.g., `0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045`)
</ParamField>

<ParamField body="tags" type="array">
  Which feedback types to submit. Defaults to all three if omitted.

  Options: `creditScore`, `sybilRisk`, `identityCount`
</ParamField>

## Feedback Tags

| Tag             | Description                              | Value Range           |
| --------------- | ---------------------------------------- | --------------------- |
| `creditScore`   | Andromeda 1.0 credit score               | 300–1000              |
| `sybilRisk`     | Sybil detection risk score               | 0 (human) – 100 (bot) |
| `identityCount` | Number of verified identity attestations | 0+                    |

## Response

Returns HTTP **202 Accepted** with a tracking ID.

<ResponseField name="submission_id" type="string">
  UUID tracking this submission
</ResponseField>

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

<ResponseField name="status" type="string">
  Initial status (always `pending`)
</ResponseField>

<ResponseField name="estimated_completion_seconds" type="integer">
  Estimated time to on-chain confirmation (typically \~45 seconds)
</ResponseField>

<ResponseField name="status_url" type="string">
  Relative URL to poll for submission status
</ResponseField>

<ResponseField name="tags" type="array">
  Feedback types being submitted
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.credprotocol.com/api/v2/agents/18/reputation" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"}'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.credprotocol.com/api/v2/agents/18/reputation', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
    })
  });

  const data = await response.json();
  console.log(`Submission ${data.submission_id} — status: ${data.status}`);
  console.log(`Poll: ${data.status_url}`);
  ```

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

  response = requests.post(
      'https://api.credprotocol.com/api/v2/agents/18/reputation',
      headers={'Authorization': 'Bearer YOUR_API_KEY'},
      json={'address': '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'}
  )

  data = response.json()
  print(f"Submission {data['submission_id']} — status: {data['status']}")
  print(f"Poll: {data['status_url']}")
  ```
</RequestExample>

<ResponseExample>
  ```json 202 theme={null}
  {
    "submission_id": "550e8400-e29b-41d4-a716-446655440000",
    "agent_id": 18,
    "status": "pending",
    "estimated_completion_seconds": 45,
    "status_url": "/api/v2/agents/18/reputation/status/550e8400-e29b-41d4-a716-446655440000",
    "tags": ["creditScore", "sybilRisk", "identityCount"]
  }
  ```

  ```json 400 theme={null}
  {
    "detail": "address is required in the request body — the Ethereum address to score for this agent"
  }
  ```

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

## Submission Lifecycle

The submission progresses through these statuses:

| Status       | Description                                                   |
| ------------ | ------------------------------------------------------------- |
| `pending`    | Submission received, queued for processing                    |
| `scoring`    | Computing credit score, sybil risk, and identity attestations |
| `uploading`  | Uploading feedback JSON to IPFS                               |
| `submitting` | Sending `giveFeedback` transaction to Base                    |
| `confirmed`  | Transaction confirmed on-chain                                |
| `failed`     | An error occurred (check the `error` field)                   |

## Performance

* **Response Time**: Immediate (HTTP 202)
* **End-to-End Completion**: \~45 seconds (scoring + IPFS upload + on-chain confirmation)
