組織與成員

帳號註冊

POST /api/auth/registration/

請求內容

請求參數

欄位
類型
必填
說明

email

string (email)

password1

string

password2

string

name

string

company

string

referralCode

string

authSource

object

請求結構範例

{
  "email": string (email)
  "password1": string
  "password2": string
  "name": string
  "company": string
  "referralCode": string
  "authSource"?: object // 非必填
}

請求範例值

{
  "email": "[email protected]",
  "password1": "request_string",
  "password2": "request_string",
  "name": "request_string",
  "company": "request_string",
  "referralCode": "request_string",
  "authSource": null
}

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/auth/registration/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password1": "request_string",
    "password2": "request_string",
    "name": "request_string",
    "company": "request_string",
    "referralCode": "request_string",
    "authSource": null
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。

回應內容

狀態碼: 201

回應結構範例

{
  "detail": string
}

回應範例值

{
  "detail": "response_string"
}

更換密碼

POST /api/auth/password/change/

請求內容

請求參數

欄位
類型
必填
說明

oldPassword

string

newPassword1

string

newPassword2

string

請求結構範例

{
  "oldPassword": string
  "newPassword1": string
  "newPassword2": string
}

請求範例值

{
  "oldPassword": "request_string",
  "newPassword1": "request_string",
  "newPassword2": "request_string"
}

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/auth/password/change/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "oldPassword": "request_string",
    "newPassword1": "request_string",
    "newPassword2": "request_string"
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。

回應內容

狀態碼: 200

回應結構範例

{
  "detail": string
}

回應範例值

{
  "detail": "response_string"
}

建立新組織

POST /api/organizations/

請求內容

請求參數

欄位
類型
必填
說明

name

string

compactLogo

string (uri)

fullLogo

string (uri)

請求結構範例

{
  "name": string
  "compactLogo"?: string (uri) // 非必填
  "fullLogo"?: string (uri) // 非必填
}

請求範例值

{
  "name": "request_string",
  "compactLogo": "request_string",
  "fullLogo": "request_string"
}

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/organizations/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "request_string",
    "compactLogo": "request_string",
    "fullLogo": "request_string"
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。

回應內容

狀態碼: 201

回應結構範例

{
  "id": string (uuid)
  "name": string
  "owner": object
  "createdAt": string (timestamp)
  "compactLogo"?: string (uri) // 非必填
  "fullLogo"?: string (uri) // 非必填
  "usageStatistics": object
  "organizationPlan": object
}

回應範例值

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "response_string",
  "owner": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "response_string"
  },
  "createdAt": "response_string",
  "compactLogo": "response_string",
  "fullLogo": "response_string",
  "usageStatistics": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應範例名稱",
    "description": "回應範例描述"
  },
  "organizationPlan": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應範例名稱",
    "description": "回應範例描述"
  }
}

新增成員至指定組織

POST /api/organizations/{organizationPk}/members/

參數

參數名稱
必填
類型
說明

organizationPk

string

A UUID string identifying this 組織 ID

請求內容

請求參數

欄位
類型
必填
說明

email

string (email)

organization

string (uuid)

請求結構範例

{
  "email": string (email)
  "organization"?: string (uuid) // 非必填
}

請求範例值

{
  "organization": "613c86f7-a45f-4e29-b255-29caff89de32",
  "is_owner": false
}

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "organization": "613c86f7-a45f-4e29-b255-29caff89de32",
    "is_owner": false
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。

回應內容

狀態碼: 201

回應結構範例

{
  "organization": string (uuid) // 組織 ID
  "is_owner": boolean // 是否為組織擁有者
}

回應範例值

{
  "organization": "613c86f7-a45f-4e29-b255-29caff89de32",
  "is_owner": false
}

取得組織列表

GET /api/organizations/

參數

參數名稱
必填
類型
說明

page

integer

A page number within the paginated result set.

pageSize

integer

Number of results to return per page.

pagination

string

是否分頁 (true/false)

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/organizations/?page=1&pageSize=1&pagination=example" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。

回應內容

狀態碼: 200

回應結構範例

{
  "count": integer
  "next"?: string (uri) // 非必填
  "previous"?: string (uri) // 非必填
  "results": [
    {
      "id": string (uuid)
      "name": string
      "owner": object
      "createdAt": string (timestamp)
    }
  ]
}

回應範例值

{
  "count": 123,
  "next": "http://api.example.org/accounts/?page=4",
  "previous": "http://api.example.org/accounts/?page=2",
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "response_string",
      "owner": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "response_string"
      },
      "createdAt": "response_string"
    }
  ]
}

取得特定組織資訊

GET /api/organizations/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this 組織.

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。

回應內容

狀態碼: 200

回應結構範例

