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

# 查询授权状态

> 接口说明：轮询平台授权 Session 状态



## OpenAPI

````yaml /openapi/zh/aitoearn.openapi.json get /api/v2/channels/accounts/auth/{platform}/status/{sessionId}
openapi: 3.0.1
info:
  title: AiToEarn 开放平台 API
  description: AiToEarn 开放平台 API，支持在中国站与国际站之间切换调试。业务是否成功以响应体 code === 0 为准。
  version: 1.0.0
  contact: {}
servers:
  - url: https://aitoearn.cn
    description: 中国站
  - url: https://aitoearn.ai
    description: 国际站
security: []
tags:
  - name: AI 服务
  - name: AI 服务/视频生成
  - name: AI 服务/图像生成
  - name: AI 服务/模型中转
  - name: 渠道管理
  - name: 渠道管理/账号
  - name: 渠道管理/内容发布
  - name: 渠道管理/平台
  - name: 渠道管理/互动
  - name: 渠道管理/作品
  - name: 渠道管理/账号分组
  - name: 渠道管理/授权
  - name: 资源管理
paths:
  /api/v2/channels/accounts/auth/{platform}/status/{sessionId}:
    get:
      tags:
        - 渠道管理/授权
      summary: 查询授权状态
      description: 接口说明：轮询平台授权 Session 状态
      operationId: AuthController_getAuthStatus_v2
      parameters:
        - name: platform
          in: path
          description: 平台标识
          required: true
          example: ''
          schema:
            type: string
        - name: sessionId
          in: path
          description: 会话 ID
          required: true
          example: ''
          schema:
            type: string
      responses:
        '200':
          description: 请求已被服务处理。业务是否成功以响应体 code === 0 为准。
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/AuthSessionStatusVo'
                  code:
                    type: integer
                    description: 业务状态码。0 表示成功，非 0 表示业务错误。
                  message:
                    type: string
                    description: 响应消息。
                  requestId:
                    type: string
                    description: 请求 ID。
                  timestamp:
                    type: integer
                    description: 错误响应时间戳，Unix 毫秒。
                required:
                  - code
                  - message
              examples:
                success:
                  summary: 成功
                  value:
                    code: 0
                    message: 请求成功
                    data:
                      sessionId: string
                      status: pending
                      requiresSelection: true
                      errorCode: 1
                      expiresAt: '2026-07-02T12:00:00.000Z'
                      accountId: string
                      accountIds:
                        - string
                      accounts:
                        - accountId: string
                          platform: douyin
                          platformUid: string
                          displayName: string
                          account: string
                          avatarUrl: string
                      selectableAccounts:
                        - platform: douyin
                          platformUid: string
                          displayName: string
                          account: string
                          avatarUrl: string
                          parentPlatformUid: string
                validationFailed10002:
                  summary: ValidationFailed (10002)
                  value:
                    code: 10002
                    message: 参数验证失败
                    data: {}
                    timestamp: 1772099056662
                unauthorized401:
                  summary: 未认证或 API Key 无效
                  value:
                    code: 401
                    message: Unauthorized
                    data: {}
                    timestamp: 1772099056662
                channelAuthPlatformMismatch15040:
                  summary: ChannelAuthPlatformMismatch (15040)
                  value:
                    code: 15040
                    message: 授权平台不匹配
                    data: {}
                    timestamp: 1772099056662
                channelAuthSessionInvalid15039:
                  summary: ChannelAuthSessionInvalid (15039)
                  value:
                    code: 15039
                    message: 授权会话无效或已过期
                    data: {}
                    timestamp: 1772099056662
      deprecated: false
      security:
        - apikey-header-X-Api-Key: []
components:
  schemas:
    AuthSessionStatusVo:
      type: object
      properties:
        sessionId:
          type: string
          description: 授权 Session ID
        status:
          type: string
          enum:
            - pending
            - completed
            - failed
          description: 授权 Session 状态
        requiresSelection:
          type: boolean
          description: 是否需要选择二级账号
        errorCode:
          description: 授权失败错误码
          type: number
        expiresAt:
          description: 授权 Session 过期时间
          type: string
          format: date-time
        accountId:
          description: 首个本地账号 ID
          type: string
        accountIds:
          description: 本地账号 ID 列表
          type: array
          items:
            type: string
        accounts:
          description: 已连接账号列表
          type: array
          items:
            type: object
            properties:
              accountId:
                type: string
                description: 本地账号 ID
              platform:
                type: string
                enum:
                  - douyin
                  - xhs
                  - wxSph
                  - KWAI
                  - youtube
                  - wxGzh
                  - bilibili
                  - twitter
                  - tiktok
                  - facebook
                  - instagram
                  - threads
                  - pinterest
                  - linkedin
                  - google_business
                description: 平台类型
              platformUid:
                type: string
                description: 平台账号 UID
              account:
                description: 平台账号补充唯一标识
                type: string
              displayName:
                type: string
                description: 平台账号展示名
              avatarUrl:
                description: 平台账号头像 URL
                type: string
            required:
              - accountId
              - platform
              - platformUid
              - displayName
        selectableAccounts:
          description: 可选择的平台账号列表
          type: array
          items:
            type: object
            properties:
              platform:
                type: string
                enum:
                  - douyin
                  - xhs
                  - wxSph
                  - KWAI
                  - youtube
                  - wxGzh
                  - bilibili
                  - twitter
                  - tiktok
                  - facebook
                  - instagram
                  - threads
                  - pinterest
                  - linkedin
                  - google_business
                description: 平台类型
              platformUid:
                type: string
                description: 平台账号 UID
              account:
                description: 平台账号补充唯一标识
                type: string
              displayName:
                type: string
                description: 平台账号展示名
              avatarUrl:
                description: 平台账号头像 URL
                type: string
              parentPlatformUid:
                description: 父级平台账号 UID
                type: string
            required:
              - platform
              - platformUid
              - displayName
      required:
        - sessionId
        - status
        - requiresSelection
  securitySchemes:
    apikey-header-X-Api-Key:
      type: apiKey
      in: header
      name: X-Api-Key
      description: AiToEarn Open Platform API Key。

````