API Tokens for HyperSync
Overview
API tokens provide authenticated access to HyperSync services, enabling enhanced capabilities and usage tracking. While currently optional, they will become mandatory in the future and offer significant advantages for serious usage.
Table of Contents
Benefits of Using API Tokens
Using API tokens with HyperSync provides several advantages:
- Dedicated Resources: Access to reserved capacity and bandwidth
- Performance Guarantees: Higher quality of service with better reliability
- Usage Analytics: Track and monitor your consumption patterns
- Future-Proofing: Early adoption before tokens become mandatory
- Enhanced Support: Better visibility for troubleshooting assistance
Generating API Tokens
You can generate API tokens through the Envio Dashboard:
- Visit https://envio.dev/app/api-tokens
- Sign in to your account (or create one if you don't have one)
- Follow the prompts to create a new token
- Copy and securely store your token
Implementation Guide
To use an API token, pass it as a bearer_token
when creating a HyperSync client:
- TypeScript/JavaScript
- Python
- Rust
const client = HypersyncClient.new({
url: "https://eth.hypersync.xyz",
bearerToken: process.env.HYPERSYNC_BEARER_TOKEN,
});
client = hypersync.HypersyncClient(hypersync.ClientConfig(
url="https://eth.hypersync.xyz",
bearer_token=os.environ.get("HYPERSYNC_BEARER_TOKEN")
))
let client = Client::new(ClientConfig {
bearer_token: Some(std::env::var("HYPERSYNC_BEARER_TOKEN").unwrap_or_default()),
..Default::default()
})
.unwrap();
Security Best Practices
When working with API tokens:
- Never commit tokens to git repositories
- Use environment variables to store tokens instead of hardcoding
- Add token files like
.env
to your `.gitignore - Rotate tokens periodically for enhanced security
- Limit token sharing to only those who require access
# Example .env file
HYPERSYNC_BEARER_TOKEN=your_secret_token_here
This approach keeps your tokens secure while making them available to your application at runtime.