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

# Troubleshooting Authentication & 40x Errors

> How to diagnose and fix 401, 403, and 404 errors in your API requests

## Overview

This guide helps you troubleshoot common authentication and request errors when using the Reprompt API. Most 40x errors are related to API keys, organization slugs, or request formatting.

## 401 Unauthorized

A `401` error means your API key is invalid, missing, or revoked.

### Common Causes

1. **Missing or malformed Authorization header**
2. **Revoked API key**
3. **Expired API key**
4. **Copy-paste errors** (extra spaces, truncated key)

### How to Fix

<Steps>
  <Step title="Check your Authorization header">
    Ensure you're including the header in the correct format:

    ```bash theme={null}
    Authorization: Bearer YOUR_API_KEY_HERE
    ```

    **Common mistakes:**

    * Missing the word `Bearer`
    * Extra spaces before/after the key
    * Using single quotes instead of the actual key value
  </Step>

  <Step title="Verify your API key is active">
    Check if your key has been revoked:

    1. Go to [Organization Settings → API Keys](https://app.repromptai.com/organization)
    2. Click **"Show revoked keys"** to see if your key was disabled
    3. If revoked, generate a new API key
  </Step>

  <Step title="Generate a new API key">
    If your key is revoked or you suspect it's compromised:

    1. Navigate to [Organization Settings](https://app.repromptai.com/organization)
    2. Go to the **API Keys** section
    3. Click **"Create new API key"**
    4. Copy the new key immediately (it won't be shown again)
    5. Update your application with the new key
  </Step>
</Steps>

***

## 403 Forbidden

A `403` error means your API key is valid, but you don't have permission to access the requested resource.

### Common Causes

1. **Accessing another organization's resources** - Using an org slug that doesn't match your API key
2. **Insufficient permissions** - Your API key doesn't have access to the specific resource or endpoint

### How to Fix

<Steps>
  <Step title="Verify your organization slug matches your API key">
    Ensure you're using the correct org slug for your API key:

    Check that the `{org_slug}` in your URL matches your organization
  </Step>
</Steps>

***

## 404 Not Found

A `404` error means the API endpoint doesn't exist, usually due to an incorrect URL or org slug.

### Common Causes

1. **Incorrect organization slug** in the URL
2. **Typo in the endpoint path**
3. **Wrong API version** (using V1 endpoint format with V2 base URL or vice versa)
4. **Invalid batch ID or resource ID** in the path

### How to Fix

<Steps>
  <Step title="Verify your organization slug">
    Double-check your org slug is correct:

    ```bash theme={null}
    # ❌ Wrong
    https://api.repromptai.com/v1/wrong-slug/place_enrichment/enrich

    # ✅ Correct (replace {org_slug} with your actual org slug)
    https://api.repromptai.com/v1/{org_slug}/place_enrichment/enrich
    ```

    Find your org slug in the [Dashboard URL](https://app.repromptai.com/organization) when logged in.
  </Step>

  <Step title="Check your endpoint path">
    Ensure you're using the correct endpoint path. Common endpoints include:

    **V1 Endpoints (with org slug):**

    * `https://api.repromptai.com/v1/{org_slug}/place_enrichment/enrich` - Single place enrichment
    * `https://api.repromptai.com/v1/{org_slug}/place_enrichment/batches` - Create/list batches
    * `https://api.repromptai.com/v1/{org_slug}/place_enrichment/batches/{batch_id}` - Get batch status
    * `https://api.repromptai.com/v1/{org_slug}/place_enrichment/jobs` - Get job results

    **V2 Endpoints (no org slug):**

    * `https://api.reprompt.io/v2/enrich` - Single place enrichment
    * `https://api.reprompt.io/v2/attributes` - List available attributes
  </Step>

  <Step title="Validate against the API docs">
    Cross-reference your request with the [API Reference](https://docs.repromptai.com/):

    1. Check the correct HTTP method (GET, POST, etc.)
    2. Verify the endpoint path matches the documentation
    3. Ensure required path parameters (like `{batch_id}`) are valid
    4. Confirm you're using the right API version
  </Step>

  <Step title="Test with a minimal example">
    Try the basic example from the [Quickstart guide](/guides/quickstart) to verify your configuration:

    ```bash theme={null}
    curl -X POST \
      'https://api.repromptai.com/v1/{org_slug}/place_enrichment/enrich' \
      -H 'Authorization: Bearer {YOUR_API_KEY}' \
      -H 'Content-Type: application/json' \
      -d '{
        "inputs": {
          "name": "Joe'\''s Pizza",
          "latitude": 40.7359,
          "longitude": -73.9911
        },
        "attributes": ["websites"]
      }'
    ```
  </Step>
</Steps>

***

## Quick Reference Table

| Error Code | Meaning      | Primary Cause                    | Quick Fix                                                         |
| ---------- | ------------ | -------------------------------- | ----------------------------------------------------------------- |
| **401**    | Unauthorized | Invalid/revoked API key          | [Check API key status →](https://app.repromptai.com/organization) |
| **403**    | Forbidden    | Accessing unauthorized resources | Verify org slug matches API key                                   |
| **404**    | Not Found    | Wrong URL or org slug            | Verify org slug and endpoint path                                 |

***

## Related Guides

* [Quickstart](/guides/quickstart) - Basic API usage
* [Batch Processing](/guides/batch-processing) - Batch endpoint details
* [Agents in API](/guides/agents-in-api) - Using custom agents via API
