> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hiperai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SMLTP ポリシー

> すべての SMLTP セキュリティ ポリシーを取得する

# SMLTP ポリシー

利用可能なすべての SMLTP (Secure Model Language Transfer Protocol) セキュリティ ポリシーを取得します。

## エンドポイント

```
GET /smltp-policies/all
```

## 説明

組み込みポリシーやカスタム ポリシーを含む、利用可能なすべての SMLTP ポリシーを取得します。 **管理者のみのアクセスが必要です。**

## 認証

**必須**: 管理者権限を持つ API キー

```
Authorization: Bearer sk-your-api-key-here
```

## クエリパラメータ

| パラメータ                                                 | タイプ | 必須 | 説明 |
| ----------------------------------------------------- | --- | -- | -- |
| ❌ クエリ パラメータはサポートされていません - 実際の API はクエリ パラメータを受け入れません。 |     |    |    |

## リクエストの例

```bash theme={null}
GET /smltp-policies/all
```

## 成功の応答

**ステータス コード**: `200 OK`

```json theme={null}
{
  "success": true,
  "data": {
    "builtInPolicies": [
      {
        "id": "public",
        "name": "Public",
        "type": "built-in",
        "description": "For public, non-sensitive data",
        "isActive": false
      },
      {
        "id": "internal",
        "name": "Internal", 
        "type": "built-in",
        "description": "For internal company data",
        "isActive": true
      },
      {
        "id": "confidential",
        "name": "Confidential",
        "type": "built-in", 
        "description": "For confidential business data",
        "isActive": false
      },
      {
        "id": "hipaa",
        "name": "HIPAA",
        "type": "built-in",
        "description": "For healthcare data compliance", 
        "isActive": false
      },
      {
        "id": "gdpr",
        "name": "GDPR",
        "type": "built-in",
        "description": "For European data protection compliance",
        "isActive": false
      },
      {
        "id": "pci-dss", 
        "name": "PCI-DSS",
        "type": "built-in",
        "description": "For payment card industry compliance",
        "isActive": false
      }
    ],
    "customPolicies": [],
    "activePolicyTemplate": "internal",
    "summary": {
      "totalPolicies": 7,
      "builtInCount": 7,
      "customCount": 0
    }
  }
}
```

### 応答フィールド

| フィールド                        | タイプ    | 説明                     |
| ---------------------------- | ------ | ---------------------- |
| `success`                    | ブール値   | 操作が成功したかどうかを示します。      |
| `data`                       | オブジェクト | 応答データ オブジェクト           |
| `data.builtInPolicies`       | 配列     | 組み込みポリシー オブジェクトの配列     |
| `data.customPolicies`        | 配列     | カスタム ポリシー オブジェクトの配列    |
| `data.activePolicyTemplate`  | 文字列    | 現在アクティブなポリシー テンプレート ID |
| `data.summary`               | オブジェクト | 概要統計                   |
| `data.summary.totalPolicies` | 整数     | ポリシーの総数                |
| `data.summary.builtInCount`  | 整数     | 組み込みポリシーの数             |
| `data.summary.customCount`   | 整数     | カスタム ポリシーの数            |

## 使用例

### JavaScript

```javascript theme={null}
const getSmltpPolicies = async () => {
  const response = await fetch('https://{customer.name}.hiperai.ai/api/external/smltp-policies/all', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer sk-your-api-key-here'
    }
  });
  
  return await response.json();
};

// Example usage
const result = await getSmltpPolicies();
console.log('Built-in policies:', result.data.builtInPolicies);
console.log('Active policy:', result.data.activePolicyTemplate);
```

### パイソン

```python theme={null}
import requests

def get_smltp_policies():
    url = "https://{customer.name}.hiperai.ai/api/external/smltp-policies/all"
    headers = {
        "Authorization": "Bearer sk-your-api-key-here"
    }
    
    response = requests.get(url, headers=headers)
    return response.json()

# Example usage
result = get_smltp_policies()
print("Built-in policies:", result["data"]["builtInPolicies"])
print("Active policy:", result["data"]["activePolicyTemplate"])
```

