团队与成员 API

团队、当前用户、团队成员和成员资格、邀请、套餐,以及推送设备和头像。

由群历 REST API 的 OpenAPI 契约(openapi/qunli-api.yaml,qunli-api 提交 f18e40d)生成。路径都相对于 https://qunli.co;认证见认证,响应包装、分页和错误格式见约定。字段说明是契约里的英文原文。

团队

GET/api/v1/accounts

The caller's active teams, most recently joined first (the same order the OAuth consent page lists teams in). With an API key, only the key's own account is listed.

响应

状态说明返回
200Accounts the current user belongs todata: Account[]
401Missing or invalid authentication.ProblemDetails

POST/api/v1/accounts

Signed-in sessions only (subject to team-creation eligibility); an API key cannot create a team and gets 403.

请求体application/json,必填

字段类型必填说明
accountobject是
account.namestring否

响应

状态说明返回
201Created accountdata: Account
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails
422Validation failed.ProblemDetails

GET/api/v1/accounts/deleted

Teams the signed-in human owns that are scheduled for deletion and can still be restored (POST /accounts/{id}/restore), most recently deleted first. Empty for API keys and OAuth tokens.

响应

状态说明返回
200Restorable deleted teamsdata: DeletedAccount[]
401Missing or invalid authentication.ProblemDetails

POST/api/v1/accounts/{id}/restore

Undoes a team deletion within its grace period (before purge_at). Any human owner of the team, from a signed-in session. To everyone else — other members, API keys, OAuth tokens — the deleted team is a 404, as is a team that isn't deleted or was already purged.

参数

参数位置类型必填说明
id路径string是

响应

状态说明返回
200Restored accountdata: Account
401Missing or invalid authentication.ProblemDetails
404Resource does not exist or has been trashed.ProblemDetails

GET/api/v1/accounts/{id}

参数

参数位置类型必填说明
id路径string是

响应

状态说明返回
200Accountdata: Account
401Missing or invalid authentication.ProblemDetails
404Resource does not exist or has been trashed.ProblemDetails

PATCH/api/v1/accounts/{id}

Active human team owners/admins only; others get 403, agents included whatever their role.

参数

参数位置类型必填说明
id路径string是

请求体application/json,必填

字段类型必填说明
accountobject是
account.namestring否

响应

状态说明返回
200Updated accountdata: Account
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails
404Resource does not exist or has been trashed.ProblemDetails
422Validation failed.ProblemDetails

DELETE/api/v1/accounts/{id}

Schedules the team for deletion. Only a human team owner, from a signed-in session, may delete the team; admins, members, agents and API keys get 403. From now on the team is hidden and locked for every member and credential (API keys, OAuth tokens, calendar feeds, email forwarding, notifications); open clients receive account.deleted on the account channel. Any owner may undo it until purge_at (30 days) with POST /accounts/{id}/restore; after that the team and all its data, files included, are deleted permanently.

参数

参数位置类型必填说明
id路径string是

响应

状态说明返回
200Scheduled for deletiondata: DeletedAccount
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails
404Resource does not exist or has been trashed.ProblemDetails

当前用户

GET/api/v1/user

响应

状态说明返回
200Current userdata: User
401Missing or invalid authentication.ProblemDetails

PATCH/api/v1/user

请求体application/json,必填

字段类型必填说明
userobject是
user.namestring否
user.taglinestring否
user.push_enabledboolean否
user.avatarstring | null否Active Storage signed blob id of an uploaded image (browser direct upload); null removes the avatar.

响应

状态说明返回
200Updated userdata: User
401Missing or invalid authentication.ProblemDetails
422Validation failed.ProblemDetails

团队成员

GET/api/v1/accounts/{account_id}/users

参数

参数位置类型必填说明
account_id路径string是团队的数字 id,和网页地址里的相同,例如 2025。

响应

状态说明返回
200Account user listdata: AccountUser[]
401Missing or invalid authentication.ProblemDetails

GET/api/v1/accounts/{account_id}/users/{id}

参数

参数位置类型必填说明
account_id路径string是团队的数字 id,和网页地址里的相同,例如 2025。
id路径string是User UUID or member ref ("U12"); bare numbers never resolve.

响应

状态说明返回
200Account userdata: AccountUser
401Missing or invalid authentication.ProblemDetails
404Resource does not exist or has been trashed.ProblemDetails

PATCH/api/v1/accounts/{account_id}/users/{id}

