QVeris
运行任务
文档目录

签发或交换 OAuth Token

POST /oauth/token

签发或交换 OAuth Token

REST API 概览 · OpenAPI JSON · OpenAPI YAML

接口契约

稳定性认证费用Operation ID
已发布Client ID;机密客户端使用 HTTP Basic免费token_api_v1_oauth_token_post

参数

此操作没有路径或查询参数。

请求体

Schema: inline

授权类型: authorization_code

名称必填类型说明
grant_typestring
codestring
redirect_uristring
code_verifierstring
client_idstring

授权类型: refresh_token

名称必填类型说明
grant_typestring
refresh_tokenstring
client_idstring

授权类型: urn:ietf:params:oauth:grant-type:device_code

名称必填类型说明
grant_typestring
device_codestring
client_idstring

授权类型: urn:ietf:params:oauth:grant-type:token-exchange

名称必填类型说明
grant_typestring
subject_tokenstring
subject_token_typestring
requested_token_typestring
resourcestring
scopestring
modelstring
run_idstring
max_creditsinteger
tool_idsstring[]
provider_idsstring[]

可运行示例

bash
curl --request POST \
  --url "https://qveris.ai/api/v1/oauth/token" \
  --data-urlencode 'grant_type=authorization_code' \
  --data-urlencode 'code=YOUR_AUTHORIZATION_CODE' \
  --data-urlencode 'redirect_uri=YOUR_REGISTERED_REDIRECT_URI' \
  --data-urlencode 'code_verifier=YOUR_PKCE_CODE_VERIFIER' \
  --data-urlencode 'client_id=YOUR_CLIENT_ID'
typescript
const response = await fetch("https://qveris.ai/api/v1/oauth/token", {
  method: "POST",
  body: new URLSearchParams(Object.entries({
  "grant_type": "authorization_code",
  "code": "YOUR_AUTHORIZATION_CODE",
  "redirect_uri": "YOUR_REGISTERED_REDIRECT_URI",
  "code_verifier": "YOUR_PKCE_CODE_VERIFIER",
  "client_id": "YOUR_CLIENT_ID"
}).map(([key, value]) => [key, String(value)])),
})

if (!response.ok) throw new Error(`QVeris request failed: ${response.status}`)
console.log(await response.json())
python
import json
import requests

response = requests.request(
    "POST",
    "https://qveris.ai/api/v1/oauth/token",
    data=json.loads(r'''{
  "grant_type": "authorization_code",
  "code": "YOUR_AUTHORIZATION_CODE",
  "redirect_uri": "YOUR_REGISTERED_REDIRECT_URI",
  "code_verifier": "YOUR_PKCE_CODE_VERIFIER",
  "client_id": "YOUR_CLIENT_ID"
}'''),
    timeout=30,
)
response.raise_for_status()
print(response.json())

响应

状态码含义Schema
200Successful ResponseOAuthAccessTokenResponse | OAuthTokenExchangeResponse
400OAuth request or grant errorOAuthErrorResponse
401Client authentication or bearer-token errorOAuthErrorResponse
403Subject token has insufficient scopeOAuthErrorResponse
422Validation ErrorHTTPValidationError

成功响应示例

json
{
  "access_token": "string",
  "token_type": "Bearer",
  "expires_in": 1,
  "scope": "string",
  "resource": "string"
}

精确契约

相关操作

POST 发现能力 · POST 检查能力 · POST 预检能力 · POST 调用能力

这个页面对你有帮助吗?