4Keyless secures AI agent access to protected systems through a managed gateway. Agents send outbound
traffic through the 4Keyless Proxy (or the MCP Gateway); 4Keyless authenticates
the agent, applies your access policies, injects credentials from Vault, and routes egress through your exit proxies —
without exposing secrets to the agent.
This documentation is organized like an API reference. Start with
Authentication, run the
Quickstart, then use the
API Reference for per-resource details.
Core concepts
Object
Description
System
A target the agent reaches: REST API, Web App, GraphQL, Database, or MCP. Each system can hold multiple domains.
Credential
A secret stored in Vault and linked to a system. Injected at request time; never exposed to the agent.
Agent
An AI identity. Carries an agent key used to authenticate to the proxy and MCP gateway.
Policy
A rule binding an agent to a system action with a decision: block, allow, or ask.
Exit Proxy
The egress node outbound traffic leaves from. Used for IP rotation, geo-targeting, and zoning.
Blueprint
A marketplace template that provisions a system, auth script, actions, and policies in one step.
Base URLs
Surface
Endpoint
Admin Panel
https://admin.4keyless.io
HTTP(S) Proxy
http://proxy.4keyless.io:8080
Agent Discovery API
http://proxy.4keyless.io:8082
MCP Gateway
https://mcp.4keyless.io/mcp
REST API
https://api.4keyless.io/api/v1
HTTPS targets are tunneled with CONNECT on the same proxy port. Standard REST response envelope: { data, meta?, error? }.
🤖 Building an AI agent? Give it SKILL.md — a drop-in skill file that teaches any agent how to authenticate to the proxy, discover its allowed systems and credential groups via the Agent Discovery API, trust the CA certificate, and interpret policy responses.
Authentication
Authentication
Every request through the proxy or MCP gateway must carry an agent key. Proxied HTTPS traffic
is intercepted (MITM), so clients must also trust the 4Keyless CA certificate.
Two authentication formats are accepted:
# Format 1 — 4Keyless header (curl, explicit clients)
Proxy-Authorization: 4Keyless <your-agent-key>
# Format 2 — Basic auth (browsers, many HTTP libraries)
Proxy-Authorization: Basic base64(agent:<your-agent-key>)
# commonly embedded in the proxy URL:
# http://agent:<your-agent-key>@proxy.4keyless.io:8080
The username part of the URL (agent) is ignored — 4Keyless reads the password as the agent key.
Missing or invalid keys return 407 Proxy Authentication Required.
Rotate keys any time from Agents > Rotate Key, then update your runtime immediately.
The REST API (/api/v1) uses a workspace JWT instead — see Agents and Errors.
CA certificate
The proxy performs HTTPS interception, so the 4Keyless CA must be installed and trusted on every machine or
container that routes traffic through it. Without it, TLS to upstream sites fails.
ERR_CERT_AUTHORITY_INVALID means the proxy is intercepting TLS but the browser does not trust the
4Keyless CA yet. Installing the cert in Keychain alone is not enough on macOS — open Keychain Access →
System → certificate 4keyless.io → Trust →
When using this certificate: Always Trust, then restart the browser.
Linux
Recommended: use the installer script (see Linux setup),
which downloads the CA, trusts it system-wide, and optionally configures the proxy.
Most Linux tools honour HTTP_PROXY / HTTPS_PROXY (and lowercase variants). Setting them routes
shells, CI runners, Python, Node, curl, wget, and many CLIs through 4Keyless. Install the
CA certificate first.
Important: proxy env vars alone do not send credentials. Either embed the agent key in the proxy URL
or configure each tool to send Proxy-Authorization: 4Keyless <key>. Without auth the proxy returns
407.
One-command install (recommended)
Hosted at https://4keyless.io/install.sh (also https://api.4keyless.io/api/v1/install/install.sh).
From a git clone the same script lives at scripts/install-linux-proxy.sh.
Hermes local browser — AGENT_BROWSER_PROXY* in ~/.hermes/.env for agent-browser / Playwright Chromium (skip with --no-hermes)
Connectivity test — curl through the proxy (fails on 407 if the key is wrong)
Hermes + agent-browser (local Playwright)
When Hermes runs in local browser mode (browser.engine: auto → agent-browser controlling Chromium via Playwright),
CLI proxy env vars are not enough. The agent-browser binary reads authenticated proxy settings from
~/.hermes/.env and passes --proxy-server plus user/password to Chromium. Hermes spawns
agent-browser with env = {**os.environ, ...}, so those variables are inherited automatically.
Keep credentials in .env (not config.yaml); use separate username/password fields rather than embedding auth in the URL.
# Appended by install.sh (idempotent block in ~/.hermes/.env)
AGENT_BROWSER_PROXY=http://proxy.4keyless.io:8080
AGENT_BROWSER_PROXY_USERNAME=user
AGENT_BROWSER_PROXY_PASSWORD=4k_your_agent_key
NODE_EXTRA_CA_CERTS=$HOME/4keyless-ca.crt
The username can be any string; 4Keyless validates the password as the agent key. Override the username with
FKL_HERMES_PROXY_USERNAME=agent before running the installer. On macOS, also trust
4keyless-ca.crt in Keychain (see CA certificate) or Playwright may show ERR_CERT_AUTHORITY_INVALID.
source ~/.config/4keyless/env.sh
# Test (expect HTTP 200, not 407)
curl --cacert ~/4keyless-ca.crt https://httpbin.org/ip
Re-running is safe — marked blocks are replaced idempotently. CA download always uses
curl --noproxy '*' / wget --no-proxy so it works even with a prior proxy active.
Manual setup (alternative)
Add to ~/.bashrc, ~/.zshrc, or ~/.profile:
export FKL_AGENT_KEY="4k_your_agent_key_here"
export FKL_PROXY="http://agent:${FKL_AGENT_KEY}@proxy.4keyless.io:8080"
export HTTP_PROXY="${FKL_PROXY}"
export HTTPS_PROXY="${FKL_PROXY}"
export ALL_PROXY="${FKL_PROXY}"
export http_proxy="${FKL_PROXY}"
export https_proxy="${FKL_PROXY}"
export all_proxy="${FKL_PROXY}"
# Keep local and internal traffic direct
export NO_PROXY="localhost,127.0.0.1,::1"
export no_proxy="${NO_PROXY}"
# Trust the 4Keyless CA (after download)
export SSL_CERT_FILE="$HOME/4keyless-ca.crt"
export REQUESTS_CA_BUNDLE="$HOME/4keyless-ca.crt"
export NODE_EXTRA_CA_CERTS="$HOME/4keyless-ca.crt"
Resources are managed in the Admin Panel and over REST under https://api.4keyless.io/api/v1
(workspace JWT). Each section below lists the resource, its REST endpoints, and configuration fields.
Systems
resource
A target the agent reaches. Supports types REST API, Web App, GraphQL, Database, and MCP, each with one or more domains.
get/api/v1/systems
post/api/v1/systems
put/api/v1/systems/{id}
del/api/v1/systems/{id}
Fields
typerequired enum
One of rest, web, graphql, database, mcp.
domainsrequired array
One or more URLs (HTTP and HTTPS) handled by this system.
credential_idoptional string
Vault credential injected on matching requests.
Credentials
resource
Secrets stored in Vault and linked to systems. 4Keyless injects them at request time so the agent never sees raw secret values.
Group credentials with Credential Groups to map blueprint slots.
Upstream MCP servers may use a Bearer token credential (see MCP Gateway).
Rotate or revoke a credential without touching agent or policy config.
get/api/v1/credentials
post/api/v1/credentials
Agents
resource
An AI identity authenticated to the proxy and MCP gateway via its agent key. See Authentication for header formats.
get/api/v1/agents
post/api/v1/agents
post/api/v1/agents/{id}/rotate-key
After rotating a key, update it in your AI runtime immediately — old keys stop authenticating right away.
Policies
resource
Policies define what each agent may do against each system.
block
Always deny access.
allow
Allow access automatically.
ask
Require human approval before forwarding the request.
Recommended default: start with block, then move selected flows to allow or ask. MCP tool calls are matched per tool using the mcp_tool_name field.
get/api/v1/policies
post/api/v1/policies
MCP Gateway
resource
Lets agents reach upstream MCP (Model Context Protocol) servers through the same auth, policy enforcement, and
credential injection used by the HTTP proxy. Exposed publicly at https://mcp.4keyless.io/mcp.
Register an MCP system
In Systems, create a system of type MCP.
Set Transport (HTTP, SSE, or Stdio) and Server URL (e.g. https://mcp.notion.com/mcp).
Optionally link an Upstream Credential (Bearer token for the MCP server).
Open MCP Gateway and click Sync to discover tools.
Connection URL
Append ?system=<name-or-uuid> to scope to a single MCP system, or omit it to aggregate tools across every
MCP system the agent can access. The ?system= value accepts a UUID or the system name (case-insensitive).
When omitted, each tool is prefixed with the system slug to avoid clashes.
Examples
# List tools across every accessible MCP system
curl https://mcp.4keyless.io/mcp \
-H "Proxy-Authorization: 4Keyless <agent-key>"
# Scope to a single system (name or UUID)
curl https://mcp.4keyless.io/mcp?system=MyMCPSystem \
-H "Proxy-Authorization: 4Keyless <agent-key>"
# JSON-RPC request (POST)
curl -X POST https://mcp.4keyless.io/mcp?system=MyMCPSystem \
-H "Proxy-Authorization: 4Keyless <agent-key>" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
Exit Proxies
resource
Route outbound traffic through designated exit nodes — for IP rotation, geo-targeting, rate-limit handling, and
network zoning. Every workspace includes one free catalog exit proxy; more are available as paid add-ons.
Plan default — used when the header is omitted, or when the ID is invalid/inactive (fallback; traffic does not leave directly from the 4Keyless proxy IP).
The header is stripped before forwarding upstream. Effective egress is recorded in Logs under
exit_proxy (with requested_id and fallback on bad-header fallback).
exec_script sandbox calls (http.get, http.post) use the same effective exit proxy as the main request.
Global templates that provision a system, auth script, request/response actions, and access policies in one step,
using verified configurations.
Install a blueprint
Open Marketplace in the left menu.
Select a blueprint and click Install.
Choose the target Agent Group and Credential Group.
Map required credential slots to Vault items.
Click install — system, auth script, actions, and policies are created instantly.
Upgrades
A new blueprint version shows an Update available badge. Upgrading updates script actions and domains
automatically, rematerializing placeholders while preserving your credential mappings.
Logs
resource
Tamper-proof audit records of every decision. Filter by agent, system, decision, and time window.
get/api/v1/logs
Reference
Errors
Proxy and gateway responses use standard HTTP status codes. The REST API returns { data, meta?, error? }.
Status
Meaning & fix
200
Success. The request was authenticated, allowed, and forwarded.
403 access_blocked
Auth OK, but a system or policy blocked the URL. Check Policies and Systems.
407
Missing or wrong agent key. Fix Proxy-Authorization or credentials in the proxy URL.
TLS / cert error
CA not trusted. Install and trust 4keyless-ca.crt (see CA certificate).
Successful requests appear in Logs with the agent name and upstream decision.
Rate limits & plans
Every workspace starts on the Free plan (1 agent, 2 systems, 1 GB transfer/month, 14-day log retention).
Paid plans add capacity, Script Actions (Starter+), ASK policies (Growth+), and longer retention. MFA and the MCP Gateway
are included on all plans.