{
  "id": string (uuid)
  "name": string
  "owner": object
  "createdAt": string (timestamp)
  "compactLogo"?: string (uri) // 非必填
  "fullLogo"?: string (uri) // 非必填
  "usageStatistics": object
  "organizationPlan": object
}

回應範例值

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "response_string",
  "owner": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "response_string"
  },
  "createdAt": "response_string",
  "compactLogo": "response_string",
  "fullLogo": "response_string",
  "usageStatistics": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應範例名稱",
    "description": "回應範例描述"
  },
  "organizationPlan": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應範例名稱",
    "description": "回應範例描述"
  }
}

取得當前用戶詳細資訊

GET /api/users/current/

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/users/current/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。

回應內容

狀態碼: 200

回應結構範例

{
  "id": string (uuid)
  "avatar"?: string (uri) // 非必填
  "name": string
  "email": string (email)
  "authSource": object
  "company"?: string // 非必填
  "invitationCode": string
  "apiKeys": [
    object
  ]
  "permissions": [
    string
  ]
}

回應範例值

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "avatar": "response_string",
  "name": "response_string",
  "email": "[email protected]",
  "authSource": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "response_string"
  },
  "company": "response_string",
  "invitationCode": "response_string",
  "apiKeys": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "回應範例名稱",
      "description": "回應範例描述"
    }
  ],
  "permissions": [
    "response_string"
  ]
}

取得當前用戶權限

GET /api/permissions/

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/permissions/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。

回應內容

狀態碼: 200

回應結構範例

[
  {
    "id": string (uuid)
    "name": string
    "description"?: string // 非必填
  }
]

回應範例值

[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "response_string",
    "description": "response_string"
  }
]

取得指定組織的成員列表

GET /api/organizations/{organizationPk}/members/

參數

參數名稱
必填
類型
說明

organizationPk

string

A UUID string identifying this 組織 ID

page

integer

A page number within the paginated result set.

pageSize

integer

Number of results to return per page.

pagination

string

是否分頁 (true/false)

query

string

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/?page=1&pageSize=1&pagination=example&query=example" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。

回應內容

狀態碼: 200

回應結構範例

{
  "count": integer
  "next"?: string (uri) // 非必填
  "previous"?: string (uri) // 非必填
  "results": [
    {
      "id": string (uuid)
      "name": string
      "email": string
      "isOwner": boolean
      "permissions": object
      "createdAt": string (timestamp)
    }
  ]
}

回應範例值

{
  "count": 123,
  "next": "http://api.example.org/accounts/?page=4",
  "previous": "http://api.example.org/accounts/?page=2",
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "response_string",
      "email": "response_string",
      "isOwner": false,
      "permissions": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "回應範例名稱",
        "description": "回應範例描述"
      },
      "createdAt": "response_string"
    }
  ]
}

取得特定成員詳細資訊

GET /api/organizations/{organizationPk}/members/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this 成員.

organizationPk

string

A UUID string identifying this 組織 ID

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。

回應內容

狀態碼: 200

回應結構範例

{
  "id": string (uuid)
  "name": string
  "email": string
  "isOwner": boolean
  "permissions": object
  "createdAt": string (timestamp)
}

回應範例值

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "response_string",
  "email": "response_string",
  "isOwner": false,
  "permissions": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應範例名稱",
    "description": "回應範例描述"
  },
  "createdAt": "response_string"
}

更新組織資訊

PUT /api/organizations/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this 組織.

請求內容

請求參數

欄位
類型
必填
說明

name

string

compactLogo

string (uri)

fullLogo

string (uri)

請求結構範例

{
  "name": string
  "compactLogo"?: string (uri) // 非必填
  "fullLogo"?: string (uri) // 非必填
}

請求範例值

{
  "id": "5b01e0b9-0b0e-4079-8150-d12015576d2c",
  "name": "Updated Org Name",
  "owner": {
    "id": "7236f450-deb1-4598-be06-5816efd45481",
    "name": "Test User 594b9561"
  },
  "created_at": "1748336288000",
  "usage_statistics": {
    "chatbots_count": 0,
    "can_create_chatbot": true,
    "has_create_chatbot_limit": true,
    "current_month_words_count_total": 1000000,
    "current_month_used_words_count_total": 0,
    "current_month_used_conversations_count_total": 0,
    "available_upload_files_size_total": 104857600,
    "used_upload_file_size_total": 0
  },
  "organization_plan": {
    "id": "cac825e8-cb9b-4a16-b440-4ff6b2e73911",
    "plan_name": "免費方案",
    "expired_at": null
  }
}

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X PUT "https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "5b01e0b9-0b0e-4079-8150-d12015576d2c",
    "name": "Updated Org Name",
    "owner": {
      "id": "7236f450-deb1-4598-be06-5816efd45481",
      "name": "Test User 594b9561"
    },
    "created_at": "1748336288000",
    "usage_statistics": {
      "chatbots_count": 0,
      "can_create_chatbot": true,
      "has_create_chatbot_limit": true,
      "current_month_words_count_total": 1000000,
      "current_month_used_words_count_total": 0,
      "current_month_used_conversations_count_total": 0,
      "available_upload_files_size_total": 104857600,
      "used_upload_file_size_total": 0
    },
    "organization_plan": {
      "id": "cac825e8-cb9b-4a16-b440-4ff6b2e73911",
      "plan_name": "免費方案",
      "expired_at": null
    }
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。

