> For the complete documentation index, see [llms.txt](https://tetron.gitbook.io/tetron/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tetron.gitbook.io/tetron/tetron.fun-api-refference.md).

# Tetron.fun - API Refference

## API Reference

This section provides complete details on all available API endpoints, including HTTP methods, URI paths, request parameters, example payloads, response schemas, and common error codes.

### 1. Base Configuration

* **Base URL**\
  <https://api.tetronfun.com/v1>
* **Authentication**\
  All REST requests must include an HTTP header:\
  Authorization: Bearer \<YOUR\_API\_KEY>\
  Content-Type: application/json
* **Rate Limits**
* 100 requests per minute per API key
* 429 responses include `Retry-After` header with wait time in seconds

### 2. Error Responses

| HTTP Status | Code                | Description                                  |
| ----------- | ------------------- | -------------------------------------------- |
| 400         | `BAD_REQUEST`       | Malformed request or missing parameters      |
| 401         | `UNAUTHORIZED`      | Invalid or expired API key                   |
| 403         | `FORBIDDEN`         | Insufficient scope for this endpoint         |
| 404         | `NOT_FOUND`         | Resource not found (e.g., transaction ID)    |
| 422         | `UNPROCESSABLE`     | Semantic errors (e.g., invalid network code) |
| 429         | `TOO_MANY_REQUESTS` | Rate limit exceeded                          |
| 500         | `SERVER_ERROR`      | Internal server error; retryable             |

Error responses follow this schema:

```json
{
"error": {
  "code": "BAD_REQUEST",
  "message": "Description of the error"
}
}
3. REST Endpoints

3.1 Score Transaction
Submit a transaction payload for fraud and reputation scoring.

Method: POST
Path: /score
Request Body:
{
  "from_address": "0xabc123...def",
  "to_address":   "0xdef456...abc",
  "amount":       "0.5",
  "currency":     "ETH",
  "network":      "ethereum"
}
Field	Type	Required	Description
from_address	string	Yes	Sender’s wallet address (hex or base58)
to_address	string	Yes	Recipient’s wallet address
amount	string	Yes	Amount to transfer (as string for precision)
currency	string	Yes	Asset symbol (e.g., ETH, USDC)
network	string	Yes	Blockchain network identifier
Response (200 OK):
{
  "transaction_id":    "tx_01F8XYZ...",
  "fraud_score":       12.7,
  "reputation_score":  87.3,
  "recommendation":    "approve",
  "model_version":     "2025-05-10"
}
Field	Type	Description
transaction_id	string	Unique ID for this scoring request
fraud_score	number	0–100 likelihood of fraudulent behavior
reputation_score	number	0–100 trustworthiness of involved addresses
recommendation	string	approve 
model_version	string	Version/date of AI model used
3.2 Get Transaction Status
Retrieve details for a previously scored transaction.

Method: GET
Path: /score/{transaction_id}
Path Parameters:
Name	Type	Description
transaction_id	string	ID returned by the /score endpoint
Response (200 OK):
{
  "transaction_id":    "tx_01F8XYZ...",
  "status":            "completed",
  "fraud_score":       12.7,
  "reputation_score":  87.3,
  "recommendation":    "approve",
  "created_at":        "2025-05-17T08:34:21Z",
  "model_version":     "2025-05-10"
}
Field	Type	Description
status	string	pending 
created_at	string	ISO 8601 timestamp of scoring completion
3.3 Wallet Reputation Only
Fetch reputation score for one or more wallet addresses.

Method: POST
Path: /reputation
Request Body:
{
  "addresses": ["0xabc123...def", "0xdef456...abc"],
  "network":   "ethereum"
}
Field	Type	Required	Description
addresses	string[]	Yes	List of wallet addresses
network	string	Yes	Blockchain network identifier
Response (200 OK):
{
  "results": [
    { "address": "0xabc123...def", "score": 92.1 },
    { "address": "0xdef456...abc", "score": 75.4 }
  ],
  "model_version": "2025-05-10"
}
3.4 Smart Routing Quote
Obtain optimal routing quote for a payment.

Method: POST
Path: /route/quote
Request Body:
{
  "from_address": "0xabc123...def",
  "to_address":   "0xdef456...abc",
  "amount":       "100",
  "currency":     "USDC",
  "network":      "ethereum",
  "max_fee":      "5" 
}
Field	Type	Required	Description
max_fee	string	No	Maximum fee you’re willing to pay (in fiat)
Response (200 OK):
{
  "route_id":     "rt_01G4XYZ...",
  "estimated_fee":"1.24",
  "steps": [
    { "network": "ethereum", "fee": "0.84" },
    { "network": "polygon",  "fee": "0.40" }
  ],
  "total_time":   35, 
  "recommendation": "multi_hop",
  "model_version":  "2025-05-10"
}
4. WebSocket Endpoints

4.1 Real‑Time Score Stream
Subscribe to a live stream of scoring results.

URL:
wss://api.tetronfun.com/v1/stream
Authentication:
On connect, send:
{
  "action": "authenticate",
  "apiKey": "<YOUR_API_KEY>"
}
Subscribe:
{
  "action": "subscribe",
  "channels": ["scores"]
}
Message Format:
{
  "channel": "scores",
  "data": {
    "transaction_id": "tx_01F8XYZ...",
    "fraud_score":    12.7,
    "reputation_score": 87.3,
    "timestamp":      "2025-05-17T08:34:21Z"
  }
}
5. Versioning & Deprecation

All endpoints are versioned under /v1. Future breaking changes will be introduced in /v2.
Deprecated endpoints will return HTTP 426 with information on migration paths.
```
