createClient, and it signs each request and sets the PX-*
headers for you. Create a client once and reuse it for every call.
privateKeyHex is your key’s 32-byte seed as 64 lowercase hex characters. The
private key never leaves your process: only the key id, a timestamp, and the
signature go on the wire. Load it from an environment variable or secret manager
rather than committing it.
You generate the keypair in your own environment and register the public half
with ParlayX. See Authentication for the wire-level canonical
string, key registration, and revocation.
Clock skew
The signature covers a timestamp the API checks against its own clock, within 30 seconds. A host whose clock has drifted further will see every request fail withUNAUTHORIZED, which looks like a bad key rather than a bad clock. Keep NTP
running; client.getTime() returns the server clock and is verified without a
timestamp, so it still works on a drifted host and lets you measure the offset.
The client targets the production API. Reuse a single instance across your
application.