API reference
Every public endpoint on api.apihub.io and proxy.apihub.io. Single page so you can grep.
Authentication
All authenticated endpoints expect an APIHub API key in the Authorization header. Both formats accepted:
Authorization: Bearer ahk_your_key
Authorization: ahk_your_keyKeys begin with ahk_. See API keys for how to get one.
Base URLs
- API:
https://api.apihub.io(read-only, agent management, credit purchase, search) - MCP:
https://mcp.apihub.io/mcp(Model Context Protocol JSON-RPC endpoint) - Proxy:
https://proxy.apihub.io(paid API calls)
Response envelope
All API endpoints return a consistent envelope:
{
"ok": true,
"data": { ... },
"meta": { "request_id": "uuid", "latency_ms": 12 }
}{
"ok": false,
"error": { "code": "INSUFFICIENT_CREDITS", "message": "..." },
"meta": { "request_id": "uuid" }
}Common error codes
UNAUTHORIZED- 401, missing or invalid API keyRATE_LIMITED- 429, exceeded the per-minute or per-hour cap (Retry-After header set)INVALID_INPUT- 400, request body or query parameter failed validationINSUFFICIENT_CREDITS- 402, no credits and no PAYMENT-SIGNATURE headerSERVICE_NOT_FOUND- 404, the slug doesn't exist or is pausedDOMAIN_NOT_VERIFIED- 403, content gateway domain hasn't been verifiedNO_CONTENT_RULE- 404, no pricing rule matches the requested URL pathUPSTREAM_ERROR- 502, the upstream API failed or timed outCONFIG_ERROR- 500, server-side configuration issue
Rate limits
- Proxy calls: 100/min free tier, 1000/min for accounts with credit balance (per-profile)
- Credit purchase: 20/min per API key
- Agent registration (public): 5/hour per IP
- Magic-link emails: 3/hour per email
Registration
Returns the message your agent must sign to prove wallet ownership during autonomous registration.
{
"ok": true,
"data": {
"message": "I am registering for APIHub.io",
"instructions": "Sign this message with your EVM wallet and POST it back to /v1/register with your wallet_address and signature."
}
}Verifies the signed challenge and creates an agent account. One account per wallet address. Subject to per-IP rate limit (5/hr).
Parameters
EVM address (0x prefix, 40 hex chars)
Signed challenge message
Optional label
{
"ok": true,
"data": {
"agent_id": "uuid",
"api_key": "ahk_xxxxxxxxxxxxxx...",
"api_key_prefix": "ahk_xxxxxxxx",
"wallet_address": "0x...",
"note": "Store this API key securely."
}
}Discovery
List active onboarded API services. Public, no auth required.
Parameters
Default 50, max 100
{
"ok": true,
"data": {
"services": [
{ "id": "...", "slug": "...", "name": "...", "description": "...", ... }
]
}
}Get full details for a service including endpoints and pricing. Public, no auth required.
{
"ok": true,
"data": {
"service": { ... },
"endpoints": [
{ "method": "GET", "path": "/latest/USD", "price_per_request": 500, ... }
]
}
}Search services by query, category, price, or type.
Parameters
Free-text search
Filter by category
Upper bound on price
'api' or 'content'
curl -X POST https://api.apihub.io/v1/search \
-H "Authorization: Bearer ahk_..." \
-H "Content-Type: application/json" \
-d '{ "query": "weather", "max_price_microdollars": 10000 }'{
"ok": true,
"data": { "results": [ ... ] }
}List external x402 marketplace listings (services indexed from on-chain activity, not onboarded to APIHub). Public.
{ "ok": true, "data": { "listings": [ ... ] } }Wallet & credits
Returns the agent's spending stats and current rate-limit status.
{
"ok": true,
"data": {
"agent_id": "uuid",
"credit_balance_microdollars": 9870000,
"total_spent_microdollars": 130000,
"total_requests": 25,
"rate_limit": { "limit_per_minute": 1000, "current_minute_count": 4 }
}
}Returns just the credit balance. Lightweight.
{
"ok": true,
"data": {
"credit_balance_microdollars": 9870000,
"credit_balance_display": "$9.8700"
}
}Recent credit transactions: purchases, refunds, external x402 debits. Newest first.
Parameters
Default 20, max 100
{
"ok": true,
"data": {
"transactions": [
{ "id": "...", "type": "purchase|refund|debit", "amount_microdollars": 10000000, "balance_after": ..., "created_at": "..." }
]
}
}Purchase credits via x402. First call returns 402 challenge. Sign EIP-3009 transferWithAuthorization, re-post with PAYMENT-SIGNATURE header. Rate limited 20/min per key.
Parameters
Min 5,000,000 ($5)
{
"ok": true,
"data": {
"balance_microdollars": 10000000,
"credited_microdollars": 10000000,
"tx_hash": "0xabc..."
}
}Proxy (paid calls)
Forwards request to an onboarded service's upstream. Method, body, query string preserved. Charges per-endpoint price from credits (or returns 402 with x402 challenge if no credits + no PAYMENT-SIGNATURE).
/* Upstream response, with these added headers:
x-apihub-payment-protocol: credit | free_tier | x402 | provider_test
x-apihub-charged: <microdollars> | false
x-apihub-credit-balance-remaining: <microdollars>
x-apihub-latency-ms: <ms>
x-apihub-receipt-hash: <sha256>
*/Call any x402-protected URL via the proxy. APIHub pays the upstream provider on-chain and debits your credits (price + markup). No wallet required on your side.
Parameters
Full URL to call
Default POST
Forwarded verbatim
Authorization and X-PAYMENT are stripped
{
"ok": true,
"status": 200,
"body": { /* upstream JSON */ },
"credits_spent_microdollars": 5500,
"credits_remaining_microdollars": 994500
}Content gateway. Fetches the URL via headless browser, charges the matching content rule's price, returns clean structured text.
Parameters
Content service slug (in path)
Full URL to fetch (query parameter)
{
"ok": true,
"data": {
"source_url": "...",
"title": "...",
"text": "...",
"headings": [ ... ],
"word_count": 1200,
"truncated": false
}
}MCP
Returns server info. Useful for registries and sanity checks. No auth required.
{
"name": "apihub",
"displayName": "APIHub",
"publisher": "APIHub",
"transport": "streamable-http",
"protocolVersion": "2025-03-26",
"tools": [ "apihub_search", "apihub_call", ... ]
}JSON-RPC handler. Methods: initialize, notifications/initialized, tools/list (no auth), tools/call (auth required).
/* JSON-RPC 2.0 response per the MCP spec.
See https://modelcontextprotocol.io for protocol details.
Tool list and arg shapes documented at /docs/agents/mcp. */Health & well-known
Liveness check. Always returns 200 if the worker is up.
{ "ok": true, "data": { "status": "healthy" } }Discovery files
- /llms.txt - high-level platform description for LLM-aware crawlers
- /.well-known/agent.json - A2A agent card
- /.well-known/mcp.json - MCP server card with tool list