> ## 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.

# Erstellen Sie eine SMLTP-Richtlinie

> Erstellen Sie eine neue SMLTP-Sicherheitsrichtlinie

# SMLTP-Richtlinie erstellen

Erstellen Sie eine neue SMLTP-Sicherheitsrichtlinie (Secure Model Language Transfer Protocol) für Ihr Konto.

## Endpunkt

```
POST /smltp-policies
```

## Beschreibung

Erstellen Sie eine neue benutzerdefinierte SMLTP-Richtlinie. Nur Administratorzugriff erforderlich.

## Authentifizierung

**Erforderlich**: API-Schlüssel mit Administratorrechten

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

## Anforderungstext

| Parameter     | Geben Sie       | ein Erforderlich | Beschreibung                                                                  |
| ------------- | --------------- | ---------------- | ----------------------------------------------------------------------------- |
| `name`        | Zeichenfolge    | Ja               | Richtlinienname                                                               |
| `description` | Zeichenfolge    | Ja               | Richtlinienbeschreibung                                                       |
| `policy`      | Objekt          | Ja               | Richtlinienkonfigurationsobjekt                                               |
| `setAsActive` | boolescher Wert | Nein             | Ob diese Richtlinie sofort als aktiv festgelegt werden soll (Standard: false) |

## Beispielanfrage

```json theme={null}
{
  "name": "Custom Privacy Policy",
  "description": "Enhanced privacy protection for sensitive data",
  "policy": {
    // Policy configuration object
  },
  "setAsActive": false
}
```

## Erfolgsantwort

**Statuscode**: `201 Created`

```json theme={null}
{
  "success": true,
  "message": "SMLTP policy created successfully",
  "policy": {
    "id": "custom-privacy-policy",
    "name": "Custom Privacy Policy",
    "description": "Enhanced privacy protection for sensitive data",
    "type": "custom",
    "isActive": false,
    "createdAt": "2024-01-20T15:30:00.000Z"
  }
}
```

### Antwortfelder

| Feld                 | Geben Sie       | ein Beschreibung                         |
| -------------------- | --------------- | ---------------------------------------- |
| `success`            | boolescher Wert | Zeigt an, ob der Vorgang erfolgreich war |
| `message`            | Zeichenfolge    | Erfolgsmeldung                           |
| `policy`             | Objekt          | Erstelltes Richtlinienobjekt             |
| `policy.id`          | Zeichenfolge    | Richtlinien-ID (aus dem Namen generiert) |
| `policy.name`        | Zeichenfolge    | Richtlinienname                          |
| `policy.description` | Zeichenfolge    | Richtlinienbeschreibung                  |
| `policy.type`        | Zeichenfolge    | Richtlinientyp („benutzerdefiniert“)     |
| `policy.isActive`    | boolescher Wert | Ob die Richtlinie derzeit aktiv ist      |
| `policy.createdAt`   | Zeichenfolge    | Erstellungszeitstempel                   |

## Beispielverwendung

### JavaScript

```javascript theme={null}
const createSmltpPolicy = async (policyData) => {
  const response = await fetch('https://{customer.name}.hiperai.ai/api/external/smltp-policies', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk-your-api-key-here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(policyData)
  });
  
  return await response.json();
};

// Example usage
const policyData = {
  name: "Custom Privacy Policy",
  description: "Enhanced privacy protection for sensitive data",
  policy: {
    // Policy configuration object
  },
  setAsActive: false
};

const result = await createSmltpPolicy(policyData);
console.log('Created policy:', result.policy.id);
```

### Python

```python theme={null}
import requests

def create_smltp_policy(policy_data):
    url = "https://{customer.name}.hiperai.ai/api/external/smltp-policies"
    headers = {
        "Authorization": "Bearer sk-your-api-key-here",
        "Content-Type": "application/json"
    }
    
    response = requests.post(url, headers=headers, json=policy_data)
    return response.json()

# Example usage
policy_data = {
    "name": "Custom Privacy Policy",
    "description": "Enhanced privacy protection for sensitive data",
    "policy": {
        # Policy configuration object
    },
    "setAsActive": False
}

result = create_smltp_policy(policy_data)
print("Created policy:", result["policy"]["id"])
```

