帳號註冊
POST /api/auth/registration/
請求內容
請求參數
請求結構範例
{
"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 並核對請求資料。
const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY',
'Content-Type': 'application/json'
}
};
// 請求內容 (payload)
const data = {
"email": "[email protected]",
"password1": "request_string",
"password2": "request_string",
"name": "request_string",
"company": "request_string",
"referralCode": "request_string",
"authSource": null
};
axios.post("https://api.maiagent.ai/api/auth/registration/", data, config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});
import requests
url = "https://api.maiagent.ai/api/auth/registration/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY",
"Content-Type": "application/json"
}
# 請求內容 (payload)
data = {
"email": "[email protected]",
"password1": "request_string",
"password2": "request_string",
"name": "request_string",
"company": "request_string",
"referralCode": "request_string",
"authSource": null
}
response = requests.post(url, json=data, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->post("https://api.maiagent.ai/api/auth/registration/", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY',
'Content-Type' => 'application/json'
],
'json' => {
"email": "[email protected]",
"password1": "request_string",
"password2": "request_string",
"name": "request_string",
"company": "request_string",
"referralCode": "request_string",
"authSource": null
}
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>
回應內容
狀態碼: 201
回應結構範例
回應範例值
{
"detail": "response_string"
}
更換密碼
POST /api/auth/password/change/
請求內容
請求參數
請求結構範例
{
"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 並核對請求資料。
const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY',
'Content-Type': 'application/json'
}
};
// 請求內容 (payload)
const data = {
"oldPassword": "request_string",
"newPassword1": "request_string",
"newPassword2": "request_string"
};
axios.post("https://api.maiagent.ai/api/auth/password/change/", data, config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});
import requests
url = "https://api.maiagent.ai/api/auth/password/change/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY",
"Content-Type": "application/json"
}
# 請求內容 (payload)
data = {
"oldPassword": "request_string",
"newPassword1": "request_string",
"newPassword2": "request_string"
}
response = requests.post(url, json=data, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->post("https://api.maiagent.ai/api/auth/password/change/", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY',
'Content-Type' => 'application/json'
],
'json' => {
"oldPassword": "request_string",
"newPassword1": "request_string",
"newPassword2": "request_string"
}
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>
回應內容
狀態碼: 200
回應結構範例
回應範例值
{
"detail": "response_string"
}
建立新組織
POST /api/organizations/
請求內容
請求參數
請求結構範例
{
"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 並核對請求資料。
const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY',
'Content-Type': 'application/json'
}
};
// 請求內容 (payload)
const data = {
"name": "request_string",
"compactLogo": "request_string",
"fullLogo": "request_string"
};
axios.post("https://api.maiagent.ai/api/organizations/", data, config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});
import requests
url = "https://api.maiagent.ai/api/organizations/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY",
"Content-Type": "application/json"
}
# 請求內容 (payload)
data = {
"name": "request_string",
"compactLogo": "request_string",
"fullLogo": "request_string"
}
response = requests.post(url, json=data, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->post("https://api.maiagent.ai/api/organizations/", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY',
'Content-Type' => 'application/json'
],
'json' => {
"name": "request_string",
"compactLogo": "request_string",
"fullLogo": "request_string"
}
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>
回應內容
狀態碼: 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/
參數
A UUID string identifying this 組織 ID
請求內容
請求參數
請求結構範例
{
"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 並核對請求資料。
const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY',
'Content-Type': 'application/json'
}
};
// 請求內容 (payload)
const data = {
"organization": "613c86f7-a45f-4e29-b255-29caff89de32",
"is_owner": false
};
axios.post("https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/", data, config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});
import requests
url = "https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY",
"Content-Type": "application/json"
}
# 請求內容 (payload)
data = {
"organization": "613c86f7-a45f-4e29-b255-29caff89de32",
"is_owner": false
}
response = requests.post(url, json=data, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->post("https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY',
'Content-Type' => 'application/json'
],
'json' => {
"organization": "613c86f7-a45f-4e29-b255-29caff89de32",
"is_owner": false
}
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>
回應內容
狀態碼: 201
回應結構範例
{
"organization": string (uuid) // 組織 ID
"is_owner": boolean // 是否為組織擁有者
}
回應範例值
{
"organization": "613c86f7-a45f-4e29-b255-29caff89de32",
"is_owner": false
}
取得組織列表
GET /api/organizations/
參數
A page number within the paginated result set.
Number of results to return per page.
程式碼範例
# 呼叫 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 並核對請求資料。
const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY'
}
};
axios.get("https://api.maiagent.ai/api/organizations/?page=1&pageSize=1&pagination=example", config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});
import requests
url = "https://api.maiagent.ai/api/organizations/?page=1&pageSize=1&pagination=example"
headers = {
"Authorization": "Api-Key YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->get("https://api.maiagent.ai/api/organizations/?page=1&pageSize=1&pagination=example", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY'
]
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>
回應內容
狀態碼: 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}/
參數
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 並核對請求資料。
const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY'
}
};
axios.get("https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/", config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});
import requests
url = "https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->get("https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY'
]
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>
回應內容
狀態碼: 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 並核對請求資料。
const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY'
}
};
axios.get("https://api.maiagent.ai/api/users/current/", config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});
import requests
url = "https://api.maiagent.ai/api/users/current/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->get("https://api.maiagent.ai/api/users/current/", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY'
]
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>
回應內容
狀態碼: 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 並核對請求資料。
const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY'
}
};
axios.get("https://api.maiagent.ai/api/permissions/", config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});
import requests
url = "https://api.maiagent.ai/api/permissions/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->get("https://api.maiagent.ai/api/permissions/", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY'
]
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>
回應內容
狀態碼: 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/
參數
A UUID string identifying this 組織 ID
A page number within the paginated result set.
Number of results to return per page.
程式碼範例
# 呼叫 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 並核對請求資料。
const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY'
}
};
axios.get("https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/?page=1&pageSize=1&pagination=example&query=example", config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});
import requests
url = "https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/?page=1&pageSize=1&pagination=example&query=example"
headers = {
"Authorization": "Api-Key YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->get("https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/?page=1&pageSize=1&pagination=example&query=example", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY'
]
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>
回應內容
狀態碼: 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}/
參數
A UUID string identifying this 成員.
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 並核對請求資料。
const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY'
}
};
axios.get("https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000/", config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});
import requests
url = "https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->get("https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000/", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY'
]
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>
回應內容
狀態碼: 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}/
參數
A UUID string identifying this 組織.
請求內容
請求參數
請求結構範例
{
"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 並核對請求資料。
const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY',
'Content-Type': 'application/json'
}
};
// 請求內容 (payload)
const data = {
"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
}
};
axios.put("https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/", data, config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});
import requests
url = "https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY",
"Content-Type": "application/json"
}
# 請求內容 (payload)
data = {
"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
}
}
response = requests.put(url, json=data, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->put("https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY',
'Content-Type' => 'application/json'
],
'json' => {
"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
}
}
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>
回應內容
狀態碼: 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": "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 並核對請求資料。
const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY',
'Content-Type': 'application/json'
}
};
// 請求內容 (payload)
const data = {
"avatar": "request_string",
"name": "request_string",
"email": "[email protected]",
"company": "request_string",
"invitationCode": "request_string"
};
axios.put("https://api.maiagent.ai/api/users/current/", data, config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});
import requests
url = "https://api.maiagent.ai/api/users/current/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY",
"Content-Type": "application/json"
}
# 請求內容 (payload)
data = {
"avatar": "request_string",
"name": "request_string",
"email": "[email protected]",
"company": "request_string",
"invitationCode": "request_string"
}
response = requests.put(url, json=data, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->put("https://api.maiagent.ai/api/users/current/", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY',
'Content-Type' => 'application/json'
],
'json' => {
"avatar": "request_string",
"name": "request_string",
"email": "[email protected]",
"company": "request_string",
"invitationCode": "request_string"
}
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>
回應內容
狀態碼: 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}/
參數
A UUID string identifying this 成員.
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 並核對請求資料。
const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY'
}
};
// 請求內容 (payload)
const data = null;
axios.delete("https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000/", data, config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});
import requests
url = "https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY"
}
response = requests.delete(url, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->delete("https://api.maiagent.ai/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000/", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY'
]
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>
回應內容