Alice WonderFence API

WonderFence provides real-time guardrails for AI-generated content. APIs for evaluating and moderating AI-generated content and interactions to protect against harmful outputs and prompt attacks. ## API Response Key Mapping The following table is a mapping between violation types, their categories, and their corresponding API response keys: Violation Type | Category | API Response Key ---------------|----------|---------------- Impersonation | Security | prompt_attack.impersonation System Prompt Override | Security | prompt_attack.system_prompt_override Encoding | Security | prompt_injection.general_encoding Prompt Injection | Security | prompt_injection.general PII | Privacy | privacy_violation.PII Harassment or Bullying | Safety | abusive_or_harmful.harassment_or_bullying Profanity | Safety | abusive_or_harmful.profanity Hate Speech | Safety | abusive_or_harmful.hate_speech Child Abuse | Safety | abusive_or_harmful.child_abuse Suicide and Self-harm | Safety | self_harm.general Adult Content | Safety | adult_content.general Weapons | Safety | unauthorised_sales.weapons Legal Advice | Safety | deny_topics.legal_advice Financial Advice | Safety | deny_topics.financial_advice

OpenAPI Specification

alice-wonderfence-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  license:
    name: Alice API Terms of Use
    url: https://app.alice.io/ts-platform/api-terms.pdf
  version: 3.0.0
  title: Alice API Documentation WonderFence API
  description: "# About This Guide\nThis guide provides comprehensive documentation for Alice's API offerings:\n\n**WonderSuite** - Our GenAI protection suite:\n- **WonderBuild**: Red teaming and security assessment tools for AI applications\n- **WonderFence**: Real-time guardrails for AI-generated content\n\n**ActiveFamily** - Our content moderation platform:\n- **ActiveScore**: AI-driven automated detection API that analyzes items and returns risk scores\n- **ActiveOS**: Self-service UI for organizing items, taking automatic or manual actions, and more\n\nAll APIs use a standard REST design, allowing you to use any standard REST client to call our endpoints from your server.\n\n### Run in Postman\nIf you use Postman, you can import the Alice APIs endpoints as a collection into your Postman app, then try out different requests to learn how the API works. Click the following button to get started:\n\n[![Run in Postman](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/24226888-0756580e-fccf-4fc3-8d36-7cc224b9215e?action=collection%2Ffork&collection-url=entityId%3D24226888-0756580e-fccf-4fc3-8d36-7cc224b9215e%26entityType%3Dcollection%26workspaceId%3D4a89e487-a108-4875-9ade-315bd98baf53)\n\n# Authentication\nAn Alice platform account is required to send requests and data to the Alice platform. An Alice representative will open an account for you and send you an email invitation to log in.\n\nThe following describes how to generate an API key, which you must use in the **af-api-key** header of each API request that you send. \n\n\n\n## Generating an API Key – How To\n**To generate an API key –**\n\n1. Click the **Account Settings**  button.\n\n2. Select **DATA MANAGEMENT** and then select **Alice API Keys**. \nA list of the Alice API keys that have already been defined is displayed. \n\n \n3. Click the **Add Key** button. The following displays – \n\n    \n\n4. In the **Key Name** field, enter any free-text name to identify the key.\n\n5. In the **Description** field, enter any free text description of the key.\n\n6. Click the **Generate Key** button. The key is then displayed in the following window – \n\n    \n\n    You must copy the key and should keep it secure, because you will not be able to see it again. Later, if needed you can [regenerate this key](#section/Authentication/Regenerating-a-Key).\n\n7. Click on the key in the **Your API Key** field to copy it to the clipboard. You can now click the **I've copied the key** button.\n\n8. Use this key as the value of an **af-api-key** header that you must add to each request.\n**af-api-key: \"YOUR_API_KEY\"** \n\n ## Regenerating a Key\nRegenerating a key will override the current one. The old one will still be valid for an additional 12 hours. After 12 hours, any request sent with the old key will be rejected.\n\n**To regenerate an Alice API Key –** \n1. Click the **Account Settings**  button. \n2. Select **DATA MANAGEMENT** and then **Alice API Keys**. The following displays – \n\n\n3. Click the **Regenerate**  button on the right side of the API key to be generated.\n\n**Note –** The options to delete a key and/or regenerate an existing one enable you to rotate between two different API keys.\n\n## Editing/Deleting a Key\nOnly the name and description of a key can be edited.\nOnce you delete a key, any request that uses the deleted key will be rejected. \n\n**To delete an Alice API Key –** \n\n1. Click the **Account Settings**  button. \n\n2. Select **DATA MANAGEMENT**, and then **Alice API Keys**. \n\n3. Click the  button on the right side of the API key and select the **Edit** or the **Delete** option.\n"
  contact:
    name: Support
    email: support@alice.io
  termsOfService: https://app.alice.io/ts-platform/terms.pdf
servers:
- url: https://api.alice.io
  description: APIs Server
