Your AI agent's public URL is an open wallet
You build an agent that answers questions, summarises documents or triages tickets. A Telegram bot, a CRM or a webhook has to call it, so it gets a public HTTPS URL. Behind that URL sits a paid model. The URL is not a s
You build an agent that answers questions, summarises documents or triages tickets. A Telegram bot, a CRM or a webhook has to call it, so it gets a public HTTPS URL. Behind that URL sits a paid model.
The URL is not a secret. It ends up in config files, logs, screenshots and chat threads. Anyone who has it can call your agent, and every call that reaches your code can spend your model budget. Nothing goes down and nothing looks wrong; the bill just grows. Call it denial of wallet.
Three ways people lock it down
1. Write the check into every agent. Read a header, compare it with a secret, return 401. It works, and it is yours to write, test and keep correct in every agent you ever deploy. One forgotten route leaves one agent open. Changing the shared secret means redeploying every caller at once.
2. Put a proxy or gateway in front. A reverse proxy with basic auth, an OAuth proxy, an API gateway. One place to enforce the rule, but also one more service to deploy, patch and pay for, and often one shared credential for everyone who calls through it.
3. Refuse the call at the edge. The platform checks a token before the request reaches your agent. There is no code in the agent and no extra service. This is what we built, and the rest of this post shows how it works.
How per-agent tokens work
Each agent gets its own access tokens. They belong to one agent and open only that agent's public URL.
- Open the agent, go to Settings and find Access tokens.
- Choose Generate agent token, name it after the caller (
telegram-bot) and pick how long it stays valid: 7, 30 or 90 days, or no expiry. - Copy the token. It starts with
uagt_live_and is shown once; we keep only a fingerprint of it. - Give it to that one caller. The caller sends it in the
Authorizationheader.
A request without a valid token for this agent gets 401 Unauthorized and never reaches your code or your model. A token made for another agent, a revoked or expired token, and your account's API key are all refused the same way.
Because every caller has its own token, you can revoke one without touching the others. Revoke the Telegram bot's token and your CRM keeps working. If a token leaks, it opens that one agent only, and revoking it takes effect right away. An agent can hold up to 10 active tokens.
Two things to know. From the first token on, the agent stays closed: letting your last token expire does not reopen it, so a forgotten expiry date never exposes the agent by accident. And give existing callers their token before you generate the first one on a live agent, or they will start getting 401.
Calling an agent with its token
The URL and the /ask route below are placeholders for your own agent.
# No token: refused at the edge
curl -s -o /dev/null -w "%{http_code}\n" -X POST \
https://agent-my-bot-12345.uagents8.io/ask
# 401
# With the token made for this agent
curl -s -o /dev/null -w "%{http_code}\n" -X POST \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"question": "Summarise the open tickets"}' \
https://agent-my-bot-12345.uagents8.io/ask
# 200
import os
import requests
AGENT_URL = "https://agent-my-bot-12345.uagents8.io"
AGENT_TOKEN = os.environ["AGENT_TOKEN"] # keep it in an environment variable
resp = requests.post(
f"{AGENT_URL}/ask",
headers={"Authorization": f"Bearer {AGENT_TOKEN}"},
json={"question": "Summarise the open tickets"},
timeout=30,
)
if resp.status_code == 401:
raise RuntimeError("Token missing, expired or revoked for this agent")
resp.raise_for_status()
print(resp.json())
Your agent checks nothing itself. It only receives requests that already passed.
Two layers: an address list and a token
A token proves the caller knows a secret. An address list proves where the call comes from. On the Scale plan you can use both on the same agent.
Turn on Restrict access by IP address in the agent's configuration and give it up to 10 IPv4 addresses or ranges (for example your office and one client's servers). Today the switch is in the dashboard and the list itself is set through the API. Then generate a token for each caller, as above.
Now a call has to pass two independent checks before it reaches your code: it must come from a listed address, and it must carry a valid token for this agent.
- A token that leaks into a log or a screenshot is useless from any other network: the call gets
403, even with the valid token. - A machine inside the listed network still gets
401without a token. - Both checks run at the edge, so a refused call spends none of your model budget.
Tokens are on every plan; the address list is on Scale. For most agents a token per caller is the right first step, and the address list is the second one when the callers sit behind fixed addresses.
When to add more layers
Tokens answer "who may call this agent?". Other controls answer different questions.
- A private agent has no public URL at all. If only your other agents call it (an internal worker, a tool behind a front agent), make it private. They reach it by name, and nothing outside the platform can. It needs no token.
-
A request-rate limit applies to each agent. The default is 120 requests a minute, and you can set it between 10 and 1,000. A caller over the limit gets
429and can try again a minute later. It puts a ceiling on how fast anyone can drive calls into an agent. - The address list on Scale, described above, when a fixed set of addresses is the real boundary.
A sensible default for a production agent that a service calls: one token per caller, plus the rate limit. Add the address list when a fixed set of addresses is the real boundary.
What this does and does not claim
Endpoint authentication is not new, and plenty of platforms let you build it. Among the three hosts we compared against (Railway, Render and Fly.io; their own pages re-read on 14 November 2026), we did not find tokens per agent, for machine callers, on every plan, with no code to write. Railway's built-in gate for public domains is a human login on its Enterprise tier. Render documents a reverse proxy you deploy yourself. Fly.io documents private networking and leaves checks on a public app to your own code. The sources and dates are on our comparison pages, and if one of them changes, so does this paragraph.
What tokens are not: they identify a caller, not a person; a token opens every public route of its agent, not a subset; and before you generate the first one, the agent answers anyone who knows its URL.
Try it
Every plan includes access tokens, from Builder at β¬19 a month (excl. VAT). Make an agent, generate a token, and run the two curl lines above against it: uagents8.com. Launch code LAUNCH30 takes 30% off the first three months on Builder or Growth until 30 November. The full guide is in the docs.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.


