跳过内容

组织

Capgo 的顶级实体是组织。它们允许您将应用、团队成员和资源组在一个大篷帐下。每个组织可以有多个成员,具有不同的角色和权限。

  • 为您的公司创建新组织
  • 管理组织设置
  • 更新组织信息
  • 检索组织详细信息

https://api.capgo.app/organization/

获取组织信息。如果 orgId 在参数中提供,则返回单个组织;否则,返回所有可访问的组织。

  • orgId (可选): 要检索的特定组织的 ID
interface Organization {
id: string
created_by: string
created_at: string
updated_at: string
logo: string | null
name: string
management_email: string
customer_id: string | null
}

Example Request

示例请求
终端窗口
# Get all organizations
curl -H "x-api-key: YOUR_API_KEY" https://api.capgo.app/organization/
# Get specific organization
curl -H "x-api-key: YOUR_API_KEY" https://api.capgo.app/organization/?orgId=org_123

示例响应

复制到剪贴板
{
"data": {
"id": "org_123",
"name": "My Company",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"logo": "https://example.com/logo.png",
"management_email": "admin@example.com",
"customer_id": "cus_123"
}
}

https://api.capgo.app/organization/

或者

When using an API key, the key must have the global org.create 使用__CAPGO_KEEP_0__密钥时,密钥必须具有全局权限和当前组织范围的权限 org_adminorg_super_admin 绑定。由于目标组织尚未存在,因此无法使用正常的组织范围RBAC检查它。

当请求成功时,Capgo会自动为新组织分配相同的API密钥。 org_super_admin 在新组织上。

标题:请求体

复制到剪贴板
interface OrganizationCreate {
name: string
email?: string
estimatedMau?: number
website?: string
}
终端窗口
curl -X POST \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "New Organization",
"email": "admin@example.com",
"website": "https://example.com"
}' \
https://api.capgo.app/organization/
{
"id": "org_456"
}

如果API键不存在 org.create则API返回:

{
"error": "permission_denied"
}

PUT

PUT

https://api.capgo.app/organization/

更新现有组织。需要在目标组织上拥有管理员角色。

请求体

请求体
interface OrganizationUpdate {
orgId: string
logo?: string
name?: string
management_email?: string
}

终端窗口

复制到剪贴板
示例响应
curl -X PUT \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"orgId": "org_123",
"name": "New Company Name",
"management_email": "newemail@example.com"
}' \
https://api.capgo.app/organization/

Section titled “PUT”

Section titled “Request Body”
{
"status": "Organization updated",
"data": {
"id": "org_123",
"name": "New Company Name",
"management_email": "newemail@example.com"
}
}

https://api.capgo.app/organization/

删除一个现有的组织。需要在目标组织上删除权限,通常通过 org_super_admin 角色。这个动作是不可逆的,并且会移除所有相关的应用、版本和资源。

The org.create 全局权限不允许删除组织。

  • orgId: 要删除的组织 ID
终端窗口
curl -X DELETE \
-H "x-api-key: YOUR_API_KEY" \
https://api.capgo.app/organization/?orgId=org_123
{
"status": "ok"
}

常见错误场景及其响应:

// Invalid API key
{
"error": "Invalid API key",
"status": "KO"
}
// Missing required field
{
"error": "Name is required",
"status": "KO"
}
// Insufficient permissions
{
"error": "Admin role required",
"status": "KO"
}
  1. 命名: 使用清晰、描述性的组织名称
  2. 角色: 为团队成员分配适当的角色
  3. 电子邮件页面/区域: Capgo 营销网站。角色: UI 标签。见于: 页面 register.astro。消息关键字 `email_label` (电子邮件标签)。| 页面/区域: 实时更新产品页面。角色: UI 标签。消息关键字 `live_update_guidance_email_label` (实时更新指南电子邮件标签)。
  4. : 使用一个组电子邮件来管理 email 以避免因个人电子邮件更改而产生的问题Logo

: 在可靠的 CDN 上托管 logo 并使用 HTTPS URL

继续组织

继续组织 如果您正在使用 组织管理工具来规划仪表板和 API 运营,连接它与 API 介绍 用于 API 介绍 的实现细节 简介 用于简介的实现细节 API 密钥 用于 API 密钥 的实现细节 设备 用于设备的实现细节,以及 捆绑包 用于捆绑包的实现细节。