security:
- API Key: []
tags:
- name: WonderFence
  description: "WonderFence provides real-time guardrails for AI-generated content. APIs for evaluating and moderating AI-generated content and interactions to protect against harmful outputs and prompt attacks.\n\n## API Response Key Mapping\nThe following table is a mapping between violation types, their categories, and their corresponding API response keys:\n\nViolation Type | Category | API Response Key\n---------------|----------|----------------\n Impersonation | Security | prompt_attack.impersonation\n System Prompt Override | Security | prompt_attack.system_prompt_override\n Encoding | Security | prompt_injection.general_encoding\n Prompt Injection | Security | prompt_injection.general\n PII | Privacy | privacy_violation.PII\n Harassment or Bullying | Safety | abusive_or_harmful.harassment_or_bullying\n Profanity | Safety | abusive_or_harmful.profanity\n Hate Speech | Safety | abusive_or_harmful.hate_speech\n Child Abuse | Safety | abusive_or_harmful.child_abuse\n Suicide and Self-harm | Safety | self_harm.general\n Adult Content | Safety | adult_content.general\n Weapons | Safety | unauthorised_sales.weapons\n Legal Advice | Safety | deny_topics.legal_advice\n Financial Advice | Safety | deny_topics.financial_advice"
paths:
  /v1/evaluate/message:
    post:
      summary: Message
      operationId: post-genai-evaluate
      description: 'Endpoint: https://api.alice.io/v1/evaluate/message


        This synchronous endpoint is used to evaluate messages sent to the Alice Guardrails service. It analyzes messages for potential violations and returns appropriate actions based on the analysis.'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  description: The message text to evaluate for potential violations.
                  maxLength: 10240
                message_type:
                  type: string
                  description: The type of message being evaluated.
                  enum:
                  - prompt
                  - response
                session_id:
                  type: string
                  description: The session identifier for the message.
                  maxLength: 100
                user_id:
                  type: string
                  description: The identifier of the user who sent the message.
                  maxLength: 100
                model_context:
                  type: object
                  description: Additional context about the model being used.
                  properties:
                    provider:
                      type: string
                      description: The provider of the model.
                      maxLength: 100
                    name:
                      type: string
                      description: The name of the model.
                      maxLength: 100
                    version:
                      type: string
                      description: The version of the model.
                      maxLength: 100
                    cloud_platform:
                      type: string
                      description: The cloud platform where the model is deployed.
                      maxLength: 100
                  required:
                  - provider
                  - name
                  - version
                app_name:
                  type: string
                  description: The name of the application sending the message.
                  maxLength: 100
                external_moderation:
                  type: object
                  description: Optional external moderation data to be considered in the evaluation.
              required:
              - text
              - message_type
              - session_id
              - user_id
              - model_context
        description: The message and context to evaluate
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  correlation_id:
                    type: string
                    description: The correlation ID for tracking the request.
                    example: 123e4567-e89b-12d3-a456-426614174000
                  action:
                    type: string
                    description: The action to take based on the evaluation.
                    example: block
                  action_text:
                    type: string
                    description: The text description of the action.
                    example: I'm sorry, I cannot answer this question. Please refer to the application usage guidelines and see that you follow them
                  detections:
                    type: array
                    description: The detected violations and their details.
                    items:
                      type: object
                      properties:
                        violation_type:
                          type: string
                          description: The type of violation detected.
                          example: abusive_or_harmful.hate_speech
                        risk_score:
                          type: number
                          description: The risk score for the detected violation.
                          minimum: 0.1
                          maximum: 1
                          example: 0.87
                        detection_type:
                          type: string
                          description: The type of detection method used.
                          enum:
                          - manual
                          example: manual
                        analysis_description:
                          type: string
                          description: A textual description of the violation.
                          example: Content contains hate speech targeting a specific group
                      required:
                      - violation_type
                      - risk_score
                    example:
                    - violation_type: abusive_or_harmful.hate_speech
                      risk_score: 0.87
                    - violation_type: abusive_or_harmful.profanity
                      risk_score: 0.65
                  errors:
                    type: array
                    description: Any errors that occurred during evaluation.
                    items:
                      type: object
                    example: []
                required:
                - correlation_id
                - action
                - action_text
                - detections
                - errors
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
      tags:
      - WonderFence
components:
  responses:
    '400':
      description: Bad Request
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                example: 400
              error:
                type: string
                example: Bad Request
              message:
                type: string
                example: \"text\" is required
              params:
                type: object
                properties:
                  body:
                    type: object
                    description: error type
                    properties:
                      source:
                        type: string
                        example: body
                      keys:
                        type: array
                        items:
                          type: string
                      message:
                        type: string
                        example: \"text\" is required
    '401':
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                example: 401
              error:
                type: string
                example: Unauthorized
              message:
                type: string
                example: Invalid credentials
              params:
                type: object
                properties:
                  body:
                    type: object
                    description: error type
                    properties:
                      source:
                        type: string
                      keys:
                        type: array
                        items:
                          type: string
                      message:
                        type: string
                        example: Invalid credentials
    '429':
      description: Too Many Requests
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                example: 429
              error:
                type: string
                example: Too Many Requests
              message:
                type: string
                example: Too Many Requests
              params:
                type: object
                properties:
                  body:
                    type: object
                    description: error type
                    properties:
                      source:
                        type: string
                      keys:
                        type: array
                        items:
                          type: string
                      message:
                        type: string
                        example: Too Many Requests
  securitySchemes:
    API Key:
      name: af-api-key
      type: apiKey
      in: header
      description: '

        '
x-stoplight:
  id: 324cav554fkgg
x-tagGroups:
- name: WonderSuite
  tags:
  - General
  - WonderBuild
  - WonderFence
- name: ActiveFamily
  tags:
  - Integrating with ActiveOS
  - content
  - users
  - collection
  - flags
  - api keys