cqt_β¦ / ckey_β¦) and hands to an untrusted client - a browser, a mobile app, or a WebSocket URL. It is prefixed gr_ek_β¦, expires in 30 minutes by default, is scoped to (and never wider than) the API key that minted it, and rolls all usage and billing up into that parent API key.
Ephemeral Keys exist so you can put GoldRush data directly in front of your end users without ever exposing your API key to them. A leaked Ephemeral Key is worthless within one refresh window.
Two credentials, two jobs. Your API key is a long-lived server-side secret - it mints Ephemeral Keys and is never shipped to a client. An Ephemeral Key is the disposable, client-side token your app actually connects with. This mirrors the βsecret key mints an ephemeral keyβ pattern you may know from Stripe.
When to use Ephemeral Keys
Reach for Ephemeral Keys when the credential will live somewhere you donβt control:- Client-side apps - a browser SPA or mobile app that calls GoldRush directly, where any embedded API key is trivially extractable from network traffic or bundled JS.
- WebSockets - the Hyperliquid WebSocket (
wss://hypercore.goldrushdata.com/ws) takes its credential as akeyquery parameter at connect time. That URL is visible to the client, so it must not carry your API key. - High-fan-out embeds - thousands of end users each holding a credential. With Ephemeral Keys, each client gets its own short-lived token that self-expires within one refresh window.
Why not web-locked (referrer/origin) keys? Origin allowlisting can gate browser REST traffic, but it does not cover WebSockets (there is no reliable
Origin enforcement on a raw WS URL), and an origin restriction still ships your real API key to the client, where it can be lifted and replayed from any environment that spoofs the header. Ephemeral Keys solve both: the API key never leaves your backend, and the client-side token is worthless after 30 minutes.The security model
The design rests on three properties:- Your API key never reaches the client. Only your backend holds it. It is used once per refresh, server-to-server, to mint an Ephemeral Key.
- Ephemeral Keys inherit the parentβs access. An Ephemeral Key carries exactly the parent API keyβs bindings - never wider, and in this release never narrower. The edge enforces the parentβs access on every request, and all usage attributes to the parent, so quotas and billing are unchanged. (Per-child scope narrowing is planned but not part of this release.)
- Ephemeral Keys are safe if stolen. They are signed RS256 JWTs with a 30-minute expiry. An attacker who captures one from a browser or a WS URL can use it only until it expires - a small, self-healing blast radius. No secret is recoverable from the token.
The 30-minute TTL
The default TTL is 30 minutes (1800 seconds); the maximum you can request is 60 minutes (3600 seconds). Short TTLs are the primary revocation mechanism: instead of maintaining a per-token online blocklist, we let tokens expire quickly and refresh them on a timer.- Too short and clients refresh constantly, adding mint load.
- Too long and a stolen token stays useful.
- 30 minutes keeps the leaked-token window small while a client only mints ~48 times a day.
Lifecycle: mint β embed β refresh
- Mint (server-side). Your backend calls
POST /platform/ephemeral_keys/with your API key and gets back{ ephemeral_key, expires_at }. - Embed (client-side). Your backend passes the
gr_ek_β¦token to the client, which uses it exactly where it would have used an API key - as akeyquery parameter, a bearer token, or Basic Auth. - Refresh (client-side). Shortly before
expires_at, the client asks your backend for a fresh Ephemeral Key and swaps it in. For long-lived WebSocket connections, reconnect (or re-authenticate) with the new token before the old one expires.
EphemeralKeyProvider handles this refresh loop for you.
Quick start (curl)
Two calls: your backend mints an Ephemeral Key with your API key, then the client uses thatgr_ek_β¦ token exactly where it would have used an API key.
1. Mint (server-side, with your API key).
gr_ek_β¦ token). An Ephemeral Key authenticates the data APIs the same way an API key does - as a Bearer token, Basic Auth username, or key query parameter. Against the Foundational API:
key query parameter at connect time:
gr_ek_β¦ token from your mint proxy (Recipe A) and refreshes it before expires_at.
API reference
All Ephemeral Key management endpoints live under the Platform control plane athttps://api.covalenthq.com and are authenticated with your API key, not with an Ephemeral Key. Each has a dedicated reference page under API Reference βΊ Ephemeral Keys; the summary below is the narrative version.
Mint an Ephemeral Key
cqt_β¦ / ckey_β¦) as a bearer token. The request body is optional JSON. An Ephemeral Key cannot mint another Ephemeral Key - the request is rejected with 403 if authenticated with a gr_ek_β¦ token (and likewise for a gr_sk_β¦ service key).
integer
Requested lifetime in seconds. Optional; defaults to 1800 (30 min). Clamped to
[1, 3600] - the server maximum is 3600 (60 min), so larger requests are silently reduced to the cap. A non-integer value returns 400.200 OK
string
The signed RS256 JWT, prefixed
gr_ek_. This is what you hand to the client.string
ISO-8601 UTC timestamp at which the tokenβs
exp claim falls due. Refresh before this time.Ephemeral JWKS endpoint
kid; up to two are active at once to allow zero-downtime rotation. Cache the response and refetch when you encounter an unknown kid.
This is a dedicated key set for Ephemeral Keys. It is unrelated to any other GoldRush signing key.
Token claims
An Ephemeral Key is a standard RS256 JWT. Decode (without needing the private key) to inspect its claims - useful for debugging expiry:
The signing key id (
kid) travels in the JWT header (not the claims), so a verifier can select the right JWKS key before checking the signature. There is no scopes claim in this release - a token inherits the parentβs full access.
The token deliberately carries no secret - everything in it is safe for the client to see. It is trusted only because of the signature.
Error codes
Minting (theplatform/ephemeral_keys/ endpoint). Errors are returned in the standard GoldRush envelope ({ "error": true, "error_message": β¦, "error_code": β¦ }):
Using an Ephemeral Key on the data APIs (Foundational, JSON-RPC, Hyperliquid, x402):
The distinct expired vs invalid
401 responses let SDKs refresh automatically on expiry without retry-looping on a genuinely bad token. The EphemeralKeyProvider refreshes proactively, before exp, so a well-behaved client rarely sees an expired 401 at all.
Recipes
Recipe A - Node/Express mint proxy
Your backend exposes one small endpoint that mints an Ephemeral Key from your (secret) API key. This is the only place your API key is ever used. The browser does call this proxy - that is the intended design, and it is safe for two independent reasons:- The proxy is not open. It sits behind your appβs existing user session (cookie, session token, or whatever you already use to know who is logged in). A random visitor with no session gets
401and never mints anything. Only your authenticated users can obtain a token, so nobody can run up your bill by hammering the endpoint. That is the job ofrequireYourUserAuthbelow - your own auth middleware, not something GoldRush provides. - The token it returns is safe to hold in the browser. An Ephemeral Key is meant to live in an untrusted client - it is a 30-minute, parent-scoped, secret-free JWT (see the security model). What must never reach the browser is your API key; the Ephemeral Key reaching the browser is the whole point.
Why isnβt the mint endpoint itself the weak link? A common worry: βif the browser can call
/api/goldrush-ephemeral-key, canβt anyone call it and steal a token?β No - because the endpoint is gated by your login (property 1), an unauthenticated caller gets nothing, and even a token handed to a legitimate-but-untrusted client is disposable by design (property 2). The endpoint returns a short-lived child credential to people who are already your logged-in users; it never returns your API key.Recipe B - Browser WebSocket with auto-refresh
Connect a browser to the Hyperliquid WebSocket using an Ephemeral Key, and refresh it before it expires. The TypeScript SDKβsEphemeralKeyProvider calls your mint proxy (Recipe A) and keeps a valid token ready:
wss://hypercore.goldrushdata.com/ws?key=<gr_ek_β¦>, and set a timer for expires_at β 5 min that fetches a fresh token and reconnects. See the WebSocket API overview for subscription payloads.
A WebSocket authenticated with an Ephemeral Key cannot outlive the tokenβs expiry beyond the max TTL - the edge drops or requires re-auth at
exp. Always reconnect with a fresh token before then; donβt rely on an open socket staying open indefinitely.FAQ
-
Do Ephemeral Keys change my billing?
No. All usage attributes to the parent API keyβs
parent_key_id, exactly as if the parent had made the calls. There is no separate meter or plan for Ephemeral Keys. -
Can I mint an Ephemeral Key from another Ephemeral Key?
No. Only a parent API key (
cqt_β¦/ckey_β¦) can mint. Minting with agr_ek_β¦token is rejected - this prevents a leaked client token from bootstrapping fresh long-lived access. -
Can I restrict what an Ephemeral Key can do (per-child scopes)?
Not in this release. A token inherits exactly the parent API keyβs access - it canβt be widened, and per-child narrowing (fewer chains/endpoints) is planned but not yet available. The only mint-time parameter today is
ttl_seconds. -
If the browser calls my mint proxy, canβt anyone call it and steal a token?
No. Your mint proxy sits behind your appβs own login (the
requireYourUserAuthstep in Recipe A) - an unauthenticated request gets401and mints nothing, so nobody can run up your bill. And a token handed to one of your legitimate users is safe to hold client-side anyway: it is a 30-minute, parent-scoped, secret-free JWT. The thing that must stay server-side is your API key, never the Ephemeral Key. - Is this the same as a ServiceKey? No - different job. ServiceKeys authenticate account-level Platform operations (like reading your usage) and are rejected on the data APIs. Ephemeral Keys authenticate data requests on behalf of a parent API key and are for client-side embedding. See also Authentication for server-side API-key usage.