Skip to main content
Many RPC providers require authentication headers. CosmJS supports this through the HttpEndpoint interface, which lets you attach headers to every request.

Custom Headers

Pass an HttpEndpoint object instead of a plain URL to attach headers to every request:
HttpEndpoint works everywhere a string URL is accepted — StargateClient.connect, SigningStargateClient.connectWithSigner, CosmWasmClient.connect, connectComet, HttpClient, and HttpBatchClient.
When you pass an HttpEndpoint object, the transport is always HTTP — even if the URL uses a ws:// scheme.

Custom Headers with Batching

Signing Client with Custom Endpoint

Full Manual Configuration

For maximum control — custom headers, timeouts, batching, and a specific CometBFT version — compose the layers yourself:

Next Steps

Version Detection

Understand CometBFT auto-detection and when to skip it.

Timeouts

Configure timeout values at every layer.