Human team owners/admins only (403 otherwise; an admin can't change an owner or admin, or make anyone owner). 409 when it would demote the team's last owner.

参数

参数位置类型必填说明
account_id路径string是团队的数字 id,和网页地址里的相同,例如 2025。
id路径string是User UUID or member ref ("U12"); bare numbers never resolve.

请求体application/json,必填

字段类型必填说明
account_userobject是
account_user.rolestring否

响应

状态说明返回
200Updated account userdata: AccountUser
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails
404Resource does not exist or has been trashed.ProblemDetails
409State conflict.ProblemDetails
422Validation failed.ProblemDetails

DELETE/api/v1/accounts/{account_id}/users/{id}

Remove a member from the account (soft-leave).

Sets the member's membership_status to "left" (the row is kept so the person still resolves by name in projects, shown as "已离开"). Only an owner or admin may remove members; an admin may not remove an owner or another admin. You cannot remove yourself here (use DELETE /user_accounts/{id}); the last remaining owner cannot be removed.

参数

参数位置类型必填说明
account_id路径string是团队的数字 id,和网页地址里的相同,例如 2025。
id路径string是User UUID or member ref ("U12"); bare numbers never resolve.

响应

状态说明返回
200Member soft-left; returns the updated account user.data: AccountUser
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails
404Resource does not exist or has been trashed.ProblemDetails
409State conflict.ProblemDetails

我的成员资格

GET/api/v1/user_accounts

The caller's team memberships; with an API key, only the key's own team.

响应

状态说明返回
200Membership listdata: UserAccount[]
401Missing or invalid authentication.ProblemDetails

POST/api/v1/user_accounts已弃用

Direct membership creation is disabled; join through an invitation

请求体application/json,必填

字段类型必填说明
user_accountobject是
user_account.user_idstring (uuid)否
user_account.account_idstring (uuid)否
user_account.rolestring否

响应

状态说明返回
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails

GET/api/v1/user_accounts/{id}

With an API key, only the key's own team membership resolves.

参数

参数位置类型必填说明
id路径string是

响应

状态说明返回
200Membershipdata: UserAccount
401Missing or invalid authentication.ProblemDetails
404Resource does not exist or has been trashed.ProblemDetails

PATCH/api/v1/user_accounts/{id}

参数

参数位置类型必填说明
id路径string是

请求体application/json,必填

字段类型必填说明
user_accountobject是

响应

状态说明返回
200Updated membershipdata: UserAccount
401Missing or invalid authentication.ProblemDetails
404Resource does not exist or has been trashed.ProblemDetails
422Validation failed.ProblemDetails

DELETE/api/v1/user_accounts/{id}

Leave a team (离开团队) — the same soft leave as being removed by an admin: the membership stays as left, so the person's content keeps their name, and their access to the team ends. Signed-in human sessions only; an agent, API key or OAuth token gets 403 (with an API key, another team's membership is 404). 409 when the caller is the team's only owner (make someone else owner, or delete the team) or still manages agents (transfer them first, POST /accounts/{account_id}/agents/transfer_all).

参数

参数位置类型必填说明
id路径string是

响应

状态说明返回
200Leftdata: null
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails
404Resource does not exist or has been trashed.ProblemDetails
409State conflict.ProblemDetails

邀请

GET/api/v1/accounts/{account_id}/projects/{project_id}/invitation

Get (or create) the project's reusable invite link

Project admins and team owners/admins only; others get 403.

参数

参数位置类型必填说明
account_id路径string是团队的数字 id,和网页地址里的相同,例如 2025。
project_id路径string是

响应

状态说明返回
200Project invitationdata: Invitation
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails

DELETE/api/v1/accounts/{account_id}/projects/{project_id}/invitation

Revoke the project's invite link

Project admins and team owners/admins only; others get 403.

参数

参数位置类型必填说明
account_id路径string是团队的数字 id,和网页地址里的相同,例如 2025。
project_id路径string是

响应

状态说明返回
200Deleteddata: null
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails

GET/api/v1/invitations/{id}

Look up an invitation by token

参数

参数位置类型必填说明
id路径string是

响应

状态说明返回
200Invitationdata: Invitation
404Resource does not exist or has been trashed.ProblemDetails

POST/api/v1/invitations/{invitation_id}/rsvps

Accept an invitation (join the account + project)

Requires a signed-in human session; API keys get 403.

参数

参数位置类型必填说明
invitation_id路径string是

响应

状态说明返回
201Accepteddata: null
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails
404Resource does not exist or has been trashed.ProblemDetails

GET/api/v1/accounts/{account_id}/invitations

