Developer docs
Everything the builder does goes through this API. The base address is https://usesalmon.xyz.
What Salmon is, and is not
Salmon reads public Hyperliquid perp market data every few seconds, evaluates your rules, and runs an action when a rule becomes true. Today the data is observed off-chain and every event says so. Salmon does not place orders. Off-chain it holds no funds and no keys; the on-chain registry holds only the bounty deposits users put in, and its admin cannot touch them.
Keys
POST /v1/keys
→ { "key": "sal_…", "webhookSecret": "whs_…" }No account. The key is shown once. Send it as Authorization: Bearer sal_…. Five keys per hour per address.
A rule
{
"name": "Crowded longs on ETH",
"logic": "all", // "all" or "any"
"conditions": [ // 1 to 4
{ "market": "ETH", "metric": "funding", "op": ">", "value": 0.01 },
{ "market": "ETH", "metric": "oi_change", "op": ">", "value": 5, "window": 60 }
],
"action": { "type": "webhook", "url": "https://your.app/hooks/salmon" }, // or { "type": "log" }
"cooldown": 300, // seconds between two runs, 30 minimum
"maxRuns": 100, // the rule ends after this many runs
"expiresAt": null // or a millisecond timestamp
}
Metrics
| metric | Meaning | Unit | Window | Replay |
|---|---|---|---|---|
| price | Mark price | $ | no | hourly closes |
| price_change | Price change over the window | % | 1 to 360 min | hourly closes |
| funding | Funding rate per hour | % | no | hourly funding |
| premium | Mark price versus oracle price | % | no | none |
| oi_change | Open interest change over the window | % | 1 to 360 min | none |
| imbalance | (bids − asks) / (bids + asks) within 1% of mid | % | no | none |
A rule runs when it goes from false to true, then waits for its cooldown. A rule that is already true when you activate it runs once. Window metrics need the server to have watched the market for that long; until then the rule waits.
Automations
POST /v1/automations create and activate (count by level)
GET /v1/automations list, each with its live state
GET /v1/automations/{id}
POST /v1/automations/{id}/pause
POST /v1/automations/{id}/resume
DELETE /v1/automations/{id}
GET /v1/runs the last 100 runs, with the action result
Replay
POST /v1/simulate { "conditions": [...], "logic": "all", "cooldown": 3600, "days": 14 }
→ { "replayable": true, "fires": [{ "t": 1764000000000, "values": [1.2] }], "hours": 336, "trueHours": 41 }Replay uses hourly closes and hourly funding, up to 30 days. The live engine checks every few seconds, so it can fire on moves an hourly replay does not see. Rules that use premium, oi_change or imbalance return "replayable": false: Hyperliquid publishes no history for them.
Event stream
GET /v1/stream?markets=BTC,ETH market events (server-sent events)
GET /v1/stream?key=sal_… your automations: automation_fired, action_result
event: funding
data: { "seq": 4182, "type": "funding", "market": "BTC", "ts": 1764000000000,
"value": 0.0013, "previous": 0.0012,
"source": "hyperliquid_api", "verification": "observed_offchain" }Types: price, funding, open_interest, automation_fired, action_result. seq grows by one per event, so a gap means you missed some.
Webhooks
Salmon sends one POST per run, with no retry and no redirect followed. The address must be https on port 443 or 8443 and resolve to a public address.
x-salmon-timestamp: 1764000000000
x-salmon-signature: sha256=HMAC_SHA256(webhookSecret, timestamp + "." + rawBody)
x-salmon-run: run_…
// Node
import { createHmac, timingSafeEqual } from "node:crypto";
const mac = "sha256=" + createHmac("sha256", process.env.SALMON_SECRET)
.update(req.headers["x-salmon-timestamp"] + "." + rawBody).digest("hex");
const ok = timingSafeEqual(Buffer.from(mac), Buffer.from(req.headers["x-salmon-signature"]));Reject a timestamp older than a few minutes, and treat x-salmon-run as an idempotency key.
On-chain
Available when this server has the on-chain side configured. The contract checks the condition itself; observations are signed by the Salmon signer, which every response labels attested_by_salmon_signer.
GET /v1/onchain addresses, signer, keeper state, recent keeper activity
GET /v1/onchain/attest?market=BTC&metric=price[&window=60]
→ { "value": "9700000000000", "observedAt": 1764000000, "signature": "0x…", "proof": "0x…" }
POST /v1/onchain/encode the create transaction for a wallet to send
{ "receiver": "0x…", "conditions": [...], "logic": "all", "cooldown": 300,
"maxRuns": 5, "gasLimit": 300000, "bounty": "0.001", "deposit": "0.005" }
→ { "chainId": …, "to": "0x…", "data": "0x…", "value": "0x…" }
POST /v1/onchain/cancel { "id": 1 } the cancel transaction
GET /v1/onchain/automations[?owner=0x…]Values are scaled by 1e8: price in dollars, every other metric in percent. Metric ids on-chain: price 0, funding 1, premium 2, oi_change 3, imbalance 4, price_change 5. On-chain rules are level-triggered: they run whenever the condition holds and the cooldown has passed. A run reverts and pays nothing if the condition does not hold, the observation is older than the contract's limit, or the receiver fails.
Levels
There is no subscription. Limits follow the token balance of the wallet linked to the key; until a token exists, every key gets the default level.
GET /v1/tiers the levels and whether the token is live
GET /v1/me your level, linked wallet, balance, next level
POST /v1/wallet/challenge → { "message": "…" } sign it with personal_sign
POST /v1/wallet/link { "address": "0x…", "signature": "0x…" }
DELETE /v1/wallet unlinkThe message is one-time and expires after 5 minutes. A wallet is linked to one key at a time. When a balance drops, automations that no longer fit are paused with a reason, never deleted. On-chain, the registry reads the owner's balance itself to set the protocol fee.
Limits
Per level: automations, conditions per rule, replay days, order-flow measures, open streams and requests per minute. For everyone: 120 requests per minute per address without a key, 20 replays per 10 minutes, 5 keys an hour.
Roadmap, stated plainly
Live: off-chain rules with webhooks, and on-chain automations checked by a contract against signed observations. Planned and not live: a second on-chain source that reads the HyperCore market-data precompile Elysium has announced, so no signer is needed. A token comes after the product is used, not before.