> ## Documentation Index
> Fetch the complete documentation index at: https://docs.onebalance.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Authenticate your API requests with OneBalance using API keys

OneBalance uses API keys to authenticate all requests. You must include your API key in the `x-api-key` header with every request to access the API.

## Get your API key

### Testing and development

Start building immediately with our public testing key. This key has limited functionality but lets you explore the API without setup.

<Note>
  **Public testing key:** `42bb629272001ee1163ca0dbbbc07bcbb0ef57a57baf16c4b1d4672db4562c11`

  This key works for all endpoints and has rate limits suitable for development.
</Note>

### Production access

Get a production API key with full access and custom configuration for your project.

<Steps>
  <Step title="Contact our team">
    Use the **Intercom chat widget** in the bottom right corner or email [support@onebalance.io](mailto:support@onebalance.io) with your API key request.
  </Step>

  <Step title="Provide project details">
    Include this information in your request:

    * **Company name** and project name
    * **Use case description** - what you're building
    * **Expected volume** - transactions per day/month
    * **Preferred chains** - which networks you plan to use (see [supported networks](/resources/supported-networks))
    * **Asset preferences** - which tokens you need access to

    <Tip>
      The more details you provide, the faster we can configure your key with the right permissions.
    </Tip>
  </Step>

  <Step title="Receive your key">
    Our team will generate your custom API key and send it to you, typically within 24 hours.

    <Check>
      You'll receive your production key via email along with any specific configuration details.
    </Check>
  </Step>
</Steps>

<Note>
  We're building self-service API key generation to make this process instant. Stay tuned for updates!
</Note>

## Make authenticated requests

Include your API key in the `x-api-key` header with every request:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET 'https://be.onebalance.io/api/assets/list' \
    -H 'x-api-key: YOUR_API_KEY'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://be.onebalance.io/api/assets/list', {
    headers: {
      'x-api-key': 'YOUR_API_KEY'
    }
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  headers = {
      'x-api-key': 'YOUR_API_KEY'
  }

  response = requests.get('https://be.onebalance.io/api/assets/list', headers=headers)
  data = response.json()
  ```
</CodeGroup>

<Tip>
  Replace `YOUR_API_KEY` with your actual key. For testing, use the public key: `42bb629272001ee1163ca0dbbbc07bcbb0ef57a57baf16c4b1d4672db4562c11`
</Tip>

## Security requirements

<Warning>
  Keep your production API key secure. Never expose it in client-side code, public repositories, or logs.
</Warning>

Follow these security practices:

* **Use HTTPS only** - All requests must use HTTPS. HTTP requests will fail
* **Store keys securely** - Use environment variables or secure key management
* **Rotate keys regularly** - Contact support to rotate compromised keys
* **Monitor usage** - Watch for unexpected API calls that might indicate misuse

## Troubleshooting

### Common authentication errors

**401 Unauthorized**

* Check that you're including the `x-api-key` header
* Verify your API key is correct and not expired
* Ensure you're making requests over HTTPS

**403 Forbidden**

* Your key may not have permission for this endpoint
* Contact support if you need additional access

**Rate limited**

* You're exceeding your key's rate limits
* Implement exponential backoff in your retry logic
* Contact support for higher limits if needed

<Accordion title="Example error response">
  ```json theme={null}
  {
    "error": "Unauthorized",
    "message": "Invalid or missing API key",
    "code": 401
  }
  ```
</Accordion>

Need help? Use the **Intercom chat widget** in the bottom right corner for instant assistance, or contact [support@onebalance.io](mailto:support@onebalance.io) for authentication issues.