### cURL

```bash theme={null}
curl -X POST "https://{customer.name}.hiperai.ai/api/external/smltp-policies" \
  -H "Authorization: Bearer sk-your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Custom Privacy Policy",
    "description": "Enhanced privacy protection for sensitive data",
    "policy": {
      // Policy configuration object
    },
    "setAsActive": false
  }'
```

## Fehlerantworten

### 400 Ungültige Anfrage

```json theme={null}
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Policy name is required",
    "details": {
      "field": "name",
      "value": null
    }
  }
}
```

### 401 Nicht autorisiert

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

### 403 Verboten

```json theme={null}
{
  "success": false,
  "error": {
    "code": "INSUFFICIENT_PERMISSIONS",
    "message": "Admin privileges required"
  }
}
```

### 409 Konflikt

```json theme={null}
{
  "success": false,
  "error": {
    "code": "POLICY_NAME_EXISTS",
    "message": "Policy name already exists"
  }
}
```

### 429 Zu viele Anfragen

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

## Anwendungsfälle

* **Benutzerdefinierte Sicherheit**: Erstellen Sie Richtlinien, die auf Ihre Bedürfnisse zugeschnitten sind
* **Compliance**: Implementieren Sie spezifische regulatorische Anforderungen
* **Risikomanagement**: Definieren Sie Sicherheitsmaßnahmen zur Risikominderung
* **Datenschutz**: Legen Sie Datenschutz- und Datenverarbeitungsregeln fest
* **Richtlinienverwaltung**: Erstellen und verwalten Sie benutzerdefinierte SMLTP-Richtlinien

## Tarifbegrenzungen

* **Standard**: 50 Anfragen pro Minute
* **Täglich**: 5.000 Anfragen pro Tag
* **Monatlich**: 150.000 Anfragen pro Monat

## Notizen

– Für diesen Endpunkt sind Administratorrechte erforderlich

* Erforderliche Felder: Name, Beschreibung und Richtlinie sind erforderlich
* Richtlinien-ID: Wird aus dem Namen generiert (Kleinbuchstaben, Bindestriche für Leerzeichen)
* Eindeutige Namen: Richtliniennamen müssen eindeutig sein
* Aktiv setzen: Kann optional sofort als aktiv gesetzt werden
* Flache Antwort: Die Antwort ist nicht unter dem Datenobjekt verschachtelt


## OpenAPI

````yaml POST /smltp-policies/active
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/active:
    post:
      tags:
        - SMLTP Security
      summary: Create Custom SMLTP Policy
      description: |
        Create a new custom SMLTP policy. Only accessible by administrators.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - description
                - policy
              properties:
                name:
                  type: string
                  description: Policy name
                  example: Custom Policy
                description:
                  type: string
                  description: Policy description
                  example: Custom SMLTP policy for specific requirements
                policy:
                  type: object
                  description: Policy configuration object
                  example: null
                setAsActive:
                  type: boolean
                  default: false
                  description: Whether to set this policy as active immediately
                  example: false
            example:
              name: Custom Policy
              description: Custom SMLTP policy for specific requirements
              policy: null
              setAsActive: false
      responses:
        '201':
          description: Custom policy created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: SMLTP policy created successfully
                  policy:
                    type: object
                    properties:
                      id:
                        type: string
                        example: custom-policy
                      name:
                        type: string
                        example: Custom Policy
                      description:
                        type: string
                        example: Custom SMLTP policy for specific requirements
                      type:
                        type: string
                        example: custom
                      isActive:
                        type: boolean
                        example: false
                      createdAt:
                        type: string
                        format: date-time
                        example: '2024-01-15T10:30:00.000Z'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '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'
        '409':
          description: Policy name already exists
          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`

````