|
| 1 | +# 🤖 AI Agent Access |
| 2 | + |
| 3 | +Use TrustIn's transaction tracing API directly from your AI agent — no account or manual API key setup required. |
| 4 | + |
| 5 | +## How It Works |
| 6 | + |
| 7 | +1. **Register** — call `POST /api/v1/agent/register` with no credentials |
| 8 | +2. **Receive** — get an API key instantly |
| 9 | +3. **Query** — use the key to call `graph_explore` and trace any address |
| 10 | + |
| 11 | +Your agent key is active immediately with a **200 requests/day** quota. |
| 12 | + |
| 13 | +## Register Your Agent |
| 14 | + |
| 15 | +```bash |
| 16 | +curl -X POST https://api.trustin.info/api/v1/agent/register \ |
| 17 | + -H "Content-Type: application/json" \ |
| 18 | + -d '{ "name": "my-aml-agent" }' |
| 19 | +``` |
| 20 | + |
| 21 | +Response: |
| 22 | + |
| 23 | +```json |
| 24 | +{ |
| 25 | + "code": 200, |
| 26 | + "data": { |
| 27 | + "agent_id": "...", |
| 28 | + "api_key": "your-api-key-here", |
| 29 | + "name": "my-aml-agent", |
| 30 | + "daily_quota": 200, |
| 31 | + "note": "Save this api_key — it will not be shown again" |
| 32 | + } |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +> **Important**: Save the `api_key` — it won't be shown again. |
| 37 | +
|
| 38 | +## Trace a Transaction |
| 39 | + |
| 40 | +```bash |
| 41 | +curl -X POST https://api.trustin.info/api/v1/graph_explore \ |
| 42 | + -H "Content-Type: application/json" \ |
| 43 | + -H "X-Api-Key: your-api-key-here" \ |
| 44 | + -d '{ |
| 45 | + "address": "0xYourAddress", |
| 46 | + "chain": "Ethereum", |
| 47 | + "direction": "out", |
| 48 | + "max_depth": 3 |
| 49 | + }' |
| 50 | +``` |
| 51 | + |
| 52 | +## MCP Tool Definition |
| 53 | + |
| 54 | +For Claude, GPT, or any MCP-compatible agent: |
| 55 | + |
| 56 | +```json |
| 57 | +{ |
| 58 | + "name": "trace_transactions", |
| 59 | + "description": "Trace blockchain transaction flows from an address. Returns connected addresses with amounts, timestamps, and risk levels.", |
| 60 | + "inputSchema": { |
| 61 | + "type": "object", |
| 62 | + "properties": { |
| 63 | + "address": { |
| 64 | + "type": "string", |
| 65 | + "description": "Blockchain address to trace" |
| 66 | + }, |
| 67 | + "chain": { |
| 68 | + "type": "string", |
| 69 | + "enum": ["Ethereum", "Tron"] |
| 70 | + }, |
| 71 | + "direction": { |
| 72 | + "type": "string", |
| 73 | + "enum": ["in", "out", "all"], |
| 74 | + "default": "out" |
| 75 | + }, |
| 76 | + "max_depth": { |
| 77 | + "type": "integer", |
| 78 | + "default": 3, |
| 79 | + "maximum": 5 |
| 80 | + }, |
| 81 | + "from_date": { |
| 82 | + "type": "string", |
| 83 | + "format": "date" |
| 84 | + }, |
| 85 | + "to_date": { |
| 86 | + "type": "string", |
| 87 | + "format": "date" |
| 88 | + } |
| 89 | + }, |
| 90 | + "required": ["address", "chain"] |
| 91 | + } |
| 92 | +} |
| 93 | +``` |
| 94 | + |
| 95 | +## Python Example |
| 96 | + |
| 97 | +```python |
| 98 | +import requests |
| 99 | + |
| 100 | +# Register once, store the key |
| 101 | +def register_agent(name="my-agent"): |
| 102 | + res = requests.post( |
| 103 | + "https://api.trustin.info/api/v1/agent/register", |
| 104 | + json={"name": name} |
| 105 | + ) |
| 106 | + return res.json()["data"]["api_key"] |
| 107 | + |
| 108 | +# Trace transactions |
| 109 | +def trace(api_key, address, chain="Ethereum"): |
| 110 | + res = requests.post( |
| 111 | + "https://api.trustin.info/api/v1/graph_explore", |
| 112 | + headers={"X-Api-Key": api_key}, |
| 113 | + json={"address": address, "chain": chain, "direction": "out", "max_depth": 3} |
| 114 | + ) |
| 115 | + return res.json()["data"] |
| 116 | + |
| 117 | +# Usage |
| 118 | +api_key = register_agent("my-aml-agent") |
| 119 | +graph = trace(api_key, "0xYourAddress") |
| 120 | +print(f"Found {graph['stats']['total_nodes']} nodes") |
| 121 | +``` |
0 commit comments