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

# Create collaboration rule

> Create conditions that route extraction results to human review.

See [Human collaboration](/en/api-reference/collaboration) for the integration flow and trigger semantics. Retrieve the rule after saving to verify the conditions.


## OpenAPI

````yaml en/api-reference/adp-api.yaml POST /open/agentic_doc_processor/{tenant_name}/v1/collaboration/rules/create
openapi: 3.1.0
info:
  title: ADP API
  version: 1.0.0
  description: >-
    Laiye ADP OpenAPI reference for document extraction, recognition, and
    conversion; extraction application management; webhooks; human
    collaboration; credit usage; workflow discovery, runs, exports, and file
    management.
  license:
    name: MIT
    identifier: MIT
servers:
  - url: https://adp-global.laiye.com
    description: ADP global production endpoint
security: []
tags:
  - name: Document extraction
    description: Extract structured fields from uploaded documents.
  - name: Document recognition
    description: Recognize text, layout blocks, and positions from uploaded documents.
  - name: Document conversion
    description: >-
      Convert PDFs, Office documents, OFD files, and images into page images or
      native spreadsheet structures.
  - name: Application management
    description: >-
      Create, update, delete, and query extraction applications and
      configurations.
  - name: Webhook
    description: List system events and manage event callbacks.
  - name: Account
    description: Query credit usage.
  - name: Workflow
    description: >-
      List business workflow templates, run workflow applications, and query run
      results.
  - name: Workflow files
    description: Upload and manage files used by workflow applications.
  - name: Human collaboration
    description: >-
      Configure review triggers, query collaboration tasks, and submit human
      corrections.
paths:
  /open/agentic_doc_processor/{tenant_name}/v1/collaboration/rules/create:
    post:
      tags:
        - Human collaboration
      summary: Create collaboration rule
      description: >-
        Create a set of conditions that route matching documents to human
        review; each application uses one rule set.


        After saving, query the rule and verify its name, conditions, and logic.
        Unsupported natural-language conditions may return success without
        saving. rule_status is currently unreliable on reads; verify the
        effective enabled state.


        HTTP 200 does not guarantee business success; check code.


        See [Human collaboration](/en/api-reference/collaboration) for
        integration steps and current limitations.
      operationId: createCollaborationRule
      parameters:
        - $ref: '#/components/parameters/TenantName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollaborationRuleRequest'
            example:
              app_id: app_abc123
              rule_name: Invoice human review
              rule_status: true
              rule:
                - rule_dimension: Invoice number
                  rule_setting: Equals INV-AUDIT-001
              rule_logic: 1
      responses:
        '200':
          description: >-
            Business response. Check code and read business state back after
            writes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollaborationEmptyResponse'
              example:
                code: success
                message: ''
                tips: null
                data: {}
        '401':
          description: Missing API key.
        '404':
          description: Invalid API key or inaccessible request.
        '422':
          $ref: '#/components/responses/ValidationError'
      security:
        - ApiKeyAuth: []
components:
  parameters:
    TenantName:
      name: tenant_name
      in: path
      required: true
      description: 'Tenant name. Default: laiye.'
      schema:
        type: string
        default: laiye
  schemas:
    CollaborationRuleRequest:
      type: object
      properties:
        app_id:
          type: string
          description: >-
            Application ID. Use the actual ID of a published standard custom
            extraction application owned by the current account.
          example: app_abc123
        rule_name:
          type: string
          description: >-
            Rule name. The current service allows at most 50 characters and
            requires unique names across applications under the same account.
          minLength: 1
          maxLength: 50
        rule_status:
          type: boolean
          default: true
          description: >-
            Whether the rule is enabled. Use false to disable it. The query
            endpoint may still return true; verify the effect with an extraction
            run.
        rule:
          type: array
          items:
            $ref: '#/components/schemas/CollaborationRuleItem'
          minItems: 1
          maxItems: 100
          description: Review trigger conditions, 1–100 items.
        rule_logic:
          type: integer
          default: 1
          enum:
            - 1
            - 2
          description: >-
            1=any condition matches (OR); 2=all conditions match (AND). Send
            only 1 or 2; other values may currently be accepted incorrectly.
      required:
        - app_id
        - rule_name
        - rule
    CollaborationEmptyResponse:
      type: object
      properties:
        code:
          type: string
          description: >-
            Business result code. Success is success; failures may use
            server_error, http_server_error, or other strings. Always check this
            field, including for HTTP 200.
        message:
          type: string
        tips:
          type:
            - string
            - 'null'
        data:
          anyOf:
            - type: object
            - type: 'null'
    CollaborationRuleItem:
      type: object
      properties:
        rule_dimension:
          type: string
          description: >-
            Review dimension: 整体文档 (overall document), 文档置信度 (document
            confidence), or a published field name. Prefer ordinary fields whose
            name matches their key; verify triggering for system dimensions and
            fields whose name differs from their key.
        rule_setting:
          type: string
          description: >-
            Natural-language condition that triggers human review, for example
            “equals INV-AUDIT-001”. A match routes the document to human review.
      required:
        - rule_dimension
        - rule_setting
    HTTPValidationError:
      type: object
      description: FastAPI/Pydantic request validation error.
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorItem'
      required:
        - detail
    ValidationErrorItem:
      type: object
      additionalProperties: true
      properties:
        type:
          type: string
          description: Validation error type.
        loc:
          type: array
          description: Location of the invalid field in the request.
          items:
            oneOf:
              - type: string
              - type: integer
        msg:
          type: string
          description: Human-readable validation error message.
        input:
          description: Input value that failed validation.
        ctx:
          type: object
          additionalProperties: true
          description: Additional context supplied by the validator.
        url:
          type: string
          format: uri
          description: Link to the Pydantic error documentation.
      required:
        - type
        - loc
        - msg
  responses:
    ValidationError:
      description: Validation error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/HTTPValidationError'
          example:
            detail:
              - type: greater_than
                loc:
                  - query
                  - limit
                msg: Input should be greater than 0
                input: 0
                ctx:
                  gt: 0
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        Production API Key. You can find it under My API in the ADP platform.
        Make sure the API Key is active and belongs to the production
        environment.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.