POST/api/v1/orgs创建组织

创建者自动成为所有者并持有所有者角色。

Request

Headers

NameData TypeRequiredDescription
AuthorizationstringYes会话令牌认证,格式 `Bearer <sessionToken>`
Content-TypestringYes请求体内容类型(默认值 "application/json")
type RequestHeaders = {
  /** 会话令牌认证,格式 `Bearer <sessionToken>` */
  Authorization: string
  /** 请求体内容类型,默认值 "application/json" */
  Content-Type: string
}
{
  "Authorization": "Bearer st_7c1f9e05b28d4a63",
  "Content-Type": "application/json"
}

Body

NameData TypeRequiredDescription
namestringYes组织名称
descriptionstringNo组织描述
type RequestBody = {
  /** 组织名称 */
  name: string
  /** 组织描述 */
  description?: string
}
{
  "name": "Xeegam 上海",
  "description": "Xeegam 上海研发团队"
}

Response

Body

NameData TypeRequiredDescription
orgIdstringYes组织 ID
namestringYes组织名称
descriptionstringNo组织描述
ownerIdstringYes所有者用户 ID
memberCountnumberYes成员数
createdAtstringYes创建时间(ISO 8601 UTC)
type OrgDTO = {
  /** 组织 ID */
  orgId: string
  /** 组织名称 */
  name: string
  /** 组织描述 */
  description?: string
  /** 所有者用户 ID */
  ownerId: string
  /** 成员数 */
  memberCount: number
  /** 创建时间(ISO 8601 UTC) */
  createdAt: string
}
{
  "orgId": "01JD8SRP1N4T8W6XQ5V9XDL2Y7K",
  "name": "Xeegam 上海",
  "description": "Xeegam 上海研发团队",
  "ownerId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
  "memberCount": 12,
  "createdAt": "2026-09-01T02:00:00Z"
}

HTTP Code

HTTP Status Meaning Notes
200 成功 返回新组织

Response Code

响应使用统一信封 {id, code, messages, result},其 code 字段:

code Meaning Notes
0 成功 返回新组织

Examples

POST /api/v1/orgs
Authorization: Bearer st_7c1f9e05b28d4a63
Content-Type: application/json

{
  "name": "Xeegam 上海",
  "description": "Xeegam 上海研发团队"
}
{
  "id": "01JD8SRVBO0Z4B2DW",
  "code": 0,
  "messages": [],
  "result": {
    "orgId": "01JD8SRP1N4T8W6XQ5V9XDL2Y7K",
    "name": "Xeegam 上海",
    "description": "Xeegam 上海研发团队",
    "ownerId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
    "memberCount": 1,
    "createdAt": "2026-09-01T02:00:00Z"
  }
}