### cURL

```bash theme={null}
curl -X GET "https://{customer.name}.hiperai.ai/api/external/smltp-policies/all" \
  -H "Authorization: Bearer sk-your-api-key-here"
```

## エラー応答

### 401 不正

```json theme={null}
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or missing API key"
  }
}
```

### 429 リクエストが多すぎます

```json theme={null}
{
  "success": false,
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded",
    "retryAfter": 60
  }
}
```

## ポリシーオブジェクトフィールド

| フィールド         | タイプ  | 説明                        |
| ------------- | ---- | ------------------------- |
| `id`          | 文字列  | ポリシー識別子                   |
| `name`        | 文字列  | ポリシー名                     |
| `type`        | 文字列  | ポリシーの種類 (「組み込み」または「カスタム」) |
| `description` | 文字列  | ポリシーの説明                   |
| `isActive`    | ブール値 | このポリシーが現在アクティブかどうか        |
| `createdAt`   | 文字列  | 作成タイムスタンプ (カスタム ポリシーのみ)   |

## 使用例

* **ポリシーの検出**: 利用可能なセキュリティ ポリシーを検索します。
* **コンプライアンス計画**: ポリシー要件を理解する
* **セキュリティ構成**: 適切なポリシーを選択します
* **アクティブなポリシー管理**: 現在アクティブなポリシーを確認します
* **統合**: チャット完了にポリシーを適用します

## レート制限

* **デフォルト**: 1 分あたり 100 リクエスト
* **毎日**: 1 日あたり 10,000 リクエスト
* **毎月**: 毎月 300,000 件のリクエスト

## 注意事項

* このエンドポイントには管理者権限が必要です
* パラメーターなし: クエリ パラメーターはサポートされていません。
* 組み込みポリシー: 事前定義されたシステム ポリシーを返します。
* カスタム ポリシー: カスタム ポリシーが存在する場合は返します。
* アクティブなポリシー: 現在アクティブなポリシー テンプレートを表示します。
* フラットな応答: 応答はデータ オブジェクトの下にネストされます


## OpenAPI

````yaml GET /smltp-policies/all
openapi: 3.0.3
info:
  title: SecureAI External API
  description: >
    SecureAI External API provides AI chat completion and image generation
    capabilities with knowledge base retrieval, 

    security policies, and comprehensive usage tracking. This API is designed
    for external developers 

    and integrations using API key authentication.


    ## Key Features

    - **RAG (Retrieval-Augmented Generation)**: Automatically search knowledge
    bases for relevant context

    - **Multi-Model Support**: OpenAI, Anthropic, Google, Meta, and other AI
    models

    - **Model Redundancy & Failover**: Caller-defined failover chains (primary +
    fallbacks) with per-attempt timeouts

    - **OpenAI-Compatible Endpoint**: Point any OpenAI SDK at `/api/external/v1`
    — no code changes

    - **Image Generation**: Generate and edit images using Google Gemini 2.5
    Flash Image

    - **Speech-to-Speech (S2S)**: Real-time voice conversations using OpenAI
    Realtime API with WebRTC

    - **Security Policies**: SMLTP policy enforcement, per-call Prompt Shield,
    and signed compliance receipts

    - **Usage Tracking**: Comprehensive usage monitoring, self-service quota,
    and rate limiting

    - **Knowledge Base Integration**: Access to personal and shared knowledge
    bases

    - **User Management**: Complete user, group, and role management
    capabilities

    - **Audit Logging**: Comprehensive activity and security audit logs


    ## Authentication

    All endpoints (except health check) require API key authentication using
    Bearer token:

    ```

    Authorization: Bearer sk-your-api-key-here

    ```


    ## Billing and Usage

    By default, API requests are billed to the user account that owns the API
    key. You can specify 

    a different user to bill by including the `user_id` parameter in your
    request. This allows for:

    - Multi-tenant applications with per-user billing

    - Flexible completion limit management

    - Per-user "Usage by Model" settings


    ## Rate Limits

    - Default: 60 requests per minute, 1000 requests per hour

    - Daily limits: 100 requests (configurable)

    - Monthly limits: 10,000 requests (configurable)


    ## Base URL

    ```

    https://secureai.hiperai.ai/api/external

    ```
  version: 1.1.0
  contact:
    name: SecureAI Support
    email: support@secureai.hiperai.ai
  license:
    name: Proprietary
    url: https://secureai.hiperai.ai/terms
