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.

request
{
  "api_key": "agt_...",
  "capability_query": "verify an email address",
  "category": "data",
  "max_unit_price": 0.01,
  "limit": 5
}
response
{
  "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.

request
{
  "tool_id": "tool_x"
}
response
{
  "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.

request
{
  "api_key": "agt_...",
  "tool_id": "tool_x",
  "config": {
    "region": "eu"
  }
}
response
{
  "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.

request
{
  "api_key": "agt_...",
  "tool_id": "tool_x",
  "action": "verify",
  "input_payload": {
    "email": "a@b.com"
  }
}
response
{
  "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.

request
{
  "api_key": "agt_..."
}
response
{
  "total_spent": 0.014,
  "event_count": 7,
  "events": []
}

POST /functions/generateApiKey

Issues an api_key for a publisher or an agent account.

request
{
  "type": "agent",
  "name": "my-agent",
  "email": "dev@example.com"
}
response
{
  "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 }.

request
{
  "publisher_id": "pub_1",
  "method": "bank_transfer"
}
response
{
  "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.

request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "email_verification_api",
    "arguments": {
      "email": "ada@example.com"
    }
  }
}
response
{
  "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.

mcp client config
{
  "mcpServers": {
    "agentstack": {
      "url": "https://<your-app-domain>/functions/mcpServer",
      "transport": "http",
      "headers": {
        "x-api-key": "agt_your_agent_key"
      }
    }
  }
}
Operator
Business Innovation Gateway LLC · 502 Dalaba Street, Wuse Zone 5, Abuja · realbigltd@gmail.com · +234 706 491 7232
Business Innovation Gateway LLC · 502 Dalaba Street, Wuse Zone 5, Abuja
AboutContactrealbigltd@gmail.com · +234 706 491 7232