---
title: "发起平台授权"
method: GET
path: "/api/v2/channels/accounts/auth/{platform}"
tags: ["渠道管理/授权"]
---

# 发起平台授权

`GET /api/v2/channels/accounts/auth/{platform}`

## Request

- Base URL: `https://aitoearn.cn`
- URL: `https://aitoearn.cn/api/v2/channels/accounts/auth/{platform}`
- Auth: API key in header `X-Api-Key`
- TypeScript: <https://skmtc.dev/aitoearn/apis/aitoearn-api/docs/api/v2/channels/accounts/auth/:platform/get.ts> (a function with typed inputs; its response is checked against the schema)

接口说明：生成平台授权二维码、会话 ID 和过期时间。

调用成功后，请从响应的 `data.sessionId` 获取本次授权会话 ID，并将它与相同的 `platform` 一起传入[获取授权状态](/api-reference/get-api-v2-channels-accounts-auth-platform-status-session-id)接口进行轮询。`platform` 可选值：`douyin`、`xhs`、`wxSph`、`KWAI`、`wxGzh`、`bilibili`。具体平台是否可用，请以[平台列表](/api-reference/get-api-v2-channels-platforms)返回的 `capabilities.auth.supported` 为准。

## Path parameters

- `platform` 'douyin' | 'xhs' | 'wxSph' | 'KWAI' | 'wxGzh' | 'bilibili', required

## Query parameters

- `callbackUrl` string, uri: 授权完成后浏览器 POST relay 的回调地址
- `redirectUri` string, uri: 授权完成后浏览器跳转地址
- `groupId` string: 账号组 ID，不传则使用默认组

## Response `200`

请求已被服务处理。业务是否成功以响应体 code === 0 为准。

- object
  - `data` object
    - `url` string
    - `sessionId` string
    - `expiresAt` string
    - `authInstructions` object
      - `en-US` string
      - `zh-CN` string
  - `code` integer, required: 业务状态码。0 表示成功，非 0 表示业务错误。
  - `message` string, required: 响应消息。
  - `requestId` string: 请求 ID。
  - `timestamp` integer: 错误响应时间戳，Unix 毫秒。

## Changes

- **2026-11-03** `7cc8f21c4c96`: 7 breaking, 6 info
  - the `path` request parameter `platform` was restricted to a list of enum values
  - the response property `data/authInstructions/en-US` became optional for the status `200`
  - the response property `data/authInstructions/zh-CN` became optional for the status `200`
  - the response property `data/expiresAt` became optional for the status `200`
  - …9 more

[Operation history](https://skmtc.dev/aitoearn/apis/aitoearn-api/changes/api/v2/channels/accounts/auth/:platform/get.md)

---

[API](https://skmtc.dev/aitoearn/apis/aitoearn-api.md) - [All operations](https://skmtc.dev/aitoearn/apis/aitoearn-api/llms.txt) - [OpenAPI document](https://skmtc.dev/aitoearn/apis/aitoearn-api/revisions/7cc8f21c4c96?raw)
