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

# Validate Document Api

> Validate a document against regex, blacklist, and LLM-based rules.



## OpenAPI

````yaml https://document-assistant.us.aodocs.app/openapi.json post /assistant/api/v1/tenants/{tenant}/documents:validate
openapi: 3.1.0
info:
  title: Document Assistant API
  description: |
    <p>
      The Document Assistant API enables developers to integrate document-based assistant
      functionalities into their applications using AODocs.
    </p>
    <p>
      The first step is to enable AIDA (AODocs Intelligent Document Assistant) in your tenant.
      The support team will provide you with the necessary information on how to get started.
    </p>
    <p>
      The second step is to enable AIDA on libraries. You need to be an administrator of the
      library to do this.<br />
      AIDA can answer questions only from those documents that are in an AIDA enabled
      library.<br />
      We create a vector store index for these documents. This can take some time. The get
      library API provides the status of the indexation and an estimate of the time
      remaining.<br />
      The content of the index is automatically kept up-to-date near real time with the
      content changes.
    </p>
    <p>
      The third step is to ask questions based on the AODocs documents.<br />
      AIDA automatically filters the results based on the user's permissions.
    </p>
    <p>
      <strong>Authentication:</strong> All API endpoints require a valid OAuth2 token in the
      Authorization header. Ensure the client ID of the OAuth2 token is whitelisted in AODocs.
    </p>
  version: 1.1.0
servers:
  - url: https://document-assistant.us.aodocs.app
    description: Production US
  - url: https://document-assistant.eu.aodocs.app
    description: Production EU
