Skip to main content

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:

  1. Visit https://envio.dev/app/api-tokens
  2. Sign in to your account (or create one if you don't have one)
  3. Follow the prompts to create a new token
  4. Copy and securely store your token

Implementation Guide

To use an API token, pass it as a bearer_token when creating a HyperSync client:

const client = HypersyncClient.new({
url: "https://eth.hypersync.xyz",
bearerToken: process.env.HYPERSYNC_BEARER_TOKEN,
});

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.