組織與成員

帳號註冊

POST /api/auth/registration/

請求內容

請求參數

欄位
類型
必填
說明

email

string (email)

電子信箱

password1

string

密碼

password2

string

確認密碼

name

string

帳號名稱

company

string

公司名稱

referralCode

string

邀請碼

請求結構範例

{
  "email": string (email)
  "password1": string
  "password2": string
  "name": string
  "company": string
  "referralCode": string
}

請求範例值

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

程式碼範例

# 呼叫 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"
  }'

# 請確認在執行前替換 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

請求結構範例

{
  "name": string
}

請求範例值

{
  "name": "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"
  }'

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

回應內容

狀態碼: 201

回應結構範例

{
  "id": string (uuid)
  "name": string
  "owner": object
  "createdAt": string (timestamp)
  "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",
  "usageStatistics": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應範例名稱",
    "description": "回應範例描述"
  },
  "organizationPlan": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應範例名稱",
    "description": "回應範例描述"
  }
}

取得組織列表

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)
  "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",
  "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)
  "company"?: string // 非必填
  "invitationCode": string
  "apiKeys": [
    object
  ]
  "permissions": [
    string
  ]
}

回應範例值

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "avatar": "response_string",
  "name": "response_string",
  "email": "[email protected]",
  "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"
  }
]

更新組織資訊

PUT /api/organizations/{id}/

參數

參數名稱
必填
類型
說明

id

string

A UUID string identifying this 組織.

請求內容

請求參數

欄位
類型
必填
說明

name

string

請求結構範例

{
  "name": string
}

請求範例值

{
  "name": "request_string"
}

程式碼範例

# 呼叫 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 '{
    "name": "request_string"
  }'

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

回應內容

狀態碼: 200

回應結構範例

{
  "id": string (uuid)
  "name": string
  "owner": object
  "createdAt": string (timestamp)
  "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",
  "usageStatistics": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應範例名稱",
    "description": "回應範例描述"
  },
  "organizationPlan": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應範例名稱",
    "description": "回應範例描述"
  }
}

更新當前用戶詳細資訊

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)
  "company"?: string // 非必填
  "invitationCode": string
  "apiKeys": [
    object
  ]
  "permissions": [
    string
  ]
}

回應範例值

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

新增成員至指定組織

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) // 非必填
}

請求範例值

{
  "email": "[email protected]",
  "organization": "550e8400-e29b-41d4-a716-446655440000"
}

程式碼範例

# 呼叫 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 '{
    "email": "[email protected]",
    "organization": "550e8400-e29b-41d4-a716-446655440000"
  }'

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

回應內容

狀態碼: 201

回應結構範例

{
  "organization": string (uuid),
  "isOwner": boolean
}

回應範例值

{
  "organization": "613c86f7-a45f-4e29-b255-29caf899e320",
  "isOwner": false
}

取得指定組織的成員列表

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)

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/?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
      "email": string
      "organization": 
      {
        "id": string (uuid)
        "name": string
        "owner": object
        "createdAt": string (timestamp)
        "usageStatistics": object
        "organizationPlan": object
      }
      "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",
      "organization": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "response_string",
        "owner": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "response_string"
        },
        "createdAt": "response_string",
        "usageStatistics": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "回應範例名稱",
          "description": "回應範例描述"
        },
        "organizationPlan": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "回應範例名稱",
          "description": "回應範例描述"
        }
      },
      "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
  "organization": 
  {
    "id": string (uuid)
    "name": string
    "owner": object
    "createdAt": string (timestamp)
    "usageStatistics": object
    "organizationPlan": object
  }
  "isOwner": boolean
  "permissions": object
  "createdAt": string (timestamp)
}

回應範例值

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "response_string",
  "email": "response_string",
  "organization": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "response_string",
    "owner": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "response_string"
    },
    "createdAt": "response_string",
    "usageStatistics": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "回應範例名稱",
      "description": "回應範例描述"
    },
    "organizationPlan": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "回應範例名稱",
      "description": "回應範例描述"
    }
  },
  "isOwner": false,
  "permissions": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應範例名稱",
    "description": "回應範例描述"
  },
  "createdAt": "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?