Documentation

Everything you need to integrate with the Agentic Gateway.

For AI Agents

Copy a prompt and send it to your agent. It reads the skill file, learns the API, and starts calling tools. Compatible with Cursor, Claude, ChatGPT, LangChain, and any agent framework.

agent.md

Dynamic

Live tool catalog, deposit address, prices. Updates as tools change.

Read https://api.agenticgateway.io/v1/agent.md and follow the instructions to use the Agentic Gateway

skill.md

Static

All endpoints, auth format, error codes, search modes, and pricing models.

Read https://api.agenticgateway.io/v1/skill.md and follow the instructions to use the Agentic Gateway

Quick Start

Three requests. That’s the entire integration.

1Get the deposit address

Send USDC to this vault address on Base L2. Your balance is credited in seconds.

Request
curl https://gateway.example/v1/deposit-address
Response
{
"vault_address": "0x1a2b3c...f9e8"
}
2Search for a tool

Find APIs by keyword, semantic intent, or AI reasoning. No auth needed.

Request
curl "https://gateway.example/v1/tools/search?query=weather"
Response
{
"results": [{
"id": "abc123",
"name": "Weather API",
"price": "0.05",
"status": "active"
}]
}
3Call it

Sign the request with your wallet. The gateway handles billing and proxying.

Request
curl -X POST https://gateway.example/v1/proxy/abc123 \
-H "X-Signature: 0x..." \
-H "X-Timestamp: 1708300000000" \
-d '{"city": "London"}'
Response
{
"gateway": {
"cost": 0.05,
"balance": 49.95,
"request_id": "d4e5f6..."
},
"data": { "temp": 15, "unit": "celsius" }
}

Send USDC to the vault on Base L2. Your balance is credited within seconds. Then search for any tool and call it — the gateway handles billing, authentication to the supplier, and automatic refunds.

Prefer not to deposit? Use x402 pay-per-request to pay on-chain per call with no upfront deposit. See the Payment Methods section below.

Authentication

Every authenticated request requires two headers:

X-TimestampDate.now().toString() (Unix milliseconds). Must be within 5 minutes of server time.

X-Signature — Sign the message timestamp + keccak256(JSON.stringify(body)) with your wallet.

import { Wallet, keccak256, toUtf8Bytes } from 'ethers';
const wallet = new Wallet(PRIVATE_KEY);
const body = JSON.stringify({ city: 'London' });
const timestamp = Date.now().toString();
const message = timestamp + keccak256(toUtf8Bytes(body));
const signature = await wallet.signMessage(message);
const res = await fetch('https://gateway.example/v1/proxy/TOOL_ID', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Timestamp': timestamp,
'X-Signature': signature,
},
body,
});

No API keys. No OAuth. Your EVM wallet is your identity.

Tool Discovery

List all tools (no auth):

Bash
GET /v1/tools

Returns all active and degraded tools with name, description, price, and status.

Search tools (no auth):

Bash
GET /v1/tools/search?query=weather+forecast
GET /v1/tools/search?query=translate+text&mode=semantic
GET /v1/tools/search?query=I+need+to+resize+images+in+bulk&mode=agentic

Three search modes: keyword (default, free, ~10ms) uses full-text + tag matching. semantic (~200ms) uses embedding similarity for intent-based matching. agentic (~1-3s) uses an LLM to reason over the catalog.

Single tool (no auth):

Bash
GET /v1/tools/:toolId

Making API Calls

Call any tool via the proxy endpoint:

HTTP
POST /v1/proxy/:toolId
Headers: X-Signature, X-Timestamp, Content-Type: application/json
Body: { ...your request payload... }

The body is forwarded to the supplier as-is. The gateway deducts the cost, calls the supplier, and wraps the response.

{
"gateway": {
"cost": 0.05,
"balance": 49.95,
"request_id": "uuid",
"payment_method": "balance",
"pricing": { "model": "per_request" }
},
"data": { "...supplier response..." }
}

Poll GET /v1/transactions/:requestId to check async status.

Pricing Models

Per-request (default) — A flat USDC amount per API call. The price field on the tool is the cost.

Per-unit — Price multiplied by units consumed (e.g., images processed, records returned). The gateway pre-authorizes unit_price × max_units, then partial-refunds the unused amount after the supplier reports actual units_consumed.

Per-unit tools include pricing_model: "per_unit", unit_name, and max_units_per_request in the tool listing. You only pay for what you use.

Payment Methods

The gateway supports two payment methods. Both work through the same POST /v1/proxy/:toolId endpoint.

Balance Mode

  • Deposit USDC/USDT once, pay from balance per request
  • Lowest per-call cost, no gas per request
  • Auth via X-Signature + X-Timestamp
  • Best for high-volume agents

x402 Pay-Per-Request

NEW
  • No deposit needed — pay on-chain per request
  • USDC on Base via the x402 protocol
  • Auth via PAYMENT-SIGNATURE header
  • Best for one-off calls or zero-trust agents

How x402 works:

1. Send POST /v1/proxy/:toolId without auth headers (or with X-Payment-Method: x402)

2. The gateway returns HTTP 402 with payment requirements (amount, USDC asset, payTo address, network)

3. Your agent signs a USDC transfer authorization and retries with a PAYMENT-SIGNATURE header

4. The gateway verifies and settles the payment on-chain, then proxies your request to the supplier

x402 integration examples:

import { wrapFetch } from '@x402/fetch';
import { createWalletClient, http } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { base } from 'viem/chains';
const account = privateKeyToAccount(PRIVATE_KEY);
const client = createWalletClient({
account, chain: base, transport: http()
});
const x402Fetch = wrapFetch(fetch, client);
const res = await x402Fetch(
'https://gateway.example/v1/proxy/TOOL_ID',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ city: 'London' }),
}
);
const data = await res.json();

Refunds: If an API call fails after x402 payment, the refund is credited to your platform balance (usable for future calls via balance mode). This avoids on-chain gas costs for refunds.

Tools that support x402 include x402_supported: true in their listing. Compatible with the @x402/fetch client library for automatic 402 handling.