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

# API 密钥

> 使用 API Key 鉴权 Open API 请求

export const apiKeyUrl = "https://www.vmeg.ai/open-api-setting";

export const productUrls = JSON.parse('{"home":"https://www.vmeg.ai/home","apiConfiguration":"https://www.vmeg.ai/open-api-setting","signIn":"https://www.vmeg.ai/signIn?redirect=%2Fhome","signInToApiSettings":"https://www.vmeg.ai/signIn?redirect=%2Fopen-api-setting","signUp":"https://www.vmeg.ai/signup","account":"https://www.vmeg.ai/account","helpCenter":"https://www.vmeg.ai/help-center/","pricing":"https://www.vmeg.ai/pricing","myTasks":"https://www.vmeg.ai/my-tasks","myAssets":"https://www.vmeg.ai/my-assets","videoTranslation":"https://www.vmeg.ai/translation","audioTranslation":"https://www.vmeg.ai/audio-translation","cloneVoice":"https://www.vmeg.ai/clone-voice","bookDemo":"https://www.vmeg.ai/book-a-demo/","contactUs":"https://www.vmeg.ai/contact-us/","apiDocs":"https://docs.vmeg.ai"}');

## API Key

所有 `/openapi/v1/**` 接口都需要 **API Key**。

## 请求头

每次请求都必须在 HTTP **Authorization** 请求头中携带密钥（不要放在 URL 查询参数或请求体里）：

```http theme={null}
Authorization: Bearer <your_api_key>
```

`curl` 示例：

```bash theme={null}
curl "https://api.vmeg.ai/openapi/v1/tasks/list" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

将 `YOUR_API_KEY` 替换为 <a href={apiKeyUrl}>API 配置</a> 中的密钥。

## 数据范围

API Key 决定你可查询、管理的 **任务**、**素材** 与 **克隆音色** 范围。请仅按各接口文档传参。

<Warning>
  勿在客户端或公开仓库中暴露 API Key。请使用环境变量或密钥管理服务。
</Warning>

## 创建与轮换

在 vmeg.ai 的 <a href={apiKeyUrl}>API 配置</a> 页（登录后侧栏 **API**）创建或轮换 Key。未登录请先 <a href={productUrls.signInToApiSettings}>登录</a>。

同一页面可配置异步回调的 **Webhook URL**；保存后可在该页查看 VMEG **自动生成的 Webhook Secret**。

<Info>
  API 配置面向付费用户，见 [价格](/zh/guides/pricing)。
</Info>

## 鉴权失败

HTTP 状态码 `401`，响应体示例：

```json theme={null}
{
  "code": 401,
  "message": "Invalid or missing API Key",
  "data": null
}
```

完整错误码见 [错误码](/zh/guides/errors)。