servers:
  - url: https://secureai.hiperai.ai/api/external
    description: Production server
  - url: http://localhost:3010/api/external
    description: Development server
security:
  - ApiKeyAuth: []
tags:
  - name: System
    description: System health and status endpoints
  - name: Discovery
    description: Endpoints to discover available models, indexes, and policies
  - name: Chat
    description: AI chat completion endpoints
  - name: User Management
    description: Endpoints for managing user accounts and roles
  - name: Index Management
    description: Endpoints for managing knowledge base indexes
  - name: Group Management
    description: Endpoints for managing user groups
  - name: SMLTP Security
    description: Endpoints for managing SMLTP security policies and audit logs
  - name: Role Management
    description: Endpoints for managing user roles
  - name: Activity Logs
    description: Endpoints for retrieving activity logs
externalDocs:
  description: SecureAI Documentation
  url: https://secureai.hiperai.ai/docs
paths:
  /smltp-policies/all:
    get:
      tags:
        - SMLTP Security
      summary: Get All SMLTP Policies
      description: >
        Retrieve all available SMLTP policies including built-in and custom
        policies. Only accessible by administrators.
      responses:
        '200':
          description: All SMLTP policies
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      builtInPolicies:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              example: internal
                            name:
                              type: string
                              example: Internal
                            type:
                              type: string
                              enum:
                                - built-in
                                - custom
                              example: built-in
                            description:
                              type: string
                              example: For internal company data
                            isActive:
                              type: boolean
                              example: true
                      customPolicies:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              example: custom-policy
                            name:
                              type: string
                              example: Custom Policy
                            type:
                              type: string
                              enum:
                                - built-in
                                - custom
                              example: custom
                            description:
                              type: string
                              example: Custom SMLTP policy
                            isActive:
                              type: boolean
                              example: false
                            createdAt:
                              type: string
                              format: date-time
                              example: '2024-01-15T10:30:00.000Z'
                      activePolicyTemplate:
                        type: string
                        example: internal
                      summary:
                        type: object
                        properties:
                          totalPolicies:
                            type: integer
                            example: 10
                          builtInCount:
                            type: integer
                            example: 7
                          customCount:
                            type: integer
                            example: 3
              example:
                success: true
                data:
                  builtInPolicies:
                    - id: public
                      name: Public
                      type: built-in
                      description: For public, non-sensitive data
                      isActive: false
                    - id: internal
                      name: Internal
                      type: built-in
                      description: For internal company data
                      isActive: true
                  customPolicies:
                    - id: custom-policy
                      name: Custom Policy
                      type: custom
                      description: Custom SMLTP policy
                      isActive: false
                      createdAt: '2024-01-15T10:30:00.000Z'
                  activePolicyTemplate: internal
                  summary:
                    totalPolicies: 10
                    builtInCount: 7
                    customCount: 3
        '401':
          description: Invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Access denied - admin only
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          example: Invalid API key
        message:
          type: string
          example: The provided API key is invalid or has been revoked
        request_id:
          type: string
          example: req-abc123
          description: Request ID for tracking (if available)
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: |
        API key authentication using Bearer token format.
        Example: `Authorization: Bearer sk-your-api-key-here`

````