# Authentication

> Learn how to authenticate your API requests.

## Authentication

All API requests must include a valid API key in the `Authorization` header using the Bearer token scheme, along with the `x-wayinvideo-api-version` header:

```
Authorization: Bearer YOUR_API_KEY
x-wayinvideo-api-version: v2
```

## Obtaining an API Key

1. Log in to your [WayinVideo API Dashboard](https://wayin.ai/wayinvideo/api-dashboard)
2. Click **Create API Key** to generate a new key
3. Copy and securely store your API key — it will only be shown once

> **Important:** Keep your API key secret. Never expose it in client-side code or public repositories. If you suspect a key has been compromised, delete it and create a new one immediately.

## Making Authenticated Requests

Include the `Authorization` header in every request:

```bash
curl -X POST https://wayinvideo-api.wayin.ai/api/v2/clips \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-wayinvideo-api-version: v2" \
  -d '{"video_url": "https://www.youtube.com/watch?v=example"}'
```

## Error Responses

If authentication fails, the API returns **403 Forbidden**. Example response body:

```json
{
  "timestamp": "2026-03-13T07:58:46.156+00:00",
  "status": 403,
  "error": "Forbidden",
  "path": "/api/v2/clips"
}
```
