Acquire an API Key
Request and manage API keys for Pyth Pro
This guide explains how to acquire an API key for Pyth Pro, which is required to authenticate websocket connections and authenticated HTTP endpoints (the History and REST APIs) and subscribe to price updates.
Request API Key
Sign up for a free Pyth Terminal account.Once you have logged in, click on the 🔑 View your API key button to obtain your API key.
API keys are required for Pyth Pro websocket connections and for authenticated HTTP endpoints. Make sure to keep your key secure and do not share it publicly.
Using the API Key
Once you receive your API key, use it to authenticate the websocket connection by passing it as an Authorization header with the value Bearer {key}.
Example Usage
import { PythLazerClient } from "@pythnetwork/pyth-lazer-sdk";
const client = await PythLazerClient.create(
[
"wss://pyth-lazer-0.dourolabs.app/v1/stream",
"wss://pyth-lazer-1.dourolabs.app/v1/stream",
"wss://pyth-lazer-2.dourolabs.app/v1/stream",
],
"YOUR_API_KEY",
);The same Authorization: Bearer <PRO_API_KEY> header authenticates the History
and REST HTTP endpoints. For example, against the History API:
curl -H "Authorization: Bearer $PRO_API_KEY" \
"https://pyth.dourolabs.app/v1/fixed_rate@200ms/price?ids=1×tamp=1704067200000000"Browser and frontend apps must not embed the key — route requests through your own backend, which injects the header before forwarding, or use the short-lived JWT flow described in Frontend Authentication. See the Authentication sections on the History and REST API pages for full details.
Next Steps
- Subscribe to price feeds using the Pyth Pro websocket API.
- For browser/frontend apps, follow Frontend Authentication to hand out short-lived JWTs instead of embedding the API key.