Relay enforces rate limits to ensure platform reliability and fair usage across integrators. Default limits apply to all requests. Higher limits are available via API keys.
// It is recommended to only set the apiKey parameter when using the SDK server-side.import { createClient, MAINNET_RELAY_API,} from "@relayprotocol/relay-sdk";createClient({ baseApiUrl: MAINNET_RELAY_API, apiKey: "YOUR_API_KEY", ... //other parameters});
If using the sdk on the client, create a proxy api which appends the key in the headers and then pass that endpoint into the baseApiUrl parameter. This prevents your key from being leaked while allowing you to set up the necessary protection in your proxy api.
Copy
Ask AI
import { createClient, MAINNET_RELAY_API,} from "@relayprotocol/relay-sdk";createClient({ baseApiUrl: "https://my-proxy.relay.link", //Replace with your proxy endpoint ... //other parameters});
Your API key is sensitive — treat it like a password. It is tied to your account, controls your rate limits, and all requests made with it are attributed to you.
If your API key is leaked, unauthorized parties could consume your rate limits or make requests on your behalf. Contact us immediately if you suspect your key has been compromised and we will rotate it for you.
Best practices:
Keep it server-side only — never expose it in client-side or frontend code. Use a proxy API if calling Relay from the browser.
Use environment variables — store your key in environment variables, not hardcoded in source code.
Don’t commit it to version control — add it to .gitignore or use a secrets manager.
Restrict access — only share the key with team members who need it.