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

# API Authentication Guide | Video Background Remover API Key Setup

> Complete authentication guide for VideoBGRemover API. Learn API key setup, security best practices, rate limiting, and troubleshooting with examples.

## API Key Format

All API requests require authentication using an API key with the format `vbr_` followed by 32 characters.

```
vbr_1234567890abcdef1234567890abcdef
```

## Request Header

Include your API key in the `X-Api-Key` header for all requests:

```bash theme={"dark"}
curl -X GET https://api.videobgremover.com/v1/credits \
  -H "X-Api-Key: vbr_your_api_key_here"
```

<Warning>
  Never share your API key publicly or include it in client-side code. Keep it secure on your server.
</Warning>

## Getting Your API Key

<Steps>
  <Step title="Create an account">
    Sign up at [videobgremover.com](https://videobgremover.com) if you haven't already.
  </Step>

  <Step title="Purchase credits">
    You need credits to create an API key. Buy credits in your dashboard.
  </Step>

  <Step title="Generate API key">
    Go to [API Management](https://videobgremover.com/api-management) and create a new API key with a descriptive name.
  </Step>
</Steps>

## Testing Authentication

Test your API key by checking your credit balance:

```bash theme={"dark"}
curl -X GET https://api.videobgremover.com/v1/credits \
  -H "X-Api-Key: vbr_your_api_key_here"
```

**Success Response:**

```json theme={"dark"}
{
  "user_id": "user-uuid",
  "total_credits": 100,
  "remaining_credits": 95,
  "used_credits": 5
}
```

## Authentication Errors

### Invalid API Key (401)

```json theme={"dark"}
{
  "error": "Invalid API key"
}
```

**Common causes:**

* Typo in the API key
* Using wrong header name (should be `X-Api-Key`)
* API key was deleted or deactivated

### Missing API Key (401)

```json theme={"dark"}
{
  "error": "API key required"
}
```

**Solution:** Make sure you include the `X-Api-Key` header in your request.

## Security Best Practices

<AccordionGroup>
  <Accordion title="Server-side only">
    Never use API keys in client-side JavaScript, mobile apps, or any publicly accessible code.
  </Accordion>

  <Accordion title="Environment variables">
    Store your API key in environment variables, not in your source code:

    ```bash theme={"dark"}
    export VIDEOBGREMOVER_API_KEY="vbr_your_api_key_here"
    ```
  </Accordion>

  <Accordion title="Key rotation">
    Regularly rotate your API keys. Create a new key before deleting the old one to avoid downtime.
  </Accordion>

  <Accordion title="Separate keys for environments">
    Use different API keys for development, staging, and production environments.
  </Accordion>
</AccordionGroup>

## Rate Limits

Each API key has the following limits:

* **100 requests per minute**
* **3 video processing jobs per minute**

Rate limit headers are included in all responses:

```
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200
```

When you exceed the rate limit, you'll receive a `429 Too Many Requests` response.
