> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ndi.nace.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# generate_domain

> Draft a taxonomy and ontology from a domain description. Cost class: slow.

Synchronous and **non-persisting**: the model proposes vocabularies the
author edits, then posts to ``POST /v1/domains``. Nothing is written to the
database and no job is created. Kept off MCP because authoring is a reviewed
human act, not an agent-loop step.



## OpenAPI

````yaml /openapi.json post /v1/domains/generate
openapi: 3.1.0
info:
  description: >-
    Document intelligence: parse, split, classify, extract, and ground files, or
    build a searchable workspace. Authenticate with ``X-API-Key``.
  title: NDI Platform API
  version: 0.1.0
servers:
  - url: https://ndi-api.nace.ai
security: []
tags: []
paths:
  /v1/domains/generate:
    post:
      tags:
        - domains
      summary: generate_domain
      description: >-
        Draft a taxonomy and ontology from a domain description. Cost class:
        slow.


        Synchronous and **non-persisting**: the model proposes vocabularies the

        author edits, then posts to ``POST /v1/domains``. Nothing is written to
        the

        database and no job is created. Kept off MCP because authoring is a
        reviewed

        human act, not an agent-loop step.
      operationId: generate_domain_v1_domains_generate_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateDomainRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateDomainResponse'
          description: Successful Response
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Gateway Timeout
        default:
          content:
            application/json:
              example:
                error:
                  code: invalid_request
                  detail: null
                  message: >-
                    Request body has extra fields that this operation does not
                    accept.
                  request_id: req-01j9k2n3p4q5r6s7t8v9
                  retryable: false
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: >-
            Typed error envelope used by every 4xx and 5xx. ``error.code``
            distinguishes the failure; HTTP status is a consequence of the code.
      security:
        - APIKeyHeader: []
