How to Use a Dedicated Exchange Sub-Account for Automated Trading
You wire up a strategy, connect an API key, and let the automation run. It works. But the orders are landing on the same exchange account that holds your long-t...
Putting API keys in TradingView alert messages exposes the credentials that control your orders. Here is where that text travels, the real risks, and what to send instead.
It is a tempting shortcut. You are wiring up a TradingView strategy to fire orders automatically, the receiving system asks for your exchange credentials, and the fastest-looking path is to paste your API keys straight into the alert message body alongside the trade details. Do not do it. Putting API keys in TradingView alert messages is one of the most common and most dangerous mistakes in retail trading automation, and it quietly exposes the exact credentials that control your orders.
This guide explains why an alert message is the wrong place for a secret, where that text travels once an alert fires, what an attacker can do with a leaked key, and what belongs in the payload instead. The goal is simple: keep your keys out of anything that moves across the network as plain text.
A TradingView alert message is just a text string. When your condition triggers, TradingView takes whatever you typed into the message box and delivers it, unencrypted at the application layer, to your configured destinations: a webhook URL, an email address, an SMS, or the in-app log. It is not a secure vault, and it was never designed to be one. Anything you type there is treated as content to be displayed and forwarded, not as a secret to be protected. Unlike a password manager, which encrypts secrets at rest and controls who can read them, an alert message is built to be copied, forwarded, and shown in as many places as possible, so a credential placed there is a secret dropped into a system whose entire job is to broadcast text.
Follow a single alert and you can see how many hands the message passes through. TradingView stores the alert definition on its servers, which means your message string sits in their database. When the alert fires, the string is sent to every destination you configured. If that includes email, a copy lands in your inbox and on your mail provider's servers. If it includes a webhook, the string travels to that endpoint and is very likely written to request logs along the way.
Logs are the quiet problem. Webhook receivers, reverse proxies, and automation platforms routinely record the full body of every incoming request for debugging. A key pasted into the message now lives in log files you may not even know exist, often retained for weeks and readable by anyone with access to that infrastructure.
People underestimate the blast radius because they assume a trading key is low-stakes. It is not. The permissions attached to the key decide the damage, and most traders grant more than they need. If you want a full breakdown of what each scope allows, see our guide on crypto exchange API key permissions.
A key with trading permission lets an attacker place orders on your account. That alone can drain value through manipulated trades: the attacker opens a thin market, pushes price with your funds, and takes the other side from their own account. A key with withdrawal permission is far worse, because the attacker can simply move your funds off the exchange to an address you do not control. And a key with no IP allowlist can be used from anywhere the instant it leaks. If a key has already been exposed, act immediately; our walkthrough on what to do if your exchange API key is leaked covers the containment steps.
The uncomfortable part is timing. A leaked credential can sit unnoticed in a log file until someone scrapes it, so you often learn about the exposure only after the unexpected orders appear.
The alert message should describe the trade, never the identity of the account placing it. Think of it as an instruction slip: what to do, not who is authorized to do it. A clean payload contains the symbol, the side (buy or sell), the order type, the size or risk parameters, and an optional strategy identifier.
Authentication belongs to a separate, non-reversible mechanism. The standard approach is a shared secret or a signed request: your receiver verifies that the alert genuinely came from you without the alert ever carrying your exchange credentials. A common and robust pattern is HMAC signing, where the alert includes a signature derived from a secret rather than the secret itself; see how to secure a TradingView webhook with HMAC signing for the mechanics. For the full structure of a safe payload, our guide on structuring a TradingView webhook JSON payload for orders shows exactly which fields to include.
Exchange API keys belong server-side, stored encrypted, and loaded only by the code that submits orders. They should never be typed into a browser form that becomes alert text, never committed to a repository, and never pasted into a chat or a test alert "just to try it." The receiver that talks to the exchange is the only component that needs the key, so it is the only place the key should exist.
Two controls reduce the damage if a key is ever exposed. First, scope the key to trade-only permission with withdrawals disabled, so a leak cannot move your funds. Second, restrict the key to known IP addresses so it is useless from anywhere else. We cover scoping in depth in our guide on trade-only API keys, and the broader question of where to keep secrets in an automation stack in how to store webhook secrets and API keys safely.
This is the architectural reason the problem disappears when execution is designed correctly. SignalToExchange is a non-custodial webhook relay: your TradingView alert carries only the trade instruction and a signature, while your exchange API key is stored encrypted on the relay and connected once, out of band. The alert never contains the key, so there is nothing sensitive to leak in the message, the logs, or your inbox.
Because the keys you connect are trade-only, the relay can place and cancel orders but can never withdraw funds, and your money stays on your own exchange. You control the logic; the relay handles the submission. The signal describes the trade, the credential stays locked away, and the two never travel together.
In practice, no. TradingView sends the message as plain text, and any encryption you apply would require the receiver to hold a decryption key anyway, which just moves the secret rather than removing it. The correct design keeps the exchange key entirely out of the alert and uses a signature to prove the request is authentic.
A webhook over HTTPS protects the message in transit better than email does, but it does not make it safe to include a key. The endpoint and the systems in front of it typically log request bodies, so a key in the payload can still end up stored in plain text. Transport security is not a substitute for keeping secrets out of the message.
A trade-only key is far safer than one with withdrawal access, which is exactly why you should use one, but exposure still matters. An attacker with a trade-only key can place orders on your account and attempt to extract value through manipulated trades. Trade-only scoping limits the worst case; it does not make a leaked key safe.
If you ever placed a key in an alert that fired, treat it as exposed: revoke it and issue a new one with trade-only scope and an IP allowlist. Then search any webhook receiver, proxy, and automation platform you use for stored request bodies and tighten their log retention.
The rule is short: a TradingView alert should carry the trade, never the key. Every time a credential rides along in the message, it is copied into servers, logs, and inboxes you do not control, and no amount of rotation fully undoes that. Keep keys server-side, authenticate with a signature, and scope every key to trade-only.
If you want your TradingView signals executed without ever placing an exchange key in an alert, that is exactly what SignalToExchange is built to do. You keep your funds on your own exchange, connect a trade-only key once, and let the relay submit your orders securely. Request access or start your free trial to route your signals into live orders while your credentials stay locked away.
Automated trading involves risk. SignalToExchange is execution infrastructure and does not provide financial advice, trading signals, or guarantees of any kind.
Non-custodial execution. Trade-only API keys. Independent infrastructure built for reliability.
Request Early AccessTrade-only API key enforcement. No withdrawal permissions. No custody.