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

# 获取授权服务器元数据

> 发现此环境的公开 OAuth 端点，以及支持的授权码、PKCE、刷新和撤销机制。

发现此环境的公开 OAuth 端点，以及支持的授权码、PKCE、刷新和撤销机制。

```http theme={null}
GET https://api.voicecheap.ai/.well-known/oauth-authorization-server
```

## 身份验证

无。

## 请求示例

请遵循此路由文档规定的编码和身份验证方式。操作 API 的封装格式和幂等性规则仅适用于操作调用。

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET 'https://api.voicecheap.ai/.well-known/oauth-authorization-server'
  ```

  ```javascript JavaScript theme={null}
  const input = {};
  const response = await fetch('https://api.voicecheap.ai/.well-known/oauth-authorization-server', {
    method: 'GET',
    headers: {},
    redirect: 'manual',
  });
  console.log(response.status, await response.text());
  ```

  ```python Python theme={null}
  import os
  import requests

  response = requests.request(
      "GET",
      "https://api.voicecheap.ai/.well-known/oauth-authorization-server",
      headers={},
      timeout=120,
      allow_redirects=False,
  )
  print(response.status_code, response.text)
  ```
</RequestExample>

## 响应

OAuth 授权服务器元数据，包含位于规范签发者源站上的绝对端点 URL。

```json HTTP 200 theme={null}
{
  "issuer": "https://api.voicecheap.ai",
  "authorization_endpoint": "https://api.voicecheap.ai/oauth/authorize",
  "token_endpoint": "https://api.voicecheap.ai/oauth/token",
  "registration_endpoint": "https://api.voicecheap.ai/oauth/register",
  "revocation_endpoint": "https://api.voicecheap.ai/oauth/revoke",
  "response_types_supported": ["code"],
  "response_modes_supported": ["query"],
  "grant_types_supported": ["authorization_code", "refresh_token"],
  "token_endpoint_auth_methods_supported": ["none"],
  "revocation_endpoint_auth_methods_supported": ["none"],
  "code_challenge_methods_supported": ["S256"],
  "scopes_supported": [
    "account:read",
    "usage:read",
    "settings:read",
    "settings:write",
    "team:read",
    "team:write",
    "projects:read",
    "projects:write",
    "projects:delete",
    "translations:write",
    "transcription:read",
    "transcription:write",
    "subtitles:read",
    "subtitles:write",
    "tts:read",
    "tts:write",
    "voices:read",
    "voices:write",
    "images:read",
    "images:write",
    "thumbnails:read",
    "thumbnails:write",
    "folders:read",
    "folders:write",
    "glossary:read",
    "glossary:write",
    "webhooks:read",
    "webhooks:write",
    "publishing:read",
    "publishing:write",
    "offline_access"
  ],
  "authorization_response_iss_parameter_supported": true,
  "client_id_metadata_document_supported": true
}
```

## 操作说明

* 仅声明支持 code 响应类型和 query 响应模式。
* 客户端可以使用动态注册或 Client ID Metadata Document（CIMD）。client\_id\_metadata\_document\_supported 为 true；CIMD 客户端使用文档的公开 HTTPS URL 作为 client\_id。
* CIMD JSON 文档必须包含完全匹配的 client\_id、非空且不超过 120 个字符的 client\_name，以及 1–10 个精确的 redirect\_uris。请使用公开客户端认证 none 和 S256 PKCE；authorization\_code 为必需，refresh\_token 为可选。
* 通过端口 443 的公开 HTTPS 提供未压缩的 CIMD JSON，并指定明确路径；不允许凭据、片段、点路径段或重定向。文档不得超过 64 KiB，且必须在 5 秒内响应。元数据缓存最多保留 5 分钟；令牌交换和刷新使用授权时绑定的元数据。
* OpenID Connect 可用时，授权服务器元数据还会公布 openid 和 email 权限范围、userinfo\_endpoint 及 jwks\_uri。否则，这些权限范围和端点不会出现在元数据中。
* 令牌端点和撤销端点的身份验证方法均为 none。公共客户端使用 client\_id 和 S256 PKCE，而非客户端密钥。
* offline\_access 是与续期相关的权限范围标记，不是产品权限。是否签发刷新令牌取决于注册的授权类型是否包含 refresh\_token。
* 在最终客户端回调中，将返回的 iss 值与 issuer 核对。授权成功和被拒绝的回调均包含 iss，且提供过 state 时会原样返回 state。

## 错误

| HTTP 状态 | 代码 | 含义或恢复方式 |
| - | - | - |
| 429 | `temporarily_unavailable` | 已达到公开 OAuth 请求速率上限。请等待当前时间窗口结束后重试。 |
| 500 | `server_error` | 授权暂时不可用。请稍后重试。 |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.