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

# Error Handling

> Frequently asked questions about handling API errors

<AccordionGroup>
  <Accordion title="What does a 401 error mean?">
    A `401 Unauthorized` error means authentication failed. Check that:

    1. Your API key is correct
    2. The header format is `Authorization: Bearer your-api-key`
    3. Your key has not been deactivated or rotated
  </Accordion>

  <Accordion title="What does a 429 error mean?">
    A `429 Too Many Requests` error means you're sending requests too frequently. Solutions:

    1. Reduce your request frequency
    2. Implement exponential backoff retry logic (see example below)
    3. Contact support if you need higher rate limits
  </Accordion>

  <Accordion title="What does a 500 error mean?">
    A `500 Internal Server Error` indicates a server-side issue. Steps to take:

    1. Wait a moment and retry the request
    2. Verify your request parameters are valid
    3. If the error persists, contact support with your request details
  </Accordion>

  <Accordion title="How should I implement request retries?">
    Use exponential backoff with random jitter to avoid overwhelming the server:

    ```python theme={null}
    import time
    import random

    def api_call_with_retry(func, max_retries=3):
        for attempt in range(max_retries):
            try:
                return func()
            except Exception as e:
                if attempt == max_retries - 1:
                    raise e

                # Exponential backoff + random jitter
                wait_time = (2 ** attempt) + random.uniform(0, 1)
                time.sleep(wait_time)
    ```

    For more advanced retry strategies, see [Error Handling and Retry Mechanisms](/code-examples/error-handling).
  </Accordion>
</AccordionGroup>
