コンテンツへスキップ

Organizations

組織は、Capgo の最上位のエンティティです。これにより、アプリ、チームメンバー、リソースを 1 つの傘の下にグループ化できます。各組織には、異なる役割と権限を持つ複数のメンバーが存在できます。

  • 会社の新しい組織を作成する
  • 組織設定の管理
  • 組織情報の更新
  • 組織の詳細の取得

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
}
Terminal window
# Get all organizations
curl -H "authorization: your-api-key" https://api.capgo.app/organization/
# Get specific organization
curl -H "authorization: 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/

新しい組織を作成します。

interface OrganizationCreate {
name: string
}
Terminal window
curl -X POST \
-H "authorization: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"name": "New Organization"
}' \
https://api.capgo.app/organization/
{
"status": "Organization created",
"id": "org_456"
}

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

既存の組織を更新します。管理者の役割が必要です。

interface OrganizationUpdate {
orgId: string
logo?: string
name?: string
management_email?: string
}
Terminal window
curl -X PUT \
-H "authorization: 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/
{
"status": "Organization updated",
"data": {
"id": "org_123",
"name": "New Company Name",
"management_email": "newemail@example.com"
}
}

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

既存の組織を削除します。管理者の役割が必要です。この操作は元に戻すことができず、関連するすべてのアプリ、バンドル (バージョン)、およびリソースが削除されます。

  • orgId: 削除する組織のID
Terminal window
curl -X DELETE \
-H "authorization: your-api-key" \
https://api.capgo.app/organization/?orgId=org_123
{
"status": "Organization deleted",
"id": "org_123"
}

一般的なエラーのシナリオとその対応:

// 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. 電子メール: 個人の電子メール変更による問題を避けるために、management_email にはグループ電子メールを使用します。
  4. ロゴ: 信頼できる CDN でロゴをホストし、HTTPS URL を使用します。