> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/api/api-reference/scim.md).

# SCIM

SCIM 2.0 端點讓您的身分提供者（Entra ID、Okta 等）自動開通、更新與停用組織成員。基底網址是 `https://api.maiagent.ai/api/v1/scim/{orgUuid}`，路徑不以 `/` 結尾；認證用 `Authorization: Bearer <SCIM Token>`（在後台身分同步設定取得，不是 API Key），`Content-Type: application/scim+json`，每個組織每分鐘 100 次請求。欄位對應與停用語意見技術手冊[成員開通](https://docs.maiagent.ai/tech/authorization-integration/member-provisioning)。

### 取得服務提供者設定（IdP 探索用） <a href="#scim-service-provider-config-retrieve" id="scim-service-provider-config-retrieve"></a>

GET `/api/v1/scim/{orgUuid}/ServiceProviderConfig`

#### 參數

| 參數名稱      | 必填 | 類型     | 說明 |
| --------- | -- | ------ | -- |
| `orgUuid` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/ServiceProviderConfig" \
  -H "Authorization: Bearer YOUR_SCIM_TOKEN"

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Bearer YOUR_SCIM_TOKEN'
  }
};

axios.get("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/ServiceProviderConfig", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/ServiceProviderConfig"
headers = {
    "Authorization": "Bearer YOUR_SCIM_TOKEN"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/ServiceProviderConfig", [
        'headers' => [
            'Authorization' => 'Bearer YOUR_SCIM_TOKEN'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 200 | No response body |

***

### 列出或查詢成員（支援 \`filter\`、\`startIndex\`、\`count\`） <a href="#scim-users-retrieve" id="scim-users-retrieve"></a>

GET `/api/v1/scim/{orgUuid}/Users`

#### 參數

| 參數名稱      | 必填 | 類型     | 說明 |
| --------- | -- | ------ | -- |
| `orgUuid` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users" \
  -H "Authorization: Bearer YOUR_SCIM_TOKEN"

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Bearer YOUR_SCIM_TOKEN'
  }
};

axios.get("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users"
headers = {
    "Authorization": "Bearer YOUR_SCIM_TOKEN"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users", [
        'headers' => [
            'Authorization' => 'Bearer YOUR_SCIM_TOKEN'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 200 | No response body |

***

### 建立成員 <a href="#scim-users-create" id="scim-users-create"></a>

POST `/api/v1/scim/{orgUuid}/Users`

#### 參數

| 參數名稱      | 必填 | 類型     | 說明 |
| --------- | -- | ------ | -- |
| `orgUuid` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users" \
  -H "Authorization: Bearer YOUR_SCIM_TOKEN"

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Bearer YOUR_SCIM_TOKEN'
  }
};

// 請求內容 (payload)
const data = null;

axios.post("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users"
headers = {
    "Authorization": "Bearer YOUR_SCIM_TOKEN"
}


response = requests.post(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users", [
        'headers' => [
            'Authorization' => 'Bearer YOUR_SCIM_TOKEN'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 200 | No response body |

***

### 取得特定成員 <a href="#scim-users-retrieve2" id="scim-users-retrieve2"></a>

GET `/api/v1/scim/{orgUuid}/Users/{userId}`

#### 參數

| 參數名稱      | 必填 | 類型     | 說明 |
| --------- | -- | ------ | -- |
| `orgUuid` | ✅  | string |    |
| `userId`  | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer YOUR_SCIM_TOKEN"

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Bearer YOUR_SCIM_TOKEN'
  }
};

axios.get("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/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);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/550e8400-e29b-41d4-a716-446655440000"
headers = {
    "Authorization": "Bearer YOUR_SCIM_TOKEN"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/550e8400-e29b-41d4-a716-446655440000", [
        'headers' => [
            'Authorization' => 'Bearer YOUR_SCIM_TOKEN'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 200 | No response body |

***

### 整筆取代成員 <a href="#scim-users-update" id="scim-users-update"></a>

PUT `/api/v1/scim/{orgUuid}/Users/{userId}`

#### 參數

| 參數名稱      | 必填 | 類型     | 說明 |
| --------- | -- | ------ | -- |
| `orgUuid` | ✅  | string |    |
| `userId`  | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X PUT "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer YOUR_SCIM_TOKEN"

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Bearer YOUR_SCIM_TOKEN'
  }
};

// 請求內容 (payload)
const data = null;

axios.put("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/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);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/550e8400-e29b-41d4-a716-446655440000"
headers = {
    "Authorization": "Bearer YOUR_SCIM_TOKEN"
}


response = requests.put(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->put("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/550e8400-e29b-41d4-a716-446655440000", [
        'headers' => [
            'Authorization' => 'Bearer YOUR_SCIM_TOKEN'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 200 | No response body |

***

### 局部更新成員（停用、改名、改 externalId） <a href="#scim-users-partial-update" id="scim-users-partial-update"></a>

PATCH `/api/v1/scim/{orgUuid}/Users/{userId}`

#### 參數

| 參數名稱      | 必填 | 類型     | 說明 |
| --------- | -- | ------ | -- |
| `orgUuid` | ✅  | string |    |
| `userId`  | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X PATCH "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer YOUR_SCIM_TOKEN"

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Bearer YOUR_SCIM_TOKEN'
  }
};

// 請求內容 (payload)
const data = null;

axios.patch("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/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);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/550e8400-e29b-41d4-a716-446655440000"
headers = {
    "Authorization": "Bearer YOUR_SCIM_TOKEN"
}


response = requests.patch(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->patch("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/550e8400-e29b-41d4-a716-446655440000", [
        'headers' => [
            'Authorization' => 'Bearer YOUR_SCIM_TOKEN'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 200 | No response body |

***

### 停用成員 <a href="#scim-users-destroy" id="scim-users-destroy"></a>

DELETE `/api/v1/scim/{orgUuid}/Users/{userId}`

#### 參數

| 參數名稱      | 必填 | 類型     | 說明 |
| --------- | -- | ------ | -- |
| `orgUuid` | ✅  | string |    |
| `userId`  | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer YOUR_SCIM_TOKEN"

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Bearer YOUR_SCIM_TOKEN'
  }
};

// 請求內容 (payload)
const data = null;

axios.delete("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/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);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/550e8400-e29b-41d4-a716-446655440000"
headers = {
    "Authorization": "Bearer YOUR_SCIM_TOKEN"
}


response = requests.delete(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->delete("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Users/550e8400-e29b-41d4-a716-446655440000", [
        'headers' => [
            'Authorization' => 'Bearer YOUR_SCIM_TOKEN'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 204 | No response body |

***

### 列出群組（對應 MaiAgent 角色） <a href="#scim-groups-retrieve" id="scim-groups-retrieve"></a>

GET `/api/v1/scim/{orgUuid}/Groups`

#### 參數

| 參數名稱      | 必填 | 類型     | 說明 |
| --------- | -- | ------ | -- |
| `orgUuid` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups" \
  -H "Authorization: Bearer YOUR_SCIM_TOKEN"

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Bearer YOUR_SCIM_TOKEN'
  }
};

axios.get("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups"
headers = {
    "Authorization": "Bearer YOUR_SCIM_TOKEN"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups", [
        'headers' => [
            'Authorization' => 'Bearer YOUR_SCIM_TOKEN'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 200 | No response body |

***

### 建立群組 <a href="#scim-groups-create" id="scim-groups-create"></a>

POST `/api/v1/scim/{orgUuid}/Groups`

#### 參數

| 參數名稱      | 必填 | 類型     | 說明 |
| --------- | -- | ------ | -- |
| `orgUuid` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups" \
  -H "Authorization: Bearer YOUR_SCIM_TOKEN"

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Bearer YOUR_SCIM_TOKEN'
  }
};

// 請求內容 (payload)
const data = null;

axios.post("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups"
headers = {
    "Authorization": "Bearer YOUR_SCIM_TOKEN"
}


response = requests.post(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups", [
        'headers' => [
            'Authorization' => 'Bearer YOUR_SCIM_TOKEN'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 200 | No response body |

***

### 取得特定群組 <a href="#scim-groups-retrieve2" id="scim-groups-retrieve2"></a>

GET `/api/v1/scim/{orgUuid}/Groups/{groupId}`

#### 參數

| 參數名稱      | 必填 | 類型     | 說明 |
| --------- | -- | ------ | -- |
| `groupId` | ✅  | string |    |
| `orgUuid` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer YOUR_SCIM_TOKEN"

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Bearer YOUR_SCIM_TOKEN'
  }
};

axios.get("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/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);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/550e8400-e29b-41d4-a716-446655440000"
headers = {
    "Authorization": "Bearer YOUR_SCIM_TOKEN"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/550e8400-e29b-41d4-a716-446655440000", [
        'headers' => [
            'Authorization' => 'Bearer YOUR_SCIM_TOKEN'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 200 | No response body |

***

### 整筆取代群組 <a href="#scim-groups-update" id="scim-groups-update"></a>

PUT `/api/v1/scim/{orgUuid}/Groups/{groupId}`

#### 參數

| 參數名稱      | 必填 | 類型     | 說明 |
| --------- | -- | ------ | -- |
| `groupId` | ✅  | string |    |
| `orgUuid` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X PUT "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer YOUR_SCIM_TOKEN"

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Bearer YOUR_SCIM_TOKEN'
  }
};

// 請求內容 (payload)
const data = null;

axios.put("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/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);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/550e8400-e29b-41d4-a716-446655440000"
headers = {
    "Authorization": "Bearer YOUR_SCIM_TOKEN"
}


response = requests.put(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->put("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/550e8400-e29b-41d4-a716-446655440000", [
        'headers' => [
            'Authorization' => 'Bearer YOUR_SCIM_TOKEN'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 200 | No response body |

***

### 局部更新群組（改名、增減成員） <a href="#scim-groups-partial-update" id="scim-groups-partial-update"></a>

PATCH `/api/v1/scim/{orgUuid}/Groups/{groupId}`

#### 參數

| 參數名稱      | 必填 | 類型     | 說明 |
| --------- | -- | ------ | -- |
| `groupId` | ✅  | string |    |
| `orgUuid` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X PATCH "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer YOUR_SCIM_TOKEN"

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Bearer YOUR_SCIM_TOKEN'
  }
};

// 請求內容 (payload)
const data = null;

axios.patch("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/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);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/550e8400-e29b-41d4-a716-446655440000"
headers = {
    "Authorization": "Bearer YOUR_SCIM_TOKEN"
}


response = requests.patch(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->patch("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/550e8400-e29b-41d4-a716-446655440000", [
        'headers' => [
            'Authorization' => 'Bearer YOUR_SCIM_TOKEN'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 200 | No response body |

***

### 刪除群組 <a href="#scim-groups-destroy" id="scim-groups-destroy"></a>

DELETE `/api/v1/scim/{orgUuid}/Groups/{groupId}`

#### 參數

| 參數名稱      | 必填 | 類型     | 說明 |
| --------- | -- | ------ | -- |
| `groupId` | ✅  | string |    |
| `orgUuid` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer YOUR_SCIM_TOKEN"

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

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Bearer YOUR_SCIM_TOKEN'
  }
};

// 請求內容 (payload)
const data = null;

axios.delete("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/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);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/550e8400-e29b-41d4-a716-446655440000"
headers = {
    "Authorization": "Bearer YOUR_SCIM_TOKEN"
}


response = requests.delete(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->delete("https://api.maiagent.ai/api/v1/scim/550e8400-e29b-41d4-a716-446655440000/Groups/550e8400-e29b-41d4-a716-446655440000", [
        'headers' => [
            'Authorization' => 'Bearer YOUR_SCIM_TOKEN'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 204 | No response body |

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.maiagent.ai/api/api-reference/scim.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