回應內容

狀態碼: 200

回應結構範例

{
  "id": string (uuid) // 組織 ID
  "name": string // 組織名稱
  "owner":  // 組織擁有者資訊
  {
    "id"?: string (uuid) // 擁有者 ID (非必填)
    "name"?: string // 擁有者姓名 (非必填)
  }
  "created_at": string (timestamp) // 建立時間戳記
  "usage_statistics":  // 使用統計資訊
  {
    "chatbots_count"?: integer // 聊天機器人數量 (非必填)
    "can_create_chatbot"?: boolean // 是否可以建立聊天機器人 (非必填)
    "has_create_chatbot_limit"?: boolean // 是否有建立聊天機器人的限制 (非必填)
    "current_month_words_count_total"?: integer // 本月總字數限制 (非必填)
    "current_month_used_words_count_total"?: integer // 本月已使用字數 (非必填)
    "current_month_used_conversations_count_total"?: integer // 本月已使用對話數 (非必填)
    "available_upload_files_size_total"?: integer // 可上傳檔案總大小(位元組) (非必填)
    "used_upload_file_size_total"?: integer // 已使用上傳檔案大小(位元組) (非必填)
  }
  "organization_plan":  // 組織方案資訊
  {
    "id"?: string (uuid) // 方案 ID (非必填)
    "plan_name"?: string // 方案名稱 (非必填)
    "expired_at"?: string (date-time) // 到期時間 (非必填)
  }
}

回應範例值

{
  "id": "5b01e0b9-0b0e-4079-8150-d12015576d2c",
  "name": "Updated Org Name",
  "owner": {
    "id": "7236f450-deb1-4598-be06-5816efd45481",
    "name": "Test User 594b9561"
  },
  "created_at": "1748336288000",
  "usage_statistics": {
    "chatbots_count": 0,
    "can_create_chatbot": true,
    "has_create_chatbot_limit": true,
    "current_month_words_count_total": 1000000,
    "current_month_used_words_count_total": 0,
    "current_month_used_conversations_count_total": 0,
    "available_upload_files_size_total": 104857600,
    "used_upload_file_size_total": 0
  },
  "organization_plan": {
    "id": "cac825e8-cb9b-4a16-b440-4ff6b2e73911",
    "plan_name": "免費方案",
    "expired_at": null
  }
}

更新當前用戶詳細資訊

PUT /api/users/current/

請求內容

請求參數

欄位
類型
必填
說明

avatar

string (uri)

name

string

email

string (email)

company

string

invitationCode

string

請求結構範例

{
  "avatar"?: string (uri) // 非必填
  "name": string
  "email": string (email)
  "company"?: string // 非必填
  "invitationCode": string
}

請求範例值

{
  "avatar": "request_string",
  "name": "request_string",
  "email": "[email protected]",
  "company": "request_string",
  "invitationCode": "request_string"
}

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X PUT "https://api.maiagent.ai/api/users/current/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "avatar": "request_string",
    "name": "request_string",
    "email": "[email protected]",
    "company": "request_string",
    "invitationCode": "request_string"
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。

回應內容

狀態碼: 200

回應結構範例

{
  "id": string (uuid)
  "avatar"?: string (uri) // 非必填
  "name": string
  "email": string (email)
  "authSource": object
  "company"?: string // 非必填
  "invitationCode": string
  "apiKeys": [
    object
  ]
  "permissions": [
    string
  ]
}

回應範例值

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "avatar": "response_string",
  "name": "response_string",
  "email": "[email protected]",
  "authSource": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "response_string"
  },
  "company": "response_string",
  "invitationCode": "response_string",
  "apiKeys": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "回應範例名稱",
      "description": "回應範例描述"
    }
  ],
  "permissions": [
    "response_string"
  ]
}

刪除指定成員

DELETE /api/organizations/{organizationPk}/members/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this 成員.

organizationPk

string

A UUID string identifying this 組織 ID

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。

回應內容

狀態碼
說明

204

No response body


Last updated

Was this helpful?