components:
  schemas:
    GenerateDomainRequest:
      additionalProperties: false
      description: |-
        Ask the model for an unsaved taxonomy + ontology draft.

        Nothing is persisted: the caller edits the draft, then posts it to
        ``POST /v1/domains``. Optional ``display_name`` / ``slug`` only seed the
        suggested identity fields returned alongside the vocabularies.
      properties:
        description:
          description: >-
            What kinds of files belong in this domain — the classifier-facing
            brief.
          maxLength: 4000
          minLength: 1
          title: Description
          type: string
        display_name:
          anyOf:
            - maxLength: 200
              minLength: 1
              type: string
            - type: 'null'
          description: Optional name hint used when suggesting a display name and slug.
          title: Display Name
        slug:
          anyOf:
            - maxLength: 64
              pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$
              type: string
            - type: 'null'
          description: >-
            Optional slug hint. When omitted, one is derived from the display
            name or description.
          title: Slug
      required:
        - description
      title: GenerateDomainRequest
      type: object
    GenerateDomainResponse:
      additionalProperties: false
      description: An unsaved draft ready for the authoring UI to edit and then create.
      properties:
        ontology:
          $ref: '#/components/schemas/Ontology'
        suggested_display_name:
          maxLength: 200
          minLength: 1
          title: Suggested Display Name
          type: string
        suggested_slug:
          maxLength: 64
          pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$
          title: Suggested Slug
          type: string
        taxonomy:
          $ref: '#/components/schemas/Taxonomy-Output'
        validation:
          $ref: '#/components/schemas/DomainValidation'
          description: >-
            Publish-gate check on the normalized draft — always run so the UI
            knows it can create cleanly.
      required:
        - taxonomy
        - ontology
        - suggested_slug
        - suggested_display_name
        - validation
      title: GenerateDomainResponse
      type: object
    ErrorEnvelope:
      description: Every non-2xx body on ``/v1``.
      example:
        error:
          code: invalid_request
          detail: null
          message: Request body has extra fields that this operation does not accept.
          request_id: req-01j9k2n3p4q5r6s7t8v9
          retryable: false
      properties:
        error:
          $ref: '#/components/schemas/Error'
      required:
        - error
      title: ErrorEnvelope
      type: object
    Ontology:
      additionalProperties: false
      description: >-
        The graph shape. Closed node and edge types with declared domain/range.


        ``allow_other`` is the ontology's counterpart to
        :attr:`Taxonomy.allow_other`,

        and unlike it, this one *can* be turned off: a file must always be

        classifiable, but an entity need not always be extractable.
      properties:
        allow_other:
          default: false
          description: >-
            Offer the extractor the fallback entity type ('Other') and fallback
            relation ('RELATES_TO'). Set false to extract only what this
            ontology defines: the extraction prompt then lists neither, so a
            corpus stops paying for an open-ended tail of untyped nodes and
            edges. Files are unaffected — an unclassifiable one is still
            'OtherDocument'.
          title: Allow Other
          type: boolean
        edge_types:
          items:
            $ref: '#/components/schemas/EdgeType'
          maxItems: 200
          title: Edge Types
          type: array
        node_types:
          items:
            $ref: '#/components/schemas/NodeType'
          maxItems: 120
          title: Node Types
          type: array
      title: Ontology
      type: object
    Taxonomy-Output:
      additionalProperties: false
      description: The classification vocabulary.
      properties:
        allow_other:
          const: true
          default: true
          description: >-
            Cannot be disabled: a document that fits nothing is labelled
            'other', never force-fitted.
          title: Allow Other
          type: boolean
        classes:
          items:
            $ref: '#/components/schemas/TaxonomyClass'
          maxItems: 400
          title: Classes
          type: array
      title: Taxonomy
      type: object
    DomainValidation:
      additionalProperties: false
      description: >-
        Returned on every domain write, so a caller never has to guess whether a
        publish will succeed.
      properties:
        effective_class_count:
          title: Effective Class Count
          type: integer
        effective_edge_type_count:
          title: Effective Edge Type Count
          type: integer
        effective_node_type_count:
          title: Effective Node Type Count
          type: integer
        errors:
          items:
            $ref: '#/components/schemas/DomainValidationError'
          title: Errors
          type: array
        valid:
          title: Valid
          type: boolean
      required:
        - valid
        - effective_class_count
        - effective_node_type_count
        - effective_edge_type_count
      title: DomainValidation
      type: object
    Error:
      description: The error object, per spec 12 §1.8.
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        detail:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          description: Structured payload, when the code carries one.
          title: Detail
        message:
          description: Human- and model-readable; says what to do differently.
          title: Message
          type: string
        request_id:
          description: Per-request correlation id; matches the ``X-Request-Id`` header.
          title: Request Id
          type: string
        retryable:
          description: Whether retrying the identical request could succeed.
          title: Retryable
          type: boolean
      required:
        - code
        - message
        - retryable
        - request_id
      title: Error
      type: object
    EdgeType:
      additionalProperties: false
      properties:
        description:
          title: Description
          type: string
        from_types:
          items:
            type: string
          minItems: 1
          title: From Types
          type: array
        name:
          title: Name
          type: string
        property_hints:
          description: Suggested open-property keys carried on the edge.
          items:
            type: string
          title: Property Hints
          type: array
        to_types:
          items:
            type: string
          minItems: 1
          title: To Types
          type: array
      required:
        - name
        - from_types
        - to_types
        - description
      title: EdgeType
      type: object
    NodeType:
      additionalProperties: false
      properties:
        description:
          title: Description
          type: string
        identifier_hints:
          description: >-
            The subset of property_hints that carry a hard identifier (tax_id,
            account_no, ...); entity resolution treats a shared value on one of
            these as strong merge evidence.
          items:
            type: string
          title: Identifier Hints
          type: array
        name:
          title: Name
          type: string
        property_hints:
          description: >-
            Suggested open-property keys the extractor should look for on this
            type.
          items:
            type: string
          title: Property Hints
          type: array
        tier:
          maximum: 5
          minimum: 1
          title: Tier
          type: integer
      required:
        - name
        - tier
        - description
      title: NodeType
      type: object
    TaxonomyClass:
      additionalProperties: false
      description: >-
        One leaf of the two-level taxonomy.


        The two levels are ``group`` then ``subgroup`` — exactly two, which is
        what

        makes a folder path predictable and a classification prompt short enough
        to

        be accurate.
      properties:
        aliases:
          description: Renames land here so old folder paths stay resolvable.
          items:
            type: string
          title: Aliases
          type: array
        description:
          description: Written for the classifier — it IS the prompt.
          title: Description
          type: string
        document_type:
          description: The Tier-2 ontology type it maps to (rule R0).
          title: Document Type
          type: string
        group:
          maxLength: 64
          pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$
          title: Group
          type: string
        subgroup:
          maxLength: 64
          pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$
          title: Subgroup
          type: string
      required:
        - group
        - subgroup
        - description
        - document_type
      title: TaxonomyClass
      type: object
    DomainValidationError:
      additionalProperties: false
      properties:
        code:
          title: Code
          type: string
        message:
          title: Message
          type: string
        path:
          title: Path
          type: string
      required:
        - code
        - path
        - message
      title: DomainValidationError
      type: object
    ErrorCode:
      description: |-
        Every error the ``/v1`` surface can return.

        Clients must treat this as an **open** enum: a new member is an additive
        change (spec 12 §9), and a client that crashes on an unknown code makes
        every future error a breaking change.
      enum:
        - invalid_request
        - unsupported_file_type
        - file_too_large
        - invalid_schema
        - invalid_sql
        - invalid_path_prefix
        - command_not_permitted
        - batch_too_large
        - domain_validation_failed
        - default_label_required
        - wait_required_for_zero_retention
        - workspace_not_found
        - file_not_found
        - job_not_found
        - upload_not_found
        - node_not_found
        - schema_not_found
        - domain_not_found
        - session_not_found
        - access_label_not_found
        - path_conflict
        - schema_version_conflict
        - access_label_name_taken
        - workspace_name_taken
        - access_label_in_use
        - upload_expired
        - file_not_ingested
        - workspace_deleting
        - workspace_not_deletable
        - ingestion_in_progress
        - job_not_cancellable
        - confirmation_required
        - domain_not_published
        - domain_in_use
        - reserved_domain_slug
        - kg_not_built
        - kg_build_in_progress
        - session_busy
        - range_not_satisfiable
        - result_expired
        - access_denied
        - access_backstop_violation
        - access_mode_not_implemented
        - rate_limited
        - concurrency_limit_reached
        - quota_exceeded
        - corrupt_file
        - zero_byte_file
        - encrypted_file
        - parse_failed
        - ocr_failed
        - conversion_failed
        - sheetless_workbook
        - unplayable_media
        - unclassified_pages
        - job_cancelled
        - job_timeout
        - upstream_unavailable
        - internal_error
        - unauthorized
        - not_implemented
      title: ErrorCode
      type: string
  securitySchemes:
    APIKeyHeader:
      in: header
      name: X-API-Key
      type: apiKey

````