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

# Check Document Conflicts

> Create an async document conflict-check job and publish the final result to the requested Pub/Sub topic.



## OpenAPI

````yaml https://document-assistant.us.aodocs.app/openapi.json post /assistant/api/v1/tenants/{tenant}/documents:checkConflicts
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:checkConflicts:
    post:
      tags:
        - document_conflict
      summary: Check Document Conflicts
      description: >-
        Create an async document conflict-check job and publish the final result
        to the requested Pub/Sub topic.
      operationId: >-
        check_document_conflicts_assistant_api_v1_tenants__tenant__documents_checkConflicts_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/DocumentConflictCheckRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictCheckJobResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    DocumentConflictCheckRequest:
      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
        target_library_id:
          type: string
          title: Target Library Id
          description: Library ID containing the target documents to compare against.
        target_document_class_id:
          type: string
          title: Target Document Class Id
          description: >-
            Document class ID containing the target documents to compare
            against.
        pubsub_topic:
          anyOf:
            - type: string
            - type: 'null'
          title: Pubsub Topic
          description: Pub/Sub topic that will receive the final job envelope.
        join_conditions:
          items:
            $ref: '#/components/schemas/JoinCondition'
          type: array
          minItems: 1
          title: Join Conditions
          description: All join conditions must match for a target document to be included.
        rules:
          items:
            oneOf:
              - $ref: '#/components/schemas/MetadataConflictRule'
              - $ref: '#/components/schemas/LLMConflictRule'
            discriminator:
              propertyName: kind
              mapping:
                llm:
                  $ref: '#/components/schemas/LLMConflictRule'
                metadata:
                  $ref: '#/components/schemas/MetadataConflictRule'
          type: array
          minItems: 1
          title: Rules
          description: Conflict rules to execute on each matched target document.
      type: object
      required:
        - document_id
        - target_library_id
        - target_document_class_id
        - join_conditions
        - rules
      title: DocumentConflictCheckRequest
    ConflictCheckJobResponse:
      properties:
        job_id:
          type: string
          title: Job Id
          description: Conflict-check job ID.
        status:
          $ref: '#/components/schemas/ConflictCheckStatus'
          description: Job status.
        document_id:
          type: string
          title: Document Id
          description: Base document ID.
        target_library_id:
          type: string
          title: Target Library Id
          description: Target library ID.
        target_document_class_id:
          type: string
          title: Target Document Class Id
          description: Target document class ID.
        matched_documents:
          type: integer
          title: Matched Documents
          description: Number of matched target documents.
        conflicted_documents:
          type: integer
          title: Conflicted Documents
          description: Number of matched target documents with conflicts.
        notification_status:
          $ref: '#/components/schemas/NotificationStatus'
          description: Pub/Sub notification state for the final job envelope.
        result:
          anyOf:
            - $ref: '#/components/schemas/ConflictCheckResult'
            - type: 'null'
          description: Final result when the job has completed.
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Failure reason when the job has failed.
        expire_at:
          type: string
          format: date-time
          title: Expire At
          description: Automatic cleanup timestamp for the stored job.
      type: object
      required:
        - job_id
        - status
        - document_id
        - target_library_id
        - target_document_class_id
        - matched_documents
        - conflicted_documents
        - notification_status
        - expire_at
      title: ConflictCheckJobResponse
    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
    JoinCondition:
      properties:
        base_field_id:
          type: string
          title: Base Field Id
          description: Field ID on the base document side.
        target_field_id:
          type: string
          title: Target Field Id
          description: Field ID on the target document side.
      type: object
      required:
        - base_field_id
        - target_field_id
      title: JoinCondition
    MetadataConflictRule:
      properties:
        kind:
          type: string
          const: metadata
          title: Kind
          default: metadata
        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.
        base_field_id:
          type: string
          title: Base Field Id
          description: Field ID on the base document side for this rule.
        target_field_id:
          type: string
          title: Target Field Id
          description: Field ID on the target document side for this rule.
      type: object
      required:
        - rule_id
        - base_field_id
        - target_field_id
      title: MetadataConflictRule
    LLMConflictRule:
      properties:
        kind:
          type: string
          const: llm
          title: Kind
          default: llm
        rule_id:
          type: string
          maxLength: 100
          title: Rule Id
          description: Stable rule ID supplied by the caller.
        display_name:
          anyOf:
            - type: string
              maxLength: 100
            - type: 'null'
          title: Display Name
          description: Optional human-readable label for the rule.
        description:
          anyOf:
            - type: string
              maxLength: 500
            - type: 'null'
          title: Description
          description: Optional human-readable description of the rule for callers.
        conflict_definition:
          type: string
          maxLength: 500
          title: Conflict Definition
          description: >-
            What should be treated as a conflict for this rule, e.g. 'any
            difference in the numeric interest rate or product fees'. This is
            the primary guidance the LLM uses to detect conflicts for this rule.
        examples:
          anyOf:
            - items:
                type: string
                maxLength: 200
              type: array
              maxItems: 5
            - type: 'null'
          title: Examples
          description: Optional example conflict descriptions to steer the model.
        additional_instructions:
          anyOf:
            - type: string
              maxLength: 500
            - type: 'null'
          title: Additional Instructions
          description: Optional free-form extra guidance for the conflict detection.
      type: object
      required:
        - rule_id
        - conflict_definition
      title: LLMConflictRule
    ConflictCheckStatus:
      type: string
      enum:
        - PENDING
        - RUNNING
        - COMPLETED
        - FAILED
      title: ConflictCheckStatus
    NotificationStatus:
      type: string
      enum:
        - PENDING
        - SENT
        - FAILED
      title: NotificationStatus
    ConflictCheckResult:
      properties:
        matched_documents:
          type: integer
          title: Matched Documents
          description: Number of matched target documents evaluated.
        conflicted_documents:
          type: integer
          title: Conflicted Documents
          description: Number of matched target documents with at least one conflict.
        returned_conflicted_documents:
          type: integer
          title: Returned Conflicted Documents
          description: >-
            Number of conflicted target documents included in this result
            payload.
        truncated:
          type: boolean
          title: Truncated
          description: >-
            Whether conflicted target documents were capped in the result
            payload.
        llm_truncated:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Llm Truncated
          description: >-
            Whether some matched documents were not checked by the LLM because
            the per-job LLM comparison budget was exhausted. None when the
            request had no LLM rule.
        llm_compared_documents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Llm Compared Documents
          description: >-
            Number of matched documents actually compared by the LLM. None when
            the request had no LLM rule.
        llm_skipped_documents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Llm Skipped Documents
          description: >-
            Number of matched documents skipped by the LLM because the per-job
            LLM comparison budget was exhausted. None when the request had no
            LLM rule.
        documents:
          items:
            $ref: '#/components/schemas/ComparedDocumentResult'
          type: array
          title: Documents
          description: Conflicted target documents included in the result payload.
      type: object
      required:
        - matched_documents
        - conflicted_documents
        - returned_conflicted_documents
        - truncated
        - documents
      title: ConflictCheckResult
    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
    ComparedDocumentResult:
      properties:
        document_id:
          type: string
          title: Document Id
          description: Matched target document ID.
        document_title:
          type: string
          title: Document Title
          description: Matched target document title.
        document_link:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Link
          description: Link to the matched target document.
        conflicts:
          items:
            $ref: '#/components/schemas/MetadataConflict'
          type: array
          title: Conflicts
          description: Metadata conflicts detected for this target document.
        llm_conflicts:
          items:
            $ref: '#/components/schemas/LLMConflict'
          type: array
          title: Llm Conflicts
          description: LLM-detected conflicts for this target document.
        has_conflict:
          type: boolean
          title: Has Conflict
          description: Whether this target document has a conflict.
      type: object
      required:
        - document_id
        - document_title
        - conflicts
        - has_conflict
      title: ComparedDocumentResult
    MetadataConflict:
      properties:
        rule_id:
          type: string
          title: Rule Id
          description: The rule that detected this conflict.
        base_field_id:
          type: string
          title: Base Field Id
          description: Field ID on the base document side.
        target_field_id:
          type: string
          title: Target Field Id
          description: Field ID on the target document side.
        base_values:
          items:
            type: string
          type: array
          title: Base Values
          description: Normalized display values from the base document.
        target_values:
          items:
            type: string
          type: array
          title: Target Values
          description: Normalized display values from the target document.
        explanation:
          type: string
          title: Explanation
          description: Human-readable explanation of the conflict.
      type: object
      required:
        - rule_id
        - base_field_id
        - target_field_id
        - base_values
        - target_values
        - explanation
      title: MetadataConflict
    LLMConflict:
      properties:
        rule_id:
          type: string
          title: Rule Id
          description: The rule that detected this conflict.
        summary:
          type: string
          title: Summary
          description: Human-readable description of the detected conflict.
        base_evidence:
          type: string
          title: Base Evidence
          description: Verbatim excerpt from the base document supporting the conflict.
        target_evidence:
          type: string
          title: Target Evidence
          description: Verbatim excerpt from the target document supporting the conflict.
      type: object
      required:
        - rule_id
        - summary
        - base_evidence
        - target_evidence
      title: LLMConflict
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````