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

# Get Agent Info

> Check if an agent exists and get its owner address

## Overview

Returns whether an agent exists in the [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) Identity Registry on Base, along with its owner address. Use this to validate an agent ID before submitting reputation feedback.

<Info>
  This is a free endpoint (0 Cred Units). It reads directly from the on-chain Identity Registry contract on Base.
</Info>

## Authentication

| Method       | Header                               | Cost         |
| ------------ | ------------------------------------ | ------------ |
| API Token    | `Authorization: Bearer YOUR_API_KEY` | 0 Cred Units |
| x402 Payment | `X-PAYMENT: <signed_payment>`        | Free         |

## Path Parameters

<ParamField path="agent_id" type="integer" required>
  ERC-8004 agent ID (ERC-721 token ID in the Identity Registry). Must be >= 1.
</ParamField>

## Response

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

<ResponseField name="owner" type="string">
  Ethereum address of the agent's owner (checksummed)
</ResponseField>

<ResponseField name="metadata" type="object">
  Agent registration metadata from tokenURI (null if unavailable)
</ResponseField>

<ResponseField name="metadata.name" type="string">
  Agent name from registration metadata
</ResponseField>

<ResponseField name="metadata.description" type="string">
  Agent description from registration metadata
</ResponseField>

<ResponseField name="metadata.image" type="string">
  Agent image URI from registration metadata
</ResponseField>

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

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

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

  const agent = await response.json();
  console.log(`Agent ${agent.agent_id} owned by ${agent.owner}`);
  ```

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

  agent_id = 1

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

  agent = response.json()
  print(f"Agent {agent['agent_id']} owned by {agent['owner']}")
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "agent_id": 1,
    "owner": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    "metadata": {
      "name": "Example Agent",
      "description": "An example AI agent registered on-chain",
      "image": "ipfs://QmExample123"
    }
  }
  ```

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

  ```json 422 theme={null}
  {
    "detail": [
      {
        "type": "greater_than_equal",
        "loc": ["path", "agent_id"],
        "msg": "Input should be greater than or equal to 1"
      }
    ]
  }
  ```
</ResponseExample>

## Performance

* **Response Time**: Typically under 1 second
* **Data Source**: On-chain `ownerOf()` call to the Identity Registry on Base (chain 8453)
