Registry API
Everything on AgentStack is doable by machine alone. Authenticate with an api_key — either as Authorization: Bearer <key>, an x-api-key header, or an api_key field in the JSON body. Billing is metered per call, per token or per outcome — never subscription.
POST /functions/discoverTools
Rank live tools against a natural-language capability need. Ranking favors schema completeness, rating and usage. Logs a DiscoveryQuery.
{
"api_key": "agt_...",
"capability_query": "verify an email address",
"category": "data",
"max_unit_price": 0.01,
"limit": 5
}{
"count": 1,
"results": [
{
"id": "tool_x",
"name": "Email Verification API",
"pricing": {
"model": "per_call",
"unit_price": 0.002
},
"rank_score": 91.4,
"install_endpoint": "/functions/installTool"
}
]
}GET|POST /functions/getToolSchema
Full machine-readable schema + docs for one tool.
{
"tool_id": "tool_x"
}{
"id": "tool_x",
"mcp_schema": {
"capabilities": [
"verify_email"
]
},
"input_schema": {},
"output_schema": {},
"docs_markdown": "# ..."
}POST /functions/installTool
Programmatic install. Creates an Installation, increments total_installs, returns invoke instructions. No human checkout.
{
"api_key": "agt_...",
"tool_id": "tool_x",
"config": {
"region": "eu"
}
}{
"installed": true,
"installation_id": "inst_1",
"invoke": {
"endpoint": "/functions/invokeTool",
"method": "POST"
}
}POST /functions/invokeTool
Executes an action, meters usage (units × unit_price), writes a UsageEvent and debits credit_balance. Returns 402 if credits or spend_limit are exceeded.
{
"api_key": "agt_...",
"tool_id": "tool_x",
"action": "verify",
"input_payload": {
"email": "a@b.com"
}
}{
"ok": true,
"output_payload": {},
"billing": {
"units_consumed": 1,
"unit_price": 0.002,
"amount_charged": 0.002,
"remaining_credit_balance": 24.998
}
}GET|POST /functions/getUsage
The agent's metered ledger and remaining balance.
{
"api_key": "agt_..."
}{
"total_spent": 0.014,
"event_count": 7,
"events": []
}POST /functions/generateApiKey
Issues an api_key for a publisher or an agent account.
{
"type": "agent",
"name": "my-agent",
"email": "dev@example.com"
}{
"type": "agent",
"id": "agt_1",
"api_key": "agt_9f3...",
"credit_balance": 25
}POST /functions/requestPayout
Sweeps a publisher’s pending PublisherEarning rows into a Payout record (status pending → paid). Operators settle with { payout_id, mark_paid: true }.
{
"publisher_id": "pub_1",
"method": "bank_transfer"
}{
"ok": true,
"payout": {
"id": "po_1",
"amount": 128.4,
"status": "pending"
},
"earnings_included": 642
}POST /functions/mcpServer
Standards-compliant MCP (JSON-RPC 2.0) endpoint. Supports initialize, tools/list and tools/call so Claude, Cursor or any MCP client can use the whole registry as one server. Calls are billed exactly like invokeTool and split with the operator.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "email_verification_api",
"arguments": {
"email": "ada@example.com"
}
}
}{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "{ \"valid\": true, \"deliverable\": true }"
}
],
"_meta": {
"billing": {
"amount_charged": 0.002,
"operator_fee": 0.0003,
"publisher_earning": 0.0017
}
}
}
}Connect an external AI agent (MCP)
Point any MCP client at /functions/mcpServer with your agent key. Every live tool in the registry is exposed as an MCP tool; each tools/call meters credits and splits revenue between the publisher and the operator automatically.
{
"mcpServers": {
"agentstack": {
"url": "https://<your-app-domain>/functions/mcpServer",
"transport": "http",
"headers": {
"x-api-key": "agt_your_agent_key"
}
}
}
}