security: []
paths:
  /assistant/api/v1/tenants/{tenant}/documents:validate:
    post:
      tags:
        - document_validation
      summary: Validate Document Api
      description: Validate a document against regex, blacklist, and LLM-based rules.
      operationId: >-
        validate_document_api_assistant_api_v1_tenants__tenant__documents_validate_post
      parameters:
        - name: tenant
          in: path
          required: true
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The domain of the customer
            examples:
              - example.com
            title: Tenant
          description: The domain of the customer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentValidationRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentValidationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    DocumentValidationRequest:
      properties:
        llm_provider:
          anyOf:
            - $ref: '#/components/schemas/LlmProvider'
            - type: 'null'
          description: >-
            The LLM provider to use. If not provided, the default provider will
            be used.
        llm_model_prefix:
          anyOf:
            - type: string
            - type: 'null'
          title: Llm Model Prefix
          description: >-
            The prefix of the LLM model name to use. If not provided, the
            default model will be used.
          examples:
            - gemini-2.5-pro
            - gemini-2.5-pro-preview-05-06
            - gpt-4.1
        document_id:
          type: string
          title: Document Id
          description: The document ID of the files
        attachment_filters:
          anyOf:
            - items:
                $ref: '#/components/schemas/AttachmentFilter'
              type: array
            - type: 'null'
          title: Attachment Filters
          description: >-
            Optional attachment filters. If omitted, all attachments are
            validated.
        rules:
          items:
            oneOf:
              - $ref: '#/components/schemas/StoredRuleRef'
              - $ref: '#/components/schemas/RegexRule'
              - $ref: '#/components/schemas/BlacklistRule'
              - $ref: '#/components/schemas/LlmRule'
            discriminator:
              propertyName: kind
              mapping:
                blacklist:
                  $ref: '#/components/schemas/BlacklistRule'
                llm:
                  $ref: '#/components/schemas/LlmRule'
                regex:
                  $ref: '#/components/schemas/RegexRule'
                stored:
                  $ref: '#/components/schemas/StoredRuleRef'
          type: array
          minItems: 1
          title: Rules
          description: Validation rules to execute against the selected attachments.
        whitelist:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Whitelist
          description: Values that should be ignored even if one of the rules detects them.
      type: object
      required:
        - document_id
        - rules
      title: DocumentValidationRequest
    DocumentValidationResponse:
      properties:
        document_id:
          type: string
          title: Document Id
          description: The validated document ID.
        passed:
          type: boolean
          title: Passed
          description: Whether the document passed validation after whitelist suppression.
        violations:
          items:
            $ref: '#/components/schemas/ValidationViolation'
          type: array
          title: Violations
          description: Flat list of detected violations.
      type: object
      required:
        - document_id
        - passed
        - violations
      title: DocumentValidationResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    LlmProvider:
      type: string
      enum:
        - OpenAI
        - Google
        - Altirnao
        - MistralAI
        - Anthropic
      title: LlmProvider
    AttachmentFilter:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: The name of the attachment to match (it can be a regular expression)
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: The id of the matched attachment
        mime_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Mime Type
          description: The mimetype of the matched attachment
      type: object
      title: AttachmentFilter
      description: Match an attachment by identifier, MIME type, or name expression.
    StoredRuleRef:
      properties:
        kind:
          type: string
          const: stored
          title: Kind
          default: stored
        rule_id:
          type: string
          title: Rule Id
          description: >-
            The stored rule ID to execute. Built-in rules use the reserved
            'builtin.' prefix; all other IDs resolve to tenant-scoped custom
            rules.
        include_violation_details:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Include Violation Details
          description: >-
            Override whether matched_text and snippet are included for
            violations from this rule. If None, uses the stored rule's own
            setting (defaulting to True).
      type: object
      required:
        - rule_id
      title: StoredRuleRef
    RegexRule:
      properties:
        kind:
          type: string
          const: regex
          title: Kind
          default: regex
        rule_id:
          type: string
          title: Rule Id
          description: Stable rule ID supplied by the caller.
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: Optional human-readable label for the rule.
        pattern:
          type: string
          title: Pattern
          description: Regular expression used to detect violations.
        flags:
          anyOf:
            - items:
                $ref: '#/components/schemas/RegexFlag'
              type: array
            - type: 'null'
          title: Flags
          description: Optional regular expression flags.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Optional human-readable description of the rule.
        include_violation_details:
          type: boolean
          title: Include Violation Details
          description: >-
            Whether the response should include matched_text and snippet for
            violations from this rule.
          default: true
      type: object
      required:
        - rule_id
        - pattern
      title: RegexRule
    BlacklistRule:
      properties:
        kind:
          type: string
          const: blacklist
          title: Kind
          default: blacklist
        rule_id:
          type: string
          title: Rule Id
          description: Stable rule ID supplied by the caller.
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: Optional human-readable label for the rule.
        terms:
          items:
            type: string
          type: array
          minItems: 1
          title: Terms
          description: >-
            Exact terms that should trigger a violation when found in the
            document.
        case_sensitive:
          type: boolean
          title: Case Sensitive
          description: Whether blacklist matching should be case sensitive.
          default: false
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Optional human-readable description of the rule.
        include_violation_details:
          type: boolean
          title: Include Violation Details
          description: >-
            Whether the response should include matched_text and snippet for
            violations from this rule.
          default: true
      type: object
      required:
        - rule_id
        - terms
      title: BlacklistRule
    LlmRule:
      properties:
        kind:
          type: string
          const: llm
          title: Kind
          default: llm
        rule_id:
          type: string
          title: Rule Id
          description: Stable rule ID supplied by the caller.
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: Optional human-readable label for the rule.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Optional human-readable description of the rule.
        rule_intent:
          type: string
          title: Rule Intent
          description: High-level purpose of the rule, shown to the LLM.
        violation_definition:
          type: string
          title: Violation Definition
          description: What counts as a violation for this rule.
        non_violation_definition:
          type: string
          title: Non Violation Definition
          description: What should not be flagged for this rule.
        requires_visual_processing:
          type: boolean
          title: Requires Visual Processing
          description: >-
            Whether this rule requires multimodal attachment input in addition
            to text.
          default: false
        include_violation_details:
          type: boolean
          title: Include Violation Details
          description: >-
            Whether the response should include matched_text and snippet for
            violations from this rule.
          default: true
      type: object
      required:
        - rule_id
        - rule_intent
        - violation_definition
        - non_violation_definition
      title: LlmRule
    ValidationViolation:
      properties:
        rule_id:
          type: string
          title: Rule Id
          description: The rule ID that produced the violation.
        rule_kind:
          $ref: '#/components/schemas/ValidationRuleKind'
          description: The executable rule kind that produced the violation.
        attachment_id:
          type: string
          title: Attachment Id
          description: The attachment ID where the match was found.
        attachment_name:
          type: string
          title: Attachment Name
          description: The attachment name where the match was found.
        matched_text:
          anyOf:
            - type: string
            - type: 'null'
          title: Matched Text
          description: The exact text span that matched, when available.
        snippet:
          anyOf:
            - type: string
            - type: 'null'
          title: Snippet
          description: Short surrounding context for the matched text, when available.
        explanation:
          anyOf:
            - type: string
            - type: 'null'
          title: Explanation
          description: Optional explanation for why the violation was flagged.
      type: object
      required:
        - rule_id
        - rule_kind
        - attachment_id
        - attachment_name
      title: ValidationViolation
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    RegexFlag:
      type: string
      enum:
        - IGNORECASE
        - MULTILINE
        - DOTALL
      title: RegexFlag
    ValidationRuleKind:
      type: string
      enum:
        - regex
        - blacklist
        - llm
      title: ValidationRuleKind
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````