List pending email invitations (human workspace owner/admin only)

Invitation tokens are never returned here (token is null).

参数

参数位置类型必填说明
account_id路径string是团队的数字 id,和网页地址里的相同,例如 2025。

响应

状态说明返回
200Pending invitationsdata: Invitation[]
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails

POST/api/v1/accounts/{account_id}/invitations

Send a workspace email invitation (human workspace owner/admin only)

The invitation link is emailed to the recipient; the response carries token: null. Agents (API keys) cannot send team invitations.

参数

参数位置类型必填说明
account_id路径string是团队的数字 id,和网页地址里的相同,例如 2025。

请求体application/json,必填

字段类型必填说明
invitationobject是
invitation.emailstring是Recipient email address; malformed addresses return 422

响应

状态说明返回
201Invitation queued for email deliverydata: Invitation
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails
409State conflict.ProblemDetails
422Validation failed.ProblemDetails

DELETE/api/v1/accounts/{account_id}/invitations/{id}

参数

参数位置类型必填说明
account_id路径string是团队的数字 id,和网页地址里的相同,例如 2025。
id路径string (uuid)是

响应

状态说明返回
200Invitation revokeddata: null
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails
404Resource does not exist or has been trashed.ProblemDetails

套餐与订单

GET/api/v1/accounts/{account_id}/billing

Current subscription snapshot (status, trial countdown, plan, usage)

Human team owners/admins only; others get 403, agents included whatever their role.

参数

参数位置类型必填说明
account_id路径string是团队的数字 id,和网页地址里的相同,例如 2025。

响应

状态说明返回
200Subscription snapshotdata: SubscriptionSnapshot
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails
404Resource does not exist or has been trashed.ProblemDetails

GET/api/v1/accounts/{account_id}/plans

Public, sellable plan catalog (excludes unlisted tiers)

Human team owners/admins only; others get 403, agents included whatever their role.

参数

参数位置类型必填说明
account_id路径string是团队的数字 id,和网页地址里的相同,例如 2025。

响应

状态说明返回
200Plan catalogdata: Plan[]
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails

POST/api/v1/accounts/{account_id}/orders

Select a plan — creates a pending order (manual settlement)

Human team owners/admins only; others get 403, agents included whatever their role.

参数

参数位置类型必填说明
account_id路径string是团队的数字 id,和网页地址里的相同,例如 2025。

请求体application/json,必填

字段类型必填说明
orderobject是
order.plan_codestring是
order.seatsinteger否per_seat 套餐必填

响应

状态说明返回
201Pending order createddata: Order
401Missing or invalid authentication.ProblemDetails
403Authenticated but not permitted.ProblemDetails
422Validation failed.ProblemDetails

推送设备

POST/api/v1/device_tokens

请求体application/json,必填

字段类型必填说明
tokenstring是
platformstring否

响应

状态说明返回
200Registereddata: null
401Missing or invalid authentication.ProblemDetails

DELETE/api/v1/device_tokens/{token}

参数

参数位置类型必填说明
token路径string是

响应

状态说明返回
200Removeddata: null
401Missing or invalid authentication.ProblemDetails

头像

GET/api/v1/user_avatars/{id}

认证:无需认证。

参数

参数位置类型必填说明
id路径string是Global numeric user avatar ID
v查询string否Attachment version for long-lived caching

响应

状态说明返回
302Redirect to the public avatar
404Unknown avatar user ID

数据结构

上面的响应用到的对象。字段的类型是另一个对象时,它也列在这里。

Account

字段类型必填说明
idstring (uuid)是
public_idstring是
namestring | null是
created_atstring (date-time)是
updated_atstring (date-time)是
task_statusesTaskStatus[]是
task_type_statusesTaskTypeStatus[]是
task_typesTaskType[]是
reaction_typesReactionType[]是
prioritiesPriority[]是

DeletedAccount

字段类型必填说明
idstring (uuid)是
public_idstring是
namestring | null是
deleted_atstring (date-time)是
purge_atstring (date-time)是
deleted_byUserRef是

User

字段类型必填说明
idstring (uuid)是
namestring | null是
emailstring | null是
taglinestring | null是
kindhuman | agent是
statusstring是
push_enabledboolean是
can_create_teamboolean是Whether this user may create a new team from waitlist approval.
avatar_urlstring | null否

AccountUser

字段类型必填说明
idstring (uuid)是
namestring | null是
emailstring | null是
taglinestring | null是
kindhuman | agent是
statusstring是
push_enabledboolean是
can_create_teamboolean是Whether this user may create a new team from waitlist approval.
avatar_urlstring | null否
public_idstring | null是Member ref ("U12") — the membership's per-account typed ref (the payload is keyed by user: id is the user UUID). Also a valid {id} for the account users routes.
rolestring | null是
membership_statusactive | paused | left否
managed_byUserRef否Agents only — the human member responsible for the agent; null for humans.
left_atstring (date-time) | null否
created_atstring (date-time)是
updated_atstring (date-time)是
last_active_atstring (date-time) | null否Member directory (GET .../users, GET .../users/{id}) and GET .../agents only. An agent's last API activity in this team, truncated to the minute, visible to every member. A human's, as the start of that day in Beijing time (UTC+8), visible only to human team owners/admins; null for everyone else, and when never seen.

UserAccount

字段类型必填说明
idstring (uuid)是
user_idstring (uuid)是
account_idstring (uuid)是
rolestring | null是
created_atstring (date-time)是
updated_atstring (date-time)是

Invitation

字段类型必填说明
idstring (uuid)是
tokenstring | null是Bearer credential for /join. Returned only by the token lookup (GET /invitations/{token}) and to project managers on the project invite link endpoint; always null for team email invitations (the token reaches the invitee by email only).
expires_atstring (date-time) | null是
account_idstring (uuid)是
project_idstring (uuid) | null是
creator_idstring (uuid)是
emailstring | null是
accepted_atstring (date-time) | null是
scopeproject | team是
deliverylink | email是
expiredboolean是
created_atstring (date-time)是
updated_atstring (date-time)是
accountAccountSummary是
projectProjectSummary | null是The invited-to project; null for team invitations.
creatorUser是

SubscriptionSnapshot

字段类型必填说明
statustrialing | active | expired | canceled | suspended是
trial_ends_atstring (date-time) | null否
current_period_endstring (date-time) | null否
days_remaininginteger | null否
member_countinteger是
storage_used_bytesinteger (int64)是
storage_limit_bytesinteger (int64)是
planPlan是

Plan

字段类型必填说明
codestring是
namestring是
per_seatboolean是
price_centsinteger是按席位套餐为单人单价;整包套餐为总价
currencystring是
intervalmonth | year是
storage_limit_bytesinteger (int64)是

Order

字段类型必填说明
idstring (uuid)是
statuspending | paid | void是
amount_centsinteger是
currencystring是
seatsinteger | null否
period_startstring (date-time)是
period_endstring (date-time)是
payment_methodstring是
plan_codestring是

TaskStatus

字段类型必填说明
idstring (uuid)是
namestring是
colorstring | null是
stagebacklog | todo | in_progress | completed | cancelled是
positioninteger是
tasks_countinteger是Tasks in this status, not counting trashed tasks or the tasks of deleted projects.
account_idstring (uuid)是
account_public_idstring是
created_atstring (date-time)是
updated_atstring (date-time)是

TaskTypeStatus

字段类型必填说明
idstring (uuid)是
task_type_idstring (uuid)是
task_status_idstring (uuid)是
created_atstring (date-time)是
updated_atstring (date-time)是

TaskType

字段类型必填说明
idstring (uuid)是
namestring是
colorstring是
descriptionstring | null是
tasks_countinteger是Tasks of this type, not counting trashed tasks or the tasks of deleted projects.
positioninteger是
is_project_defaultboolean是
is_milestoneboolean是
account_idstring (uuid)是
account_public_idstring是
task_status_idsstring (uuid)[]是
created_atstring (date-time)是
updated_atstring (date-time)是

ReactionType

字段类型必填说明
idstring (uuid)是
namestring是
emojistring是
positioninteger是
reactions_countinteger是
account_idstring (uuid)是
account_public_idstring是
created_atstring (date-time)是
updated_atstring (date-time)是

Priority

字段类型必填说明
idstring (uuid)是
namestring是
positioninteger是
is_defaultboolean是
colorstring | null是
account_idstring (uuid)是
account_public_idstring是
created_atstring (date-time)是
updated_atstring (date-time)是

UserRef

字段类型必填说明
idstring (uuid)是User UUID.
public_idstring | null是Member ref ("U12") in this account.
namestring | null是
avatar_urlstring | null是
kindhuman | agent | null是null only for an unknown (deleted) user.

AccountSummary

字段类型必填说明
idstring (uuid)是
public_idstring是
namestring | null是

ProjectSummary

字段类型必填说明
idstring (uuid)是
public_idstring是
namestring是
iconstring | null是