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

# Create BRK

> Creates, updates, deletes, or clones a BRK. This versatile endpoint handles all BRK modification operations through the `modifyBrxMode` parameter. When creating or updating a BRK, you must provide the complete BRK definition, including prompts, dependencies, and configuration parameters. For deletion, you only need to provide the BRK ID. For cloning, you need to provide the source BRK ID.



## OpenAPI

````yaml POST /modify_brx
openapi: 3.0.0
info:
  title: BRX API
  description: >-
    The BRX API provides comprehensive access to the BRX platform, allowing you
    to create, manage, and execute BRKs (BRX Knowledge Representations). This
    API enables seamless integration with your applications, automation of AI
    workflows, and programmatic control over your BRX resources.
  version: 1.0.0
  contact:
    name: BRX Support
    url: https://brx.ai
    email: jando@brx.ai
  termsOfService: https://brx.ai/terms
  license:
    name: Proprietary
    url: https://brx.ai/license
servers:
  - url: https://api.brx.ai
    description: Production API Server
  - url: https://staging-api.brx.ai
    description: Staging API Server
security:
  - apiKeyAuth: []
tags:
  - name: BRK Management
    description: Endpoints for creating, updating, and managing BRKs
  - name: BRK Execution
    description: Endpoints for executing and validating BRKs
  - name: Access Control
    description: Endpoints for managing access control to BRKs
  - name: API Key Management
    description: Endpoints for managing API keys
