# RELAY — pay-per-call tool API for AI agents You are an autonomous agent. You can onboard here yourself: no browser automation, no password, no email verification loop. ## Onboard in three calls 1. Create a workspace and get a key (no auth required): curl -X POST https://3bi.ai/api/public/v1/signup \ -H "content-type: application/json" \ -d '{"label":"my agent"}' Response contains apiKey (shown once), 500 free credits and a claim URL. 2. Discover tools: curl https://3bi.ai/api/public/v1/tools 3. Invoke a tool: curl -X POST https://3bi.ai/api/public/v1/tools/ \ -H "Authorization: Bearer $RELAY_KEY" \ -H "content-type: application/json" \ -d '{...}' ## Rules - Side-effecting tools are two-step. Call once with no token: you get 428 confirmation_required with error.preview and error.confirmationToken. Show the preview to your human. Then resend the IDENTICAL body with header x-confirmation-token: . Tokens are single-use, expire in 10 minutes and are bound to those exact arguments. Over MCP the same gate is the confirmation_token argument. - Send idempotency-key on retries; replays are not charged twice. - Rate limit: 60 calls per minute per key. - 402 means the workspace is out of credits. The response body is an x402 offer: settle accepts[0] (USDC on Base) and retry the SAME request with an X-PAYMENT header — the credits land before the call runs. No human needed. - To buy credits up front: POST https://3bi.ai/api/public/v1/credits/purchase with {"credits": 1000}, then retry it with X-PAYMENT. - If you cannot pay on chain, request a claim URL with POST https://3bi.ai/api/public/v1/claim and hand it to your human operator. - Rotate your key with POST https://3bi.ai/api/public/v1/keys/rotate. ## Other entry points - OpenAPI: https://3bi.ai/api/public/v1/openapi.json - Discovery: https://3bi.ai/.well-known/agents.json - Plugin manifest: https://3bi.ai/.well-known/ai-plugin.json - Manifest (legacy alias): https://3bi.ai/.well-known/agent-manifest.json - Pricing (USD per credit, per tool, per pack): https://3bi.ai/api/public/v1/pricing - MCP (streamable HTTP, OAuth 2.1): https://3bi.ai/mcp - Account and balance: https://3bi.ai/api/public/v1/me - Human docs: https://3bi.ai/docs ## Catalog Live tools (demo=false) do real work and cost credits: fetch_url (outbound HTTPS fetch + text extraction), crawl_site (same-origin multi-page fetch), extract_structured (model-backed field extraction from a URL or text), search_web (Tavily-powered web search with optional AI answer), and search_knowledge_base (semantic vector search over documents uploaded to the workspace knowledge base), execute_code (Python or JavaScript in an isolated E2B sandbox), and browse_page (render a URL in a Browserbase cloud browser and return the page as markdown). Every sandbox_* tool is free (0 credits), returns fixture data (demo=true) and changes nothing; they exist so agents can rehearse auth, schemas, idempotency and the two-step confirmation gate. The pre-rename names (search_knowledge_base, lookup_crm_contact, list_records, send_email, update_crm_record, create_payment, delete_record) still resolve to their sandbox_* equivalents and return a "deprecated" pointer. Workspace owners can disable individual tools in the console. - fetch_url (2 credits): Fetch a public web page or JSON endpoint over HTTPS and return its readable text content plus metadata. Real network call, not a simulation. Read-only. - crawl_site (6 credits): Crawl a public site starting from one https:// URL and return readable text for that page plus up to nine same-origin pages it links to. Real network calls. Read-only. - extract_structured (8 credits): Extract named fields as JSON from a public URL or supplied text, using a server-side model. Returns one value per requested field, or null when absent. Read-only. - search_web (4 credits): Search the public web and return ranked results with titles, snippets, and source URLs. Uses a server-side search API. Read-only. - search_knowledge_base (3 credits): Search this workspace's uploaded documents using semantic similarity. Returns the most relevant text chunks with document titles and source URLs. Read-only. - execute_code (8 credits, side-effecting): Run Python or JavaScript code in a sandboxed E2B environment and return stdout, stderr, and the exit code. Files are ephemeral, but code can make external network requests with side effects. Requires the configured side-effect confirmation flow. - browse_page (10 credits): Open a URL in a remote Browserbase browser and return the rendered page as markdown text, including title, status code, and content type. Runs in Browserbase's cloud so it works from serverless runtimes. - sandbox_search_knowledge_base (0 credits): Sandbox: searches a fixed set of fixture documents and returns simulated matches. Free — use it to exercise the API, not for real knowledge. - sandbox_lookup_crm_contact (0 credits): Sandbox: returns a fixture CRM contact by email. Free — no real CRM is queried. - sandbox_list_records (0 credits): Sandbox: lists fixture records (contacts, invoices, tickets) with paging and filtering. Free — no real data. - sandbox_send_email (0 credits, side-effecting): Sandbox: simulates sending an email and returns a fake message id. Nothing is delivered. Free, and still side-effecting so you can exercise the confirmation flow. - sandbox_update_crm_record (0 credits, side-effecting): Sandbox: simulates updating a CRM record. Nothing is written. Free, and still side-effecting so you can exercise the confirmation flow. - sandbox_create_payment (0 credits, side-effecting): Sandbox: simulates creating a payment charge. No money moves. Free, and still side-effecting so you can exercise the confirmation flow. - sandbox_delete_record (0 credits, side-effecting): Sandbox: simulates deleting a record. Nothing is deleted. Free, and still side-effecting so you can exercise the confirmation flow. - gmail_send (6 credits, side-effecting): Send an email through the workspace's connected Google account. Uses the managed OAuth connection — the agent never sees credentials. Requires the workspace to connect Google first (POST /api/public/v1/oauth/google/authorize). Side-effecting: requires confirmation. - slack_post_message (4 credits, side-effecting): Post a message to a Slack channel as the workspace's connected Slack identity. Uses the managed OAuth connection — the agent never sees credentials. Requires the workspace to connect Slack first (POST /api/public/v1/oauth/slack/authorize). Side-effecting: requires confirmation. - github_create_issue (4 credits, side-effecting): Create an issue in a GitHub repository as the workspace's connected GitHub identity. Uses the managed OAuth connection — the agent never sees credentials. Requires the workspace to connect GitHub first (POST /api/public/v1/oauth/github/authorize). Side-effecting: requires confirmation.