Skip to main content Link Search Menu Expand Document (external link)

Quick Start

Get started in three easy steps:

Your address: -

Your address: <span id="output">-</span>
<button id="choose-address">Choose address</button>

<!-- 1. Include the Hub API from the CDN -->
  integrity="sha256-5X6zryCUAPOnfjLU8tEtJrLdcslA2UI27RsUWnLAxHs=" crossorigin="anonymous"></script>

  // 2. Initialize the Hub API for the testnet (for mainnet use '')
  const hubApi = new HubApi('');

  // 3. Add a click handler to start a Hub API request
  document.getElementById('choose-address').addEventListener('click', async function(event) {
    const output = document.getElementById('output');

    try {
      const result = await hubApi.chooseAddress({ appName: 'Hub API Docs' });
      output.textContent = result.address;
    } catch (error) {
      output.textContent = error.message;

For more details about available methods on the HubApi, please see the API Reference.