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

# Authentication

> Secure your API requests with Authorization header authentication.

## API Key Authentication

All Range Data API requests require authentication using an API key passed in the request header.

### Getting Your API Key

<Steps>
  <Step title="Sign Up">
    Create a free account at [app.range.org](https://app.range.org)
  </Step>

  <Step title="Generate API Key">
    Navigate to your dashboard and generate a new API key
  </Step>

  <Step title="Copy & Secure">
    Copy your API key and store it securely. Treat it like a password, never
    commit it to version control.
  </Step>
</Steps>

***

## Making Authenticated Requests

Include your API key in the `Authorization` header with every request:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.range.org/v1/address?address=YOUR_ADDRESS&network=solana" \
    -H "Authorization: Bearer your_api_key_here"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.range.org/v1/address?address=YOUR_ADDRESS&network=solana",
    {
      headers: {
        Authorization: "Bearer your_api_key_here",
      },
    }
  );
  const data = await response.json();
  ```

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

  headers = {
      'Authorization': 'Bearer your_api_key_here'
  }

  response = requests.get(
      'https://api.range.org/v1/address',
      params={'address': 'YOUR_ADDRESS', 'network': 'solana'},
      headers=headers
  )
  data = response.json()
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch(
    "https://api.range.org/v1/address?address=YOUR_ADDRESS&network=solana",
    {
      headers: {
        Authorization: "Bearer your_api_key_here",
      },
    }
  );
  const data = await response.json();
  ```
</CodeGroup>

***

## Rate Limits

API rate limits vary by plan tier:

| Plan           | Rate Limit          | Monthly Quota         |
| -------------- | ------------------- | --------------------- |
| **Free**       | 10 requests/minute  | 100 requests/month    |
| **Pro**        | 100 requests/minute | 10,000 requests/month |
| **Enterprise** | Custom              | Custom                |

<Info>
  Rate limit headers are included in every API response to help you track usage:

  * `X-RateLimit-Limit`: Your rate limit ceiling - `X-RateLimit-Remaining`:
    Requests remaining in current window - `X-RateLimit-Reset`: Time when the rate
    limit resets (Unix timestamp)
</Info>

***

## Error Responses

### 401 Unauthorized

Missing or invalid API key:

```json theme={null}
{
  "statusCode": 401,
  "message": "Unauthorized",
  "error": "Invalid or missing API key"
}
```

**Solution:** Verify your API key is correct and included in the `Authorization` header.

### 429 Too Many Requests

Rate limit exceeded:

```json theme={null}
{
  "statusCode": 429,
  "message": "Too Many Requests",
  "error": "Rate limit exceeded. Please try again later."
}
```

**Solution:** Wait for the rate limit window to reset (check `X-RateLimit-Reset` header) or upgrade your plan.

***

## Best Practices

<AccordionGroup>
  <Accordion title="Environment Variables" icon="circle-check">
    Store your API key in environment variables, never hardcode it:

    ```bash theme={null}
    export RANGE_API_KEY="your_api_key_here"
    ```

    ```javascript theme={null}
    const apiKey = process.env.RANGE_API_KEY;
    ```
  </Accordion>

  {" "}

  <Accordion title="Server-Side Only" icon="server">
    Never expose your API key in client-side code (frontend JavaScript, mobile
    apps). Make API calls from your backend server.
  </Accordion>

  {" "}

  <Accordion title="Key Rotation" icon="rotate">
    Rotate your API keys periodically and immediately if you suspect they've been
    compromised. You can generate new keys in your dashboard.
  </Accordion>

  <Accordion title="Monitor Usage" icon="chart-line">
    Track your API usage in the Range dashboard to avoid hitting rate limits and optimize your integration.
  </Accordion>
</AccordionGroup>

***

## Need Help?

<CardGroup cols={2}>
  <Card title="Upgrade Your Plan" icon="arrow-up" href="https://app.range.org">
    Need higher rate limits? Upgrade to Pro or Enterprise for increased
    capacity.
  </Card>

  <Card title="Contact Support" icon="headset" href="https://www.range.org/get-in-touch">
    Having authentication issues? Our team is here to help.
  </Card>
</CardGroup>