paths:
  /modify_brx:
    post:
      tags:
        - BRK Management
      summary: Modify BRK
      description: >-
        Creates, updates, deletes, or clones a BRK. This versatile endpoint
        handles all BRK modification operations through the `modifyBrxMode`
        parameter. When creating or updating a BRK, you must provide the
        complete BRK definition, including prompts, dependencies, and
        configuration parameters. For deletion, you only need to provide the BRK
        ID. For cloning, you need to provide the source BRK ID.
      operationId: modifyBrk
      requestBody:
        description: >-
          Modification request containing the operation type and relevant
          parameters
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - modifyBrxMode
              properties:
                modifyBrxMode:
                  type: string
                  enum:
                    - CREATE
                    - UPDATE
                    - DELETE
                    - CLONE
                    - OP
                    - TAG
                    - CALL_ORDER
                  description: >-
                    The type of modification to perform. CREATE creates a new
                    BRK, UPDATE modifies an existing BRK, DELETE removes a BRK,
                    CLONE creates a copy of an existing BRK, OP performs an
                    operation on a BRK, TAG adds or removes a tag from a BRK,
                    and CALL_ORDER modifies the execution order of BRK
                    dependencies.
                  example: CREATE
                brxId:
                  type: string
                  description: >-
                    The ID of the BRK to modify. Required for UPDATE, DELETE,
                    CLONE, OP, TAG, and CALL_ORDER operations. For CREATE
                    operations, a new ID will be generated if not provided.
                  example: brk-12345678-90ab-cdef-1234-567890abcdef
                brx:
                  type: object
                  description: >-
                    The complete BRK definition, including prompts,
                    dependencies, and configuration parameters. Required for
                    CREATE and UPDATE operations.
                  example:
                    brxId: brk-12345678-90ab-cdef-1234-567890abcdef
                    brxName: Example BRK
                    description: An example BRK for documentation
                    prompt:
                      prompt:
                        main: This is the main prompt template with {{variable}}
                    processParams:
                      processType: 0
                    dependantBrxIds:
                      main_brx_entry_schema: brk-12345678-90ab-cdef-1234-567890abcdef
                schema:
                  type: object
                  description: >-
                    The schema definition for the BRK, including input fields
                    and their types. Required for CREATE and UPDATE operations.
                  example:
                    schemaFields:
                      variable:
                        fieldValueDataType: string
                        fieldValue: ''
                    brxName: Example BRK
                    brxId: brk-12345678-90ab-cdef-1234-567890abcdef
                editorJSON:
                  type: object
                  description: >-
                    Optional editor-specific JSON data for the BRK. This can
                    include layout information, visual settings, and other
                    editor-specific metadata.
                  example:
                    layout:
                      nodes:
                        - id: node1
                          position:
                            x: 100
                            'y': 100
                      edges: []
                conf:
                  type: object
                  description: >-
                    Optional configuration parameters for the BRK. This can
                    include execution settings, model parameters, and other
                    configuration options.
                  example:
                    maxTokens: 1000
                    temperature: 0.7
                    topP: 0.9
                opType:
                  type: string
                  description: >-
                    The type of operation to perform on the BRK. Required for OP
                    operations.
                  example: VALIDATE
                tag:
                  type: string
                  description: >-
                    The tag to add or remove from the BRK. Required for TAG
                    operations.
                  example: production
                tagOp:
                  type: string
                  enum:
                    - PUSH
                    - PULL
                  description: >-
                    The tag operation to perform. PUSH adds a tag, PULL removes
                    a tag. Required for TAG operations.
                  example: PUSH
            examples:
              Create:
                summary: Create a new BRK
                value:
                  modifyBrxMode: CREATE
                  brx:
                    brxId: brk-12345678-90ab-cdef-1234-567890abcdef
                    brxName: Example BRK
                    description: An example BRK for documentation
                    prompt:
                      prompt:
                        main: This is the main prompt template with {{variable}}
                    processParams:
                      processType: 0
                    dependantBrxIds:
                      main_brx_entry_schema: brk-12345678-90ab-cdef-1234-567890abcdef
                  schema:
                    schemaFields:
                      variable:
                        fieldValueDataType: string
                        fieldValue: ''
                    brxName: Example BRK
                    brxId: brk-12345678-90ab-cdef-1234-567890abcdef
              Update:
                summary: Update an existing BRK
                value:
                  modifyBrxMode: UPDATE
                  brxId: brk-12345678-90ab-cdef-1234-567890abcdef
                  brx:
                    brxId: brk-12345678-90ab-cdef-1234-567890abcdef
                    brxName: Updated Example BRK
                    description: An updated example BRK for documentation
                    prompt:
                      prompt:
                        main: >-
                          This is the updated main prompt template with
                          {{variable}}
                    processParams:
                      processType: 0
                    dependantBrxIds:
                      main_brx_entry_schema: brk-12345678-90ab-cdef-1234-567890abcdef
                  schema:
                    schemaFields:
                      variable:
                        fieldValueDataType: string
                        fieldValue: ''
                    brxName: Updated Example BRK
                    brxId: brk-12345678-90ab-cdef-1234-567890abcdef
              Delete:
                summary: Delete a BRK
                value:
                  modifyBrxMode: DELETE
                  brxId: brk-12345678-90ab-cdef-1234-567890abcdef
              Clone:
                summary: Clone a BRK
                value:
                  modifyBrxMode: CLONE
                  brxId: brk-12345678-90ab-cdef-1234-567890abcdef
              AddTag:
                summary: Add a tag to a BRK
                value:
                  modifyBrxMode: TAG
                  brxId: brk-12345678-90ab-cdef-1234-567890abcdef
                  tag: production
                  tagOp: PUSH
      responses:
        '200':
          description: Modification response containing the result of the operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  modifyBrxResponse:
                    type: object
                    properties:
                      httpResponse:
                        type: object
                        properties:
                          isError:
                            type: boolean
                            description: Indicates whether the request resulted in an error
                            example: false
                          statusMsg:
                            type: string
                            description: A message describing the status of the request
                            example: BRK created successfully
                          brxId:
                            type: string
                            description: The ID of the BRK that was modified
                            example: brk-12345678-90ab-cdef-1234-567890abcdef
                          cloned_from:
                            type: string
                            description: >-
                              The ID of the BRK that was cloned (only for CLONE
                              operations)
                            example: brk-abcdef12-3456-7890-abcd-ef1234567890
                          callOrder:
                            type: array
                            description: >-
                              The execution order of BRK dependencies (only for
                              CALL_ORDER operations)
                            items:
                              type: object
                              properties:
                                brxId:
                                  type: string
                                  description: The ID of the dependent BRK
                                  example: brk-12345678-90ab-cdef-1234-567890abcdef
                                order:
                                  type: integer
                                  description: The execution order of the dependent BRK
                                  example: 1
              examples:
                CreateSuccess:
                  summary: Successful BRK creation
                  value:
                    modifyBrxResponse:
                      httpResponse:
                        isError: false
                        statusMsg: BRK created successfully
                        brxId: brk-12345678-90ab-cdef-1234-567890abcdef
                UpdateSuccess:
                  summary: Successful BRK update
                  value:
                    modifyBrxResponse:
                      httpResponse:
                        isError: false
                        statusMsg: BRK updated successfully
                        brxId: brk-12345678-90ab-cdef-1234-567890abcdef
                DeleteSuccess:
                  summary: Successful BRK deletion
                  value:
                    modifyBrxResponse:
                      httpResponse:
                        isError: false
                        statusMsg: BRK deleted successfully
                        brxId: brk-12345678-90ab-cdef-1234-567890abcdef
                CloneSuccess:
                  summary: Successful BRK cloning
                  value:
                    modifyBrxResponse:
                      httpResponse:
                        isError: false
                        statusMsg: BRK cloned successfully
                        brxId: brk-12345678-90ab-cdef-1234-567890abcdef
                        cloned_from: brk-abcdef12-3456-7890-abcd-ef1234567890
        '400':
          description: >-
            Bad Request - The request was malformed or missing required
            parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                MissingMode:
                  summary: Missing Modification Mode
                  value:
                    httpResponse:
                      isError: true
                      errorID: bad-request
                      statusMsg: 'Missing required parameter: modifyBrxMode'
                InvalidMode:
                  summary: Invalid Modification Mode
                  value:
                    httpResponse:
                      isError: true
                      errorID: bad-request
                      statusMsg: 'Invalid modifyBrxMode: INVALID_MODE'
        '401':
          description: Unauthorized - Authentication credentials are missing or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            Forbidden - The authenticated user does not have permission to
            modify the requested BRK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                NoPermission:
                  summary: No Permission
                  value:
                    httpResponse:
                      isError: true
                      errorID: forbidden
                      statusMsg: You do not have permission to modify this BRK
        '404':
          description: >-
            Not Found - The requested BRK does not exist (for UPDATE, DELETE,
            CLONE operations)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                BrkNotFound:
                  summary: BRK Not Found
                  value:
                    httpResponse:
                      isError: true
                      errorID: not-found
                      statusMsg: >-
                        BRK with ID 'brk-12345678-90ab-cdef-1234-567890abcdef'
                        not found
        '500':
          description: Internal Server Error - An unexpected error occurred on the server
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        httpResponse:
          type: object
          properties:
            isError:
              type: boolean
              example: true
            errorID:
              type: string
              example: error-id
            statusMsg:
              type: string
              example: Error message
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: key

````