Authentication
The header forms Tickwire accepts, token kinds, and how to narrow a token's reach.
Every request carries a key or token. We accept each of the forms the APIs we’re compatible with use, so existing clients work unchanged:
| Form | Example | Used by |
|---|---|---|
X-Tickwire-Agent-Key | X-Tickwire-Agent-Key: <key> | AI agents (/v1/agent/… execution routes) |
Authorization: Bearer | Authorization: Bearer <key> | Generic HTTP clients. On the MCP server, only an agent key (twag_) or a Sign in with Tickwire token: see The MCP server |
X-API-Key header | X-API-Key: <key> | The /v1 API and terminal routes |
auth-token header | auth-token: <token> | The /users/current/… REST API |
| Query parameter | ?auth-token=<token> or ?api_key=<key> | WebSocket and socket.io connections only, for clients that can’t set headers (browsers) |
Prefer headers. A REST request with the key in its URL is refused with
401 query_token_not_allowed, because a URL ends up in logs:
your proxy’s, your browser history, your error tracker. Send the key in the X-API-Key header
instead. The query parameter is accepted only on a WebSocket or socket.io connection, where a
header isn’t always possible. Even there, use a short-lived scoped token. We
redact it from our logs.
Call the API from your server, not from a web page. Browsers may call it only from Tickwire’s own
sites (CORS), so a key never has to sit in a page’s JavaScript. The OpenAPI document and the
/.well-known/ metadata can be fetched from any page.
WebSockets: header or query parameter
The WebSocket and socket.io upgrade accepts the same headers as REST: auth-token,
X-API-Key or Authorization: Bearer. A key in a header stays out of URLs, so any proxy or tool
between you and us never logs it. Use a header whenever your client can set one:
import websockets
async with websockets.connect(
"wss://api.tickwire.io/users/current/accounts/acc_7Qx/ws",
additional_headers={"auth-token": TW_KEY},
) as ws:
...
// Node.js (the ws package)
const ws = new WebSocket("wss://api.tickwire.io/users/current/accounts/acc_7Qx/ws", {
headers: { "auth-token": process.env.TW_KEY },
});
Browsers can’t set headers on a WebSocket, so in a browser the query parameter is the only way,
and it stays supported. There, use a scoped token with a short time-to-live and
only the accounts the page needs, never a full API key. We replace the value of auth-token,
api_key and similar parameters with REDACTED in every log we write, our servers’ access logs
included.
Token kinds
Tickwire separates developer credentials based on whether orders are placed directly by code or guided by an AI assistant:
1. API keys (tw_live_ and tw_ro_)
Created under API keys in the dashboard.
- Full keys (
tw_live_): For custom scripts, bot integrations, prop firm workflows, and direct trading. Can trade, manage accounts, and read. - Read-only keys (
tw_ro_): Can query balances, quotes, positions, and history, but cannot trade or change settings. - Headers to send:
Authorization: Bearer <key>orX-API-Key: <key>. - Target routes:
/users/current/…and/v1/…. Not the MCP server: it answers an API key with401 invalid_token.
2. Agent keys (twag_)
Created under AI agents > Keys in the dashboard.
- Built specifically for AI assistants (Google Antigravity, Claude, ChatGPT, Cursor, Windsurf).
- Guarded execution: Each key is linked to an instant kill switch and evaluated by your pre-trade decision hook before orders reach the broker.
- Headers to send: In MCP clients, send
Authorization: Bearer <key>. For direct HTTP calls, sendX-Tickwire-Agent-Key: <key>, orAuthorization: Bearer <key>(the header wins when both are sent). The OpenAPI reference lists these as theagentKeyandagentBearersecurity schemes. - Target routes:
/v1/agent/…routes and the MCP server. Direct terminal routes reject agent keys with401 invalid_tokento protect you from ungated agent orders.
3. Scoped tokens
Narrowed from an API key for browser pages or frontends: limited to certain accounts, with a time-to-live and optional IP allowlist.
A token with an allowlist is checked against your real public address on every request and
WebSocket, whatever X-Forwarded-For says. From anywhere else it gets 403
ip_not_allowed; the answer never shows the allowlist.
Every key and token value is shown once, in the answer that creates it (or rotates a read-only
key). We keep only a SHA-256 digest of each key (full tw_live_, read-only tw_ro_ and sandbox
twsk_ keys, like API tokens and agent keys), so nobody can show it again, us included. Lists and
reads show only a short preview such as tw_live_ab12…, and asking the dashboard to reveal a key
answers 400 not_revealable. Store the value when you create it;
if you lose it, rotate or revoke the key and create a new one.
Keys issued before 2026-10-03 start with fxs_ and keep working.
The MCP server
The MCP server (/mcp) takes only two credentials:
- Sign in with Tickwire (OAuth). ChatGPT, Claude and other AI apps start it themselves when the
server answers
401. Nothing to paste. - An agent key (
twag_), sent asAuthorization: Bearer twag_…(or inX-Tickwire-Agent-Key). Use this in developer tools that ask for a key.
An API key (tw_live_, tw_ro_), a sandbox key (twsk_) or a scoped token does not work on MCP.
The server answers 401 invalid_token. Create an agent key under
AI agents > Keys instead.
Testing your key: Mac, Linux & Windows
Testing an API key (tw_live_ or tw_ro_)
macOS / Linux (Terminal):
curl -s -H "Authorization: Bearer <YOUR_API_KEY>" \
https://api.tickwire.io/users/current/accounts
Windows (PowerShell):
curl.exe -s -H "Authorization: Bearer <YOUR_API_KEY>" `
https://api.tickwire.io/users/current/accounts
Testing an Agent key (twag_)
macOS / Linux (Terminal):
curl -s -H "X-Tickwire-Agent-Key: <YOUR_AGENT_KEY>" \
https://api.tickwire.io/v1/agent/accounts
Windows (PowerShell):
curl.exe -s -H "X-Tickwire-Agent-Key: <YOUR_AGENT_KEY>" `
https://api.tickwire.io/v1/agent/accounts
Rotation doesn’t restart anything
Creating, rotating or revoking a key never restarts a terminal or drops a broker connection.
Mistakes and what you’ll see
| Situations | Status | error |
|---|---|---|
| No key or token sent at all | 401 | missing_token |
| A key or token was sent, but it is unknown, malformed, expired or revoked | 401 | invalid_token |
| Agent key sent to direct terminal route | 401 | invalid_token (send X-Tickwire-Agent-Key to /v1/agent/… instead) |
No, unknown, expired or revoked agent key on /v1/agent/… | 401 | invalid_agent_key |
| MCP: no sign-in and no agent key | 401 | missing_credentials |
| MCP: an API key, sandbox key, scoped token or any value that is not a sign-in token or agent key | 401 | invalid_token |
MCP: unknown, expired or revoked agent key on a tools/call | 401 | invalid_agent_key |
| Key not scoped to this account | 404 | account_not_found (the same answer as an unknown id, so ids can’t be probed) |
| Read-only API key on a mutation | 403 | read_only_token |
| Read-only Agent key on trade | 403 | read_only_key (uncheck Read-only in dashboard > AI agents > Keys to trade) |
| Request from outside the IP allowlist | 403 | ip_not_allowed |
On the /users/current/… routes, error holds the class name (UnauthorizedError for 401,
ForbiddenError for 403) and the code above is in code.