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

# API

## Base URL

```
https://mesh.heurist.xyz
```

## Agent Discovery

Browse all agents at [mesh.heurist.ai](https://mesh.heurist.ai), or fetch the metadata endpoint for the full list of agents, tools, and parameters:

```
https://mesh.heurist.ai/metadata.json
```

## REST API

All requests require an API key in the request body.

### POST /mesh\_request

```json theme={null}
{
  "api_key": "your_api_key",
  "agent_id": "CoinGeckoTokenInfoAgent",
  "input": {
    // Option 1: Natural language query
    "query": "What is the current price of Bitcoin?",

    // Option 2: Direct tool call
    "tool": "get_token_info",
    "tool_arguments": { "coingecko_id": "ethereum" },

    "raw_data_only": false  // optional, omit LLM summary if true
  }
}
```

**Response:**

```json theme={null}
{
  "result": { /* agent-specific response data */ }
}
```

### Example

```javascript theme={null}
const response = await fetch("https://mesh.heurist.xyz/mesh_request", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    api_key: "YOUR_API_KEY",
    agent_id: "CoinGeckoTokenInfoAgent",
    input: {
      tool: "get_token_info",
      tool_arguments: { coingecko_id: "ethereum" },
      raw_data_only: true
    }
  })
});
```

## x402 API

[x402](https://www.x402.org/) is an open standard that uses the HTTP 402 status code for internet-native payments. Selected Mesh agents support x402 access — pay per request with stablecoins, no API key or subscription needed.

### How It Works

1. Client sends a request to an x402-enabled agent endpoint
2. Server responds with `402 Payment Required` and payment details in headers
3. Client constructs a payment payload (a signed stablecoin transaction)
4. Client retries the request with the payment attached
5. A facilitator verifies and settles the payment on-chain, and the server delivers the response

x402 is chain-agnostic (EVM chains, Solana) with near-zero transaction costs, making it ideal for agentic pay-per-use access.

### x402-Enabled Agents

View the list of agents that support x402:

* **Base (USDC):** `https://mesh.heurist.xyz/x402/agents`
* **Solana (USDC):** `https://mesh.heurist.xyz/x402/solana/agents`
