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

# create_domain

> Create a tenant-owned draft. Cost class: fast.

The draft is editable and **unusable** until published. Validation runs on
every write and is returned every time, so a caller never has to guess
whether a publish will succeed. Omitting ``ontology`` copies the platform's
generic ontology, so a plain taxonomy publishes without graph work.



## OpenAPI

````yaml /openapi.json post /v1/domains
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:
    post:
      tags:
        - domains
      summary: create_domain
      description: >-
        Create a tenant-owned draft. Cost class: fast.


        The draft is editable and **unusable** until published. Validation runs
        on

        every write and is returned every time, so a caller never has to guess

        whether a publish will succeed. Omitting ``ontology`` copies the
        platform's

        generic ontology, so a plain taxonomy publishes without graph work.
      operationId: create_domain_v1_domains_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDomainRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainResponse'
          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:
    CreateDomainRequest:
      additionalProperties: false
      description: >-
        Creates a ``draft`` at version 1 in the caller's tenant.


        Most domains should omit ``ontology`` entirely — the graph shape is far
        less

        corpus-specific than the taxonomy, and defaulting to the platform's
        generic

        ontology keeps rule R0 satisfiable by construction.
      properties:
        display_name:
          maxLength: 200
          minLength: 1
          title: Display Name
          type: string
        ontology:
          anyOf:
            - $ref: '#/components/schemas/Ontology'
            - type: 'null'
          description: >-
            Omitted copies the platform's generic ontology, so plain taxonomies
            publish without graph work.
        slug:
          maxLength: 64
          pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$
          title: Slug
          type: string
        taxonomy:
          $ref: >-
            #/components/schemas/ndi_service__app__platform_api__domains__schemas__Taxonomy
      required:
        - slug
        - display_name
        - taxonomy
      title: CreateDomainRequest
      type: object
    DomainResponse:
      additionalProperties: false
      properties:
        domain:
          $ref: '#/components/schemas/Domain'
        validation:
          $ref: '#/components/schemas/DomainValidation'
      required:
        - domain
        - validation
      title: DomainResponse
      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
    ndi_service__app__platform_api__domains__schemas__Taxonomy:
      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
    Domain:
      additionalProperties: false
      description: |-
        A domain with inheritance already resolved.

        A caller reading a domain wants the vocabulary that will actually be
        applied, not a delta they have to merge themselves.
      properties:
        class_count:
          title: Class Count
          type: integer
        display_name:
          title: Display Name
          type: string
        domain_id:
          format: uuid
          title: Domain Id
          type: string
        ontology:
          $ref: '#/components/schemas/Ontology'
          description: Effective, with the parent's inherited entries merged in.
        owner:
          enum:
            - platform
            - tenant
          title: Owner
          type: string
        parent_slug:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Inheritance lineage for platform domains that extend a base
            vocabulary.
          title: Parent Slug
        published_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Published At
        selectable:
          description: True once published; a workspace may only pin a published version.
          title: Selectable
          type: boolean
        slug:
          title: Slug
          type: string
        status:
          enum:
            - draft
            - published
          title: Status
          type: string
        taxonomy:
          $ref: '#/components/schemas/Taxonomy-Output'
        version:
          title: Version
          type: integer
      required:
        - domain_id
        - slug
        - display_name
        - owner
        - version
        - status
        - class_count
        - selectable
        - taxonomy
        - ontology
      title: Domain
      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
    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
    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

````