Program Streams Authentication and Policy
Authenticate Program Streams calls and apply an issued event policy.
Every Program Streams call needs an API key.
x-api-key: YOUR_API_KEYAPI key
Attach the key as gRPC metadata.
metadata = [("x-api-key", os.environ["NLN_API_KEY"])]Keep the key in a secret manager or environment variable. Do not send the key to browser code.
Event policy
Some account setups include an event policy. The policy limits programs and topics.
If your dashboard provides a policy, send its exact JSON value:
x-eventstream-policy: {"version":1,"allowed_programs":["pump_fun"],"allowed_topics":["solana.pump_fun.trade_event"]}Python:
metadata = [ ("x-api-key", os.environ["NLN_API_KEY"]), ("x-eventstream-policy", json.dumps(policy)),]Do not invent a broader policy in client code. Server-side account rules still apply.
Policy behavior
ListTopicsreturns topics visible to the caller.GetTopicSchemafollows the same access boundary.Subscriberejects blocked topics.- A key with server-side topic access does not need a client policy header.
Rotation
- Create or receive a replacement node credential.
- Update your secret manager.
- Restart consumers in stages.
- Confirm
ListTopics. - Revoke the old credential.