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

# Edit an ontology's draft

> Apply small changes (add or update a concept, relate, map, …) to the draft, all or nothing. A mapping needs a table you can read.



## OpenAPI

````yaml post /api/registry/ontologies/{artifact_id}/edit
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/registry/ontologies/{artifact_id}/edit:
    post:
      tags:
        - Ontologies
      summary: Edit an ontology's draft
      description: >-
        Apply small changes (add or update a concept, relate, map, …) to the
        draft, all or nothing. A mapping needs a table you can read.
      operationId: edit_draft_api_registry_ontologies__artifact_id__edit_post
      parameters:
        - name: artifact_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: The ontology's artifact ID.
            title: Artifact Id
          description: The ontology's artifact ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OntologyEditRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OntologyEditResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Conflict
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Content
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    OntologyEditRequest:
      properties:
        ops:
          items:
            $ref: '#/components/schemas/OntologyEditOp'
          type: array
          maxItems: 200
          minItems: 1
          title: Ops
        changelog:
          anyOf:
            - type: string
              maxLength: 4000
            - type: 'null'
          title: Changelog
        start_draft:
          type: boolean
          title: Start Draft
          description: With no draft, start one from the newest version first.
          default: false
      type: object
      required:
        - ops
      title: OntologyEditRequest
      description: Apply changes to an ontology's draft, all or nothing.
    OntologyEditResponse:
      properties:
        artifact_id:
          type: string
          format: uuid
          title: Artifact Id
        version_id:
          type: string
          format: uuid
          title: Version Id
        version:
          type: string
          title: Version
        applied:
          type: integer
          title: Applied
        created:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Created
          description: 'Ids generated for added groups and concepts: {op_index, op, id}.'
        counts:
          additionalProperties:
            type: integer
          type: object
          title: Counts
        findings:
          items:
            $ref: '#/components/schemas/OntologyFinding'
          type: array
          title: Findings
      type: object
      required:
        - artifact_id
        - version_id
        - version
        - applied
        - counts
        - findings
      title: OntologyEditResponse
      description: The draft after an edit.
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: A brief description of the error that occurred.
        code:
          type: integer
          title: Code
          description: The HTTP status code associated with the error.
          default: 500
      type: object
      required:
        - error
      title: ErrorResponse
    OntologyEditOp:
      properties:
        op:
          type: string
          enum:
            - add_group
            - update_group
            - remove_group
            - add_concept
            - update_concept
            - remove_concept
            - relate
            - unrelate
            - map
            - unmap
          title: Op
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        parent:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent
        group:
          anyOf:
            - type: string
            - type: 'null'
          title: Group
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        definition:
          anyOf:
            - type: string
            - type: 'null'
          title: Definition
        synonyms:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Synonyms
        properties:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Properties
        source:
          anyOf:
            - type: string
            - type: 'null'
          title: Source
        kind:
          anyOf:
            - type: string
              enum:
                - is_a
                - has_a
                - values
                - related
                - named
            - type: 'null'
          title: Kind
        target:
          anyOf:
            - type: string
            - type: 'null'
          title: Target
        label:
          anyOf:
            - type: string
            - type: 'null'
          title: Label
        concept:
          anyOf:
            - type: string
            - type: 'null'
          title: Concept
        table:
          anyOf:
            - type: string
            - type: 'null'
          title: Table
        column:
          anyOf:
            - type: string
            - type: 'null'
          title: Column
        note:
          anyOf:
            - type: string
            - type: 'null'
          title: Note
      additionalProperties: false
      type: object
      required:
        - op
      title: OntologyEditOp
      description: >-
        One change to a draft. Which fields apply depends on ``op``.


        * ``add_group``: name, optional id, parent, description

        * ``update_group``: id, then any of name, parent, description

        * ``remove_group``: id (its concepts and sub-groups move to its parent)

        * ``add_concept``: name, optional id, group, definition, synonyms,
        properties

        * ``update_concept``: id, then any of name, group, definition, synonyms,
          properties (given fields replace; omitted ones stay)
        * ``remove_concept``: id (its relations and mappings go with it)

        * ``relate`` / ``unrelate``: source, kind, target, label (named only)

        * ``map`` / ``unmap``: concept, table, column, note
    OntologyFinding:
      properties:
        level:
          type: string
          enum:
            - error
            - warning
            - info
          title: Level
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
        concept:
          anyOf:
            - type: string
            - type: 'null'
          title: Concept
      type: object
      required:
        - level
        - code
        - message
      title: OntologyFinding
      description: Something a reviewer should know about a